Fine skin color HSV

I saw all the SO questions for the HSV color space range for the skin.
But I can only figure it out.

The 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);

The problem with this range ( {0,30,60,0 and 20,150,255,0} ) even detects red color and when you put your hand on a red background, it does not track your skin ...
Please help !!!

+7
source share
8 answers

In principle, it is difficult to have one fixed color range for the skin, because even if you want to find only your own skin, its color will really change greatly depending on the lighting conditions.

, , 2011 :

http://www.robots.ox.ac.uk/~vgg/research/hands/

, ( oepncv). ( ). , . , , .

+7

: http://matmidia.org/sibgrapi2009/media/posters/59928.pdf

H 0 50, S 0,23 0,68 .

, , , HSV V.

(- , ) , , (, , ).

+8

OpenCv . /c/adaptiveskindetector_sample.cpp

+3

lower = np.array([0, 10, 60], dtype = "uint8") upper = np.array([20, 150, 255], dtype = "uint8") .

+3

:

def preprocess(action_frame):

    blur = cv2.GaussianBlur(action_frame, (3,3), 0)
    hsv = cv2.cvtColor(blur, cv2.COLOR_RGB2HSV)

    lower_color = np.array([108, 23, 82])
    upper_color = np.array([179, 255, 255])

    mask = cv2.inRange(hsv, lower_color, upper_color)
    blur = cv2.medianBlur(mask, 5)

    kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (8, 8))
    hsv_d = cv2.dilate(blur, kernel)

return hsv_d

. .

+2

, , , , , ,

+1

Deepgaze is a skin detection library in addition to other features.

Deepgaze github

He uses:

[0, 58, 50] lower bound skin HSV
[30, 255, 255] upper bound skin HSV

He's pretty responsive on Github, so you could contact him and ask how he came up with these numbers.

+1
source

All Articles