GECKO 1.0
Human-computer interface based on hand gesture recognition
|
Segments the hand silouette from the original image and returns the information in a binary image. More...
#include <HandDetector.h>
Public Member Functions | |
HandDetector () | |
Default constructor. | |
HandDetector (cv::Mat &ROI) | |
Constructor that takes as argument an image of the hand's skin to obtain the custom HSV range. | |
~HandDetector () | |
void | calibrationLoop (cv::VideoCapture) |
Allows the user to adjust the HSV range manually to improve the segmentation. | |
void | defaultValues (cv::VideoCapture cap) |
Shows an image with information and starts calibrationLoop function. | |
void | customValues (cv::VideoCapture cap) |
Obtains the custom HSV skin range. | |
void | calibrate (cv::Mat &ROI) |
Changes the HSV range accordingly with the input skin color image. | |
void | calibrate (cv::Scalar lower_limit=cv::Scalar(0, 58, 89), cv::Scalar upper_limit=cv::Scalar(25, 173, 229)) |
Sets the HSV skin colors range with the inputs. If there are no inputs, default values are set. | |
void | getCalibration (cv::Scalar &lower_limit, cv::Scalar &upper_limit) |
Returns the HSV range. | |
void | operator() (cv::Mat &src, cv::Mat &dst) |
Update the segmented hand binary image. | |
void | filter_hand (cv::Mat &src, cv::Mat &dst) |
Update the segmented hand image using the new frame of the video input. | |
std::vector< cv::Rect > & | getLastFacesPos () |
Returns the last position of the face. | |
void | drawFaceMarks (const cv::Mat &src, cv::Mat &dst, cv::Scalar color=cv::Scalar(0, 255, 0), int thickness=1) |
Tracks and covers the faces that appear in the image. | |
cv::Scalar | getLower () |
Returns the lower HSV skin values. | |
cv::Scalar | getUpper () |
Returns the upper HSV skin values. | |
Private Member Functions | |
int | average (cv::Mat &ROI) |
Returns the average of the pixel's values. | |
int | median (cv::Mat &ROI) |
Returns the median of the pixel's values. | |
int | stdDeviation (cv::Mat &ROI) |
Returns the standard deviation of the pixel's values. | |
void | threshold (const cv::Mat &src, cv::Mat &dst) |
Thresholds the input image using the HSV range. | |
void | filterBlobs (const cv::Mat &src, cv::Mat &dst) |
Applies Gaussian Blur and thresholding to improve the final binary image. | |
void | filterContours (std::vector< std::vector< cv::Point > > &contours, std::vector< std::vector< cv::Point > > &filteredContours) |
void | initBackgroundSubstractor () |
Sets the parameters of the background subtractor object. | |
void | backgroundSubstraction (cv::Mat &src, cv::Mat &dst) |
Substracts the background from the input image. | |
void | initCascadeClassifier () |
Initializes the face detector. | |
void | filterFace (const cv::Mat &src, cv::Mat &dstMask) |
Removes the face from the src image. | |
Private Attributes | |
backgroundSubstractor | bg |
Background Subtractor object that derives from cv::BackgroundSubtractorMOG2. | |
cv::CascadeClassifier | faceDetector |
Cascade classifier to detect faces: | |
std::vector< cv::Rect > | lastFacesPos |
Position of the last faces found: | |
double | factorX |
Resize the rectangles. | |
double | factorY |
cv::Scalar | lower_limit |
Lower limit of the HSV skin range. | |
cv::Scalar | upper_limit |
Upper limit of the HSV skin range. | |
bool | hue_invert |
Boolean that will be true if color limit is arround 0. | |
int | hue_sigma_mult |
Hue sigma multiplier used when calculating the custom HSV skin range. | |
int | sat_sigma_mult |
Saturation sigma multiplier used when calculating the custom HSV skin range. | |
int | val_sigma_mult |
Value sigma multiplier used when calculating the custom HSV skin range. | |
cv::Scalar | lower |
Lower limit of the HSV skin range. | |
cv::Scalar | upper |
Upper limit of the HSV skin range. | |
Static Private Attributes | |
static const int | halfSide = 40 |
Size of the calibration box used when capturing the custom HSV range. |
Segments the hand silouette from the original image and returns the information in a binary image.
This class offers different means of calibrating the skin: -Theoretical HSV values -Custom HSV values calculated from a sample of the user's skin color
In order to obtain the segmented hand, the operator () or the function filter_hand may be used