문제

I'm Doing Project on hand Tracking using OpenCV library function. By using Camshift() function I could able to track my hands but it wasn't not stable, even I make my hand stable there is little movement in tracking. So I couldn't able to perform mouse click operation at correct position. Someone please help me to figure out this.

void TrackingObjects::drawRectangle(CvRect objectLocation){
CvPoint p1, p2,mou;
CvRect crop;
p1.x = objectLocation.x;
p2.x = objectLocation.x + objectLocation.width;

p1.y = objectLocation.y;
p2.y = objectLocation.y + objectLocation.height;

cvRectangle(image,p1,p2,CV_RGB(0,255,0),1,CV_AA,0);

mou.x=(p2.x-p1.x)/2;
mou.x=p1.x+mou.x;
mou.y=(p2.y-p1.y)/2;
mou.y=p1.y+mou.y;

SetCursorPos(mou.x,mou.y);

}

In above code I get the tracked object location by obectLocation parameter and I've drawn rectangle over the tracked region. By getting its center I did mouse movement.

While closing the palm in order to do MouseDown event, the position of tracked object has being changed.

도움이 되었습니까?

해결책

The answer is Kalman filters. You can use this code. As you can see in the figure below, the filtered results (green line) ignore tracker's sudden displacements (where cyan depicts the original tracking results).

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top