GECKO 1.0
Human-computer interface based on hand gesture recognition
void HandDetector::filter_hand ( cv::Mat &  src,
cv::Mat &  dst 
)

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

Parameters:
srcOriginal image coming from the video input.
dstFinal binary image containing the segmented 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:

 All Classes Functions Variables