How to remove the shadow around the hand image
4 次查看(过去 30 天)
显示 更早的评论
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
回答(1 个)
Image Analyst
2015-12-3
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 个评论
Image Analyst
2015-12-4
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
2015-12-4
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:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!