Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

Remove contour around a certain color

$
0
0
So i have a skin color range that I'm using to draw the contours of any skin color my camera sees, i.e, it'll draw contour on the hands or faces etc. However, the range of color that I am using to draw the contours has a red range of 0-255, so it basically draws contour around everything that is red. The red pixel is however important for a good skin detection so I can't change that. So i was wondering how I could tweek my contour code, so that it doesn't draw contour around the color red. My code is as follow: min_YCrCb = np.array([0,133,77],np.uint8) # Create a lower bound for the skin color max_YCrCb = np.array([255,173,127],np.uint8) # Create an upper bound for skin color skinRegion = cv2.inRange(converted,min_YCrCb,max_YCrCb) # Create a mask with boundaries contours, hierarchy = cv2.findContours(skinRegion, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # Find the contour on the skin detection for i, c in enumerate(contours): # Draw the contour on the source frame area = cv2.contourArea(c) if area > 10000: cv2.drawContours(img, contours, i, (255, 255, 0), 2)

Viewing all articles
Browse latest Browse all 2088

Trending Articles