|
GECKO 1.0
Human-computer interface based on hand gesture recognition
|
Allows the user to adjust the HSV range manually to improve the segmentation. {
int delay=24;
int h[2]={lower_limit[0],upper_limit[0]};
int s[2]={lower_limit[1],upper_limit[1]};
int v[2]={lower_limit[2],upper_limit[2]};
while (1)
{
//-- Get current frame
cv::Mat frame=cv::imread("../img/calibration_loop.png");
cv::imshow("PRESS ENTER", frame);
//-- Wait for user confirmation
char key = cv::waitKey(delay);
if ( key == 10 || key == 13 )
{
cv::destroyWindow("PRESS ENTER");
break;
}
else if (key==27 || key=='q')
exit(0);
}
//-- Create the calibration window with the trackbars
cv::namedWindow("Calibrating skin");
cv::createTrackbar("H min", "Calibrating skin", &h[0], 255);
cv::createTrackbar("H max", "Calibrating skin", &h[1], 255);
cv::createTrackbar("S min", "Calibrating skin", &s[0], 255);
cv::createTrackbar("S max", "Calibrating skin", &s[1], 255);
cv::createTrackbar("V min", "Calibrating skin", &v[0], 255);
cv::createTrackbar("V max", "Calibrating skin", &v[1], 255);
while (1)
{
//-- Get current frame
cv::Mat frame, dst;
if (! cap.read( frame ) )
break;
cv::flip(frame,frame,1);
//change the skin thresholding limits using the trackbars
lower_limit=cv::Scalar(cv::getTrackbarPos("H min", "Calibrating skin"), cv::getTrackbarPos("S min", "Calibrating skin"), cv::getTrackbarPos("V min", "Calibrating skin"));
upper_limit=cv::Scalar(cv::getTrackbarPos("H max", "Calibrating skin"), cv::getTrackbarPos("S max", "Calibrating skin"), cv::getTrackbarPos("V max", "Calibrating skin"));
HandDetector::filter_hand(frame, dst);
cv::imshow("Calibrating skin", dst);
//-- Wait for user confirmation
char key = cv::waitKey(delay);
if ( key == 10 || key == 13 )
{
cv::destroyWindow("Calibrating skin");
break;
}
else if (key==27 || key=='q')
exit(0);
}
}
Here is the call graph for this function:
![]() |
1.7.4