I have trained an object detection model to detect fingertips of hand. I have extracted the fingertips from the bounding box coordinates. Here is what I got:
Now I want to get the binary mask from these images, which include only the region of fingertip. I have tried these approaches and did not get satisfactory results.
I want to extract the fingertip region from these bounding boxes, I am currently lost, will appreciate any leads in the right direction.
EDIT Images with red background:
You can opt for the LAB color space.
One extreme of the A-channel identifies red color. Hence applying Otsu threshold on this extreme can isolate it pretty well.
Code:
img = cv2.imread('finger_1.png')
# convert to LAB color space
lab = cv2.cvtColor(img, cv2.COLOR_BGR2LAB)
# apply Otsu threshold on A-channel
th = cv2.threshold(lab[:,:,1], 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
Results:
As a further option, you can try normalizing the same A-channel and proceed further.
Also have a look at this post on how to segment green color.