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 = cv
Try this preprocessing function in your code:
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
I have been using this for months now. It might solve your problem forever.