Hand segmentation question contour extraction [closed]
Hi,
I have a problem with hand segmentation. Namely, I try to segment my hand from the background, then I want to build convex hull of my hand but I can not do it because not all points are fully connected this is presented in this image: .
What I am doing: I convert BGR2YUV, then I take V channel and perform background subtraction then I want to build convex hull. However, in order to build convex hull, the contour of the hand is necessary. Do you know some good way to connect those points together to extract the hand region for building the convex hull.
while(true)
{
Mat HSV1;
Mat th;
Mat YUV1;
Mat fin_image;
readFrame(frame);
cvtColor(frame, YUV1, CV_BGR2YUV);
Mat YUV[3];
split(YUV1,YUV);
imshow("Y",YUV[0]);
imshow("U",YUV[1]);
imshow("V",YUV[2]);
applyBackgroundMOGSubtraction(YUV[2]);
imshow("foreground",foreground);
findAndDrawContours(foreground);
medianBlur(foreground, foreground, 3);
doMorphologicalOperations(foreground);
equalizeHist( foreground, foreground );
imshow("foreground",foreground);
if(char(waitKey(30)) == 'q')
{
break;
}
}
Thanks in advance for help.
thanks a lot for the edit !
try to put all of this before finding contours: