|
GECKO 1.0
Human-computer interface based on hand gesture recognition
|
Default constructor. {
//-- Initalize hand parameters
//-----------------------------------------------------------------------
_hand_angle=0;
_hand_center = cv::Point(0,0);
_hand_gesture = GECKO_GESTURE_NONE;
_hand_num_fingers = -1;
_hand_found = false;
//-- Kalman filter setup for estimating hand angle:
//-----------------------------------------------------------------------
//-- Create filter:
kalmanFilterAngle.init( 2, 1, 0);
kalmanFilterAngle.transitionMatrix = *( cv::Mat_<float>(2, 2) << 1, 1,
0, 1);
//-- Initial state:
kalmanFilterAngle.statePre.at<float>(0) = 90; //-- initial angle
kalmanFilterAngle.statePre.at<float>(1) = 0; //-- initial angular velocity
//-- Set the rest of the matrices:
cv::setIdentity( kalmanFilterAngle.measurementMatrix );
cv::setIdentity( kalmanFilterAngle.processNoiseCov, cv::Scalar::all(0.0001));
cv::setIdentity( kalmanFilterAngle.measurementNoiseCov, cv::Scalar::all(0.1));
cv::setIdentity( kalmanFilterAngle.errorCovPost, cv::Scalar::all(0.1));
//-- Kalman filter for estimating hand center
//---------------------------------------------------------------------
//-- Create filter:
kalmanFilterCenter.init( 4, 2, 0);
kalmanFilterCenter.transitionMatrix = *( cv::Mat_<float>(4, 4) << 1, 0, 1, 0,
0, 1, 0, 1,
0, 0, 1, 0,
0, 0, 0, 1);
//-- Get mouse position:
std::pair <int, int> initial_mouse = getMousePos( );
//-- Initial state:
kalmanFilterCenter.statePre.at<float>(0) = initial_mouse.first; //-- x Position
kalmanFilterCenter.statePre.at<float>(1) = initial_mouse.second; //-- y Position
kalmanFilterCenter.statePre.at<float>(2) = 0; //-- x Velocity
kalmanFilterCenter.statePre.at<float>(3) = 0; //-- y Velocity
//-- Set the rest of the matrices:
cv::setIdentity( kalmanFilterCenter.measurementMatrix );
cv::setIdentity( kalmanFilterCenter.processNoiseCov, cv::Scalar::all(0.0001));
cv::setIdentity( kalmanFilterCenter.measurementNoiseCov, cv::Scalar::all(0.1));
cv::setIdentity( kalmanFilterCenter.errorCovPost, cv::Scalar::all(0.1));
}
|
1.7.4