Exact Skin color HSV range

后端 未结 8 665
独厮守ぢ
独厮守ぢ 2021-02-02 03:34

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         


        
8条回答
  •  清酒与你
    2021-02-02 03:50

    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.

提交回复
热议问题