Ask Your Question

Hand segmentation - hand gesture recognition

asked 2017-09-18 10:49:10 -0500

Mateusz gravatar image

updated 2017-09-18 10:49:59 -0500

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.

Mask of the hand

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-09-21 23:51:47 -0500

pnw109 gravatar image

Instead of simple thresholding, try an adaptive threshold. You also may want to do an edge detection ( with or without background subtraction ).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-09-18 10:47:41 -0500

Seen: 467 times

Last updated: Sep 21 '17