How to remove the shadow around the hand image

5 views (last 30 days)
Hello everyone,
I have some hand database and when i want to do the segmentation the shadow around the hand border also combine in the image boundary an it makes the hand boundary bigger. I really want to get rid of the shadow around the hand which i can then use the segmentation method to get the correct boundary.
sample images are attached.
Thanks

Answers (1)

Image Analyst
Image Analyst on 3 Dec 2015
You can do it all in one step - no need to remove shadow and then afterwards segment. Just segment properly in the first place and you're done. Just convert to hsv color space, threshold on the s channel and that's your mask. Multiply by your RGB image if you want to blacken outside the hand.
hsvImage = rgb2hsv(rgbImage);
sImage = hsvImage(:,:,2);
mask = sImage > 0.1; % Or whatever value works.
% Mask the image using bsxfun() function
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
  2 Comments
Image Analyst
Image Analyst on 4 Dec 2015
I didn't tell you to do any of that.
Why do people think edge detection is the be-all, end-all of image processing methods when most of the time it's not appropriate (like in your case)?
Why don't you try my code instead?
Image Analyst
Image Analyst on 4 Dec 2015
Unfortunately, the the light bouncing off your fingers is coloring the light that falls onto the white background, making color segmentation difficult. To fix it, you can either use a backlight (like a radiologist's type of lightbox), or hold your hand farther away to make the shadows less defined, or use a different color background - something the opposite of red like green or blue, or even black would be better. The ideal background would be black velvet, with lighting coming from the camera side of the hand. Failing that then the next best is a white light box behind the hand to essentially make a silhouette. About the best I could do in a few minutes is this:

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!