GECKO 1.0
Human-computer interface based on hand gesture recognition
Public Member Functions | Private Member Functions | Private Attributes
HandDescriptor Class Reference

Finds the main characteristics of the hand from a binary image containing a hand silouette. More...

#include <HandDescriptor.h>

Collaboration diagram for HandDescriptor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HandDescriptor ()
 Default constructor.
void operator() (const cv::Mat &skinMask)
 Update the internal characteristics stored.
void update (const cv::Mat &skinMask)
 Update the internal characteristics stored.
bool handFound ()
 Returns true if a hand was found.
double getHandAngle ()
 Returns the angle of the box enclosing the hand.
double getHandAnglePredicted ()
 Returns the angle of the box enclosing the hand predicted by the Kalman filter.
double getHandAngleEstimated ()
 Returns the angle of the box enclosing the hand estimated by the Kalman filter after updating the prediction with the actual value.
cv::Point getCenterHand ()
 Returns the position of the center of the hand.
cv::Point getCenterHandPredicted ()
 Returns the position of the center of the hand predicted by the Kalman filter.
cv::Point getCenterHandEstimated ()
 Returns the position of the center of the hand estimated by the Kalman filter after updating the prediction with the actual value.
std::vector< std::vector
< cv::Point > > 
getContours ()
 Returns the contours of the detected hand.
cv::Rect getBoundingBox ()
 Returns the bounding box enclosing the detected hand.
int getGesture ()
 Returns the detected gesture.
int getNumFingers ()
 Returns the number of fingers found.
void plotBoundingRectangle (const cv::Mat &src, cv::Mat &dst, bool rotated=true)
 Plots the rectangle around the hand on display.
void plotContours (const cv::Mat &src, cv::Mat &dst)
 Plot the contours on display.
void plotCenter (const cv::Mat &src, cv::Mat &dst, bool show_corrected=true, bool show_actual=true, bool show_predicted=true)
 Plot the center of the hand on display.
void angleControl (bool show_corrected=true, bool show_actual=true, bool show_predicted=true)
 Prints the angle gauge on a separate window.
void plotMaxInscribedCircle (cv::Mat &src, cv::Mat &dst, bool show_center=true, cv::Scalar color=cv::Scalar(0, 255, 0), int thickness=1)
 Prints the maximum inscribed circle:
void plotMinEnclosingCircle (cv::Mat &src, cv::Mat &dst, bool show_center=true, cv::Scalar color=cv::Scalar(255, 0, 255), int thickness=1)
 Prints the minimum enclosing circle:
void plotComplexHull (cv::Mat &src, cv::Mat &dst, bool show_points=false, cv::Scalar color=cv::Scalar(0, 255, 255), int thickness=1)
 Plot the hand complex hull:
void plotConvexityDefects (cv::Mat &src, cv::Mat &dst, bool draw_points=true)
 Plot convexity defects:
void plotFingertips (cv::Mat &src, cv::Mat &dst, bool draw_lines=true, cv::Scalar color=cv::Scalar(255, 0, 0), int thickness=2)
 Plot fingertip markers:
void plotHandInterface (cv::Mat &src, cv::Mat &dst)
 Plot hand interface:

Private Member Functions

void contourExtraction (const cv::Mat &skinMask)
 Extract the hand contours from a binary image containing hand candidates.
void boundingBoxExtraction ()
 Extracts the bounding boxes around the hand contour ( rectangle and rotated rectange)
void handPalmExtraction ()
 Finds the maximum inscribed circle of the hand contour, which describes the hand palm.
void ROIExtraction (const cv::Mat &src)
 Extracts a mask of the region of interest in which the hand is contained.
void defectsExtraction ()
 Finds the convexity defects of the hand convex hull, that are used to find the fingers.
void fingerExtraction ()
 Extracts the number, position and orientation of the fingers.
void angleExtraction ()
 Extracts the hand angle from its bounding box and a Kalman Filter.
void centerExtraction ()
 Extracts the hand center and applies a Kalman Filter for improved stability.
void gestureExtraction ()
 Guesses the hand gesture using the hand characteristic data previouly found.

Private Attributes

bool _hand_found
 Whether a hand was found or not:
double _hand_angle
 Contains the actual angle of the box enclosing the hand.
double _hand_angle_prediction
 Contains the predicted angle by the kalman filter.
double _hand_angle_estimation
 Contains the corrected estimation by the kalman filter.
cv::Point _hand_center
 Actual center of the hand.
cv::Point _hand_center_prediction
 Predicted center of the hand by the kalman filter.
cv::Point _hand_center_estimation
 Corrected estimation by the kalman filter.
std::vector< std::vector
< cv::Point > > 
_hand_contour
 Contours of the candidates to be a hand.
cv::RotatedRect _hand_rotated_bounding_box
 Minimum RotatedRect enclosing the hand.
cv::Rect _hand_bounding_box
 Minimum Rect enclosing the hand.
int _hand_gesture
 Last detected gesture, coded as an integer (see constants for correspondence between integer and gesture)
int _hand_num_fingers
 Number of fingers (visible)
std::vector< cv::Point > _hand_fingertips
 Position of the fingertips.
std::vector< cv::Point > _hand_finger_line_origin
 Position of the finger line origin points.
double _max_circle_inscribed_radius
 Radius of the max. inscribed circle.
cv::Point _max_circle_incribed_center
 Center of the max. incribed circle.
float _min_enclosing_circle_radius
 Radius of the min. enclosing circle.
cv::Point2f _min_enclosing_circle_center
 Center of the min. enclosing circle.
std::vector< cv::Point > _hand_hull
 Complex hull of the hand.
std::vector< ConvexityDefect_hand_convexity_defects
 Convexity defects of the hand.
cv::Mat _hand_ROI
 Mask containing ROI of the hand.
cv::KalmanFilter kalmanFilterAngle
 Kalman filter for the angle of the box enclosing the hand.
cv::KalmanFilter kalmanFilterCenter
 Kalman filter for the center of the hand.

Detailed Description

Finds the main characteristics of the hand from a binary image containing a hand silouette.

To look for or to update the stored characteristics of the hand and its gesture, the update member or the operator () can be called. One can then know if a hand was found using handFound member, prior to retrieving any of the hand characteristics / gesture.


The documentation for this class was generated from the following files:
 All Classes Functions Variables