1

I have the image of hand that was detected using this link. Its hand detection using HSV color space.

Now I face a problem: I need to get the enclosing area/draw bounding lines possible enough to determine the hand area, then fill the enclosing area and subtract it from the original to remove the hand.

I have thus so far tried to blurring the image to reduce noise, dilating the image, closing holes, etc. that seem to be an overdose. I have tried contours, and that seem to be the best approach so far. I was trying to get the convex hull (largest) and I ended up with the following after testing with different thresholds.

enter image description here

The inaccuracies can be seen with the thumb were the hull straightens. It must be curved. I am trying to figure out the location of the hand so to identify the region being covered by the hand. Going to subtract it to remove the hand from the original image. That is what I want to achieve.

Is there a better approach to this?

And ideas suggestions greatly appreciated.

Original and detected are as follows

enter image description here

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114

2 Answers2

1

Assuming you want to identify hand area instead of the area convex hull gives and background of the application is at least in same color, I would apply hsv-threshold to identify background instead of hand if possible. Or maybe adaptive threshold if light distribution is not consistent. I believe this is what many applications do

If background can't be fixed, the segmentation is not an easy problem to resolve as you should take care of shadows and palm lines.

Tae-Sung Shin
  • 20,215
  • 33
  • 138
  • 240
1

Instead of the convex hull, consider using the alpha hull, which can better follow the contours of a shape by allowing concavities.

This site has a nice summary of alpha shapes: "Everything You Always Wanted to Know About Alpha Shapes But Were Afraid to Ask" by François Bélair.

http://cgm.cs.mcgill.ca/~godfried/teaching/projects97/belair/alpha.html

As David mentioned in his post, consider thresholding using HSV (or HSI) color space rather than on RGB or grayscale. If you can allow for longer processing time, you can use an algorithm such as Mean Shift to segment trickier images like yours. OpenCV has an implementation of Mean Shift, and the book Learning OpenCV provides a concise description of the algorithm.

Image Segmentation using Mean Shift explained

In any case, a standard binarization threshold doesn't appear to be helping much. Consider using a dynamic threshold; at least local/dynamic threshold is implemented for contours in OpenCV, from what I recall.

Community
  • 1
  • 1
Rethunk
  • 3,976
  • 18
  • 32
  • I am using HSV space to detect the hand –  Oct 08 '12 at 05:19
  • This just seems to be what I wanted. I will have to see if its in OpenCV as well –  Oct 08 '12 at 05:27
  • Can you achieve sharper focus? Can you use diffuse lighting ("cloudy day" illumination) to reduce shadows, or angled lighting to create stark, consistent shadows? Could you just change the background color since it's killing contrast along some edges? Dark pixels are a problem, but ALL dark pixels are associated with the hand and its shadows. That could mess up a histogram-based binarization. Considering remapping every pixel with a channel intensity of less than 20 (or whatever) to the nearest color with a value above the threshold. Consider using just one or two of the HSV channels. – Rethunk Oct 08 '12 at 05:34
  • I cannot do much at the very moment. But I will definitely post a sharper image. I will definitely try your suggestions. –  Oct 08 '12 at 05:38