Hand segmentation - hand gesture recognition
Hi guys :) I am working on real-time hand gesture recognition system. The hirst step on the way to hand gesture recognition is the hand segmentation. I've tried already various methods. Inter alia I used already BackgroundSubtractorMOG2 - it doesn't work well, then I tried HSV tresholding and it works also quite bad, so I've written my own background subtraction method. It looks like that:
Mat HandDetect::diffBackground(Mat & frame)
{
cout << "diffBackground" << endl;
Mat tempBg;
Mat tempFrame;
Mat mask;
Mat frame1;
Mat tempMask;
transform2Gray(frame, frame1);
cout << "diffBackground01" << endl;
BG = frame1 * ALPHA + BG * (1 - ALPHA);
cout << "convertTo" << endl;
frame1.convertTo(tempFrame, CV_8U);
cout << "convertTo1" << endl;
BG.convertTo(tempBg, CV_8U);
absdiff(tempFrame, tempBg, mask);
mask.convertTo(tempMask, CV_8U);
threshold(tempMask, mask, 25, 255, THRESH_BINARY);
................
}
It looks like that and works quite fine. First of all, I take a photo on the background, creating so called background model, then I subtract the frame from the background model and I threshold the result. Everything works fine, under one condition, namely if there is a lot light then some noises are created.
As you can see, aroung the mask of the hand there are some noises caused by the light. Are you able to recommend me some method allowing to remove the noise.
Thanks in advance for help.