|
GECKO 1.0
Human-computer interface based on hand gesture recognition
|
Update the segmented hand image using the new frame of the video input. Removes the background, thresholds the skin color and makes morphology transformations to improve the binary output image
{
static int it=0;
//-- Filter out head:
//------------------------------------------------
//-- Get mask
cv::Mat headTrackingMask;
filterFace( src, headTrackingMask );
// cv::imshow("[Debug] Face", src);
//-- Background substraction:
//------------------------------------------------
cv::Mat withoutBackground;
backgroundSubstraction( src, withoutBackground );
//-- Skin thresholding
//------------------------------------------------
cv::Mat thresholdedHand;
threshold( withoutBackground, thresholdedHand );
//-- Filter out small blobs:
//------------------------------------------------
cv::Mat withoutBlobs;
filterBlobs( thresholdedHand, withoutBlobs );
cv::Mat dummy;
cv::bitwise_and( withoutBlobs, headTrackingMask, dummy );
// static cv::Mat sum=cv::Mat::zeros(dummy.rows, dummy.cols,dummy.type());
// static cv::Mat last_sum=cv::Mat::zeros(dummy.rows, dummy.cols,dummy.type());
//-- Average the thresholded images of different frames to reduce random noise
// if (it <3)
// {
// sum+=dummy;
// it++;
// }
// else
// {
// it=0;
// sum.copyTo(last_sum);
// dummy.copyTo(sum);
// }
// last_sum.copyTo(dst);
dummy.copyTo(dst);
// std::cerr<<"Iterator number: "<<it<<std::endl;
}
Here is the call graph for this function:
![]() |
1.7.4