Ask Your Question

How to recognize hand on android devices

asked 2012-12-22 01:24:49 -0600

Dali gravatar image

Anyone can tell me how to recognize hand exactly in Android System ,better use algorithm to realize.

edit retag flag offensive close merge delete


Hi Dali I am working on a gesture recognition app for android for touch-free interaction with the phone. I tried to use haar classifier to detect the hand but it gives too many false positives. Is it possible for you to share your code on skin skin color detection? It will be of great help to me!

Niharika A gravatar imageNiharika A ( 2013-03-25 14:07:15 -0600 )edit

Convert the source image to the HSV color space, and then use the Core.inRange function to capture a specific color, I set the skin color range from (0,30,20,0) to (40,255,255,0), (I'm not sure whether it is appropriate) the final effect is not ideal, too. Maybe need to do some more complex processing

Dali gravatar imageDali ( 2013-05-27 02:06:06 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-22 12:29:32 -0600

rics gravatar image

To detect a hand you can start with skin color detection as it is described here or here or here finding those pixels that match some predefined condition.

edit flag offensive delete link more


I write the follow code according to handDetection.cpp,but the result is negative .What's wrong?By the way do you know which functions in opencv-android library can replace the "cvAnd" and "cvOr" functions?

the code :

Scalar hsv_min = new Scalar(0,30,80,0); Scalar hsv_max = new Scalar(0,30,80,0); Imgproc.cvtColor(src, hsv_image, Imgproc.COLOR_BGR2HSV); Core.inRange(hsv_image, hsv_min, hsv_max, hsv_mask); Utils.matToBitmap(hsv_mask, bmp);

Dali gravatar imageDali ( 2012-12-27 02:42:22 -0600 )edit

You should first check the color of the hand pixels with given lighting conditions and hsv limits should be set accordingly.

Here is the OpenCV java documentation: . The Core class contains bitwise_and and bitwise_or.

rics gravatar imagerics ( 2012-12-27 14:27:46 -0600 )edit

Thank you,rics! I already recognized the skin,then i have to distinguish hand from face.Do you have good advice?

Dali gravatar imageDali ( 2012-12-27 20:59:10 -0600 )edit

You can use contour detection. Hand skin may have concave parts if fingers are open. You may detect face with a Haar cascade classifier and use only negative answers if only face and hands are on the image.

rics gravatar imagerics ( 2012-12-28 17:26:15 -0600 )edit

I used convexHull and convexityDefects function to find hand convex hull and the convexity defects of it in these day,but i didn't know what should to do for distinguish them yet? By the way,if i want to read the number that the gesture showed,how to realize? I searched in the internet much ,but nothing helpful. Can you help me ? I am a fresher, really appreciate !

Dali gravatar imageDali ( 2013-01-04 02:46:27 -0600 )edit

There are convexity defects on an open palm. If you find a skin colored objects with convexity defects it can be a hand. For closed palm you can try another Haar classifier: Moreover a similar question appeared here: .

rics gravatar imagerics ( 2013-01-09 02:19:35 -0600 )edit

Hi,rics,I have visited your website,saw the MINDdroidCV,but I can't watch the videos, can you show me them? By the way ,could you calculate the distance between the robot from and light blob?

Dali gravatar imageDali ( 2013-01-18 22:01:47 -0600 )edit

They are on youtube, so you could watch if your computer is properly set. You may try to watch it from here: I have not tried distance calculation. I would use a known object with distinctive colour and I would count the pixels of the object colour (with zeroth moment) on the image from some measured distance during the learning phase. Later I would count the pixels again and interpolate from the previously learned distance table. I do not think it is a really reliable method.

rics gravatar imagerics ( 2013-01-19 11:38:36 -0600 )edit

Question Tools


Asked: 2012-12-22 01:24:49 -0600

Seen: 3,858 times

Last updated: Dec 22 '12