mtschirs/js-objectdetect

hand detection - with rotated hand

Closed this issue · 4 comments

Hi, I'm trying to detect a hand open using the hand down in the picture.. Is possible to track the hand in 180 degrees, with fingers pointing to down?

The js-objectdetect can work with rotation limits in degrees? I'm planning to rotate the canvas before find, but it will be so expensive computationally... I really don't now what's the best way to find a hand down nested to the body... I'm trying to track the hand in the following positions:

siluette_f_front siluette_f_side

The images are merely illustrating the intent of each human position. I'm trying to track real hands from people in the web camera.

A standard technique is to rotate the image e.g. in 45° steps before applying the detector.

If you only care about the 90° rotations, you could apply these rotations to the classifier instead. That functionality is not implemented in js-objectdetect but could be an interestind addition. The implementation would follow the pattern of the mirrorClassifier method which works pretty similar.

In the end, however, you can't avoid to either always rotate the image in every step and re-run the classification on the rotated images OR rotate the classifier in a preliminary step and re-run the classification with the rotated classifiers.

Edit: If you want to detect the hand as shown in your second picture with the palms facing away from the camera however, you would need to train another classifier. With a single classifier, you can only detect rotations of the object said classifier was trained on if the plane of rotation is facing (perpendicular to) the camera (i.e. the palms are always facing the camera).

Thank you @mtschirs! I'll try look how the mirrorClassifier works and implement the rotation...

How can I see the images used on the current classifiers?

Thank you for tell me about the classifiers. I'll try to switch to a fist hand and keep using the current classifiers only rotated...

How much complex is feed a new classifier on js-objectdetect? I need to crop the images on the limits what I want to trainee? There's a script to automate these?

Unfortunately the js-objectdetect library is not very well documented right now. However, there are a lot of sources online about the classifiers used. Keywords would be "Haar Cascade Classifiers". To quickly grasp the concept of how the classifier works, have a look at http://docs.opencv.org/master/d7/d8b/tutorial_py_face_detection.html#gsc.tab=0

If you want to train your own classifier this might provide a good starting point: http://docs.opencv.org/2.4/doc/user_guide/ug_traincascade.html

If you want to know more about the specific classifiers provided with js-objectdetect, look into the classifier license file and follow the references. I am sure you will find papers on most of them detailing the training process.

Thank you for the resources @mtschirs! I'll 👀!