Exact Skin color HSV range

2019-03-11 16:40发布

I have seen all questions on SO for range of HSV color space for skin
But I can only figure out this

Code -

CvScalar  hsv_min = cvScalar(0, 30, 60, 0);
CvScalar  hsv_max = cvScalar(20, 150, 255, 0);
//range I am using is { 0,30,60,0 & 20,150,255,0 }
cvCvtColor(src, hsv_image, CV_BGR2HSV);
cvInRangeS (hsv_image, hsv_min, hsv_max, hsv_mask);
cvDilate(hsv_mask,hsv_mask,0,1);
cvErode(hsv_mask,hsv_mask,0,1);
cvSmooth( hsv_mask, hsv_mask, CV_MEDIAN);

Problem with this range ( { 0,30,60,0 & 20,150,255,0 } ) is it detects even red color and when you place your hand in red background it does not track your skin...
Please Help !!!

7条回答
爷、活的狠高调
2楼-- · 2019-03-11 17:24

According to this : http://matmidia.org/sibgrapi2009/media/posters/59928.pdf

The skin in channel H is characterized by values between 0 and 50, in the channel S from 0.23 to 0.68 for Asian and Caucasian ethnics.

You'll have to take extra care with very dark parts of the image and probably discard them altogether, as the HSV conversion gets really noisy for small values of V.

Depending on what your constraints are, you could also consider using a coloured glove (some colour that is not appearing normally in the scene), or setting a background of different colour than red, that is further away from skin colours (magenta, green, whatever).

查看更多
登录 后发表回答