[ADD] comments to fingercount
This commit is contained in:
@@ -15,9 +15,17 @@ namespace computervision
|
|||||||
class FingerCount {
|
class FingerCount {
|
||||||
public:
|
public:
|
||||||
FingerCount(void);
|
FingerCount(void);
|
||||||
|
/**
|
||||||
|
* @brief gets the amount of fingers that are held up.
|
||||||
|
*
|
||||||
|
* @param input_image the source image to find the fingers on. It should be a mask of a hand
|
||||||
|
* @param frame the frame to draw the resulting values on (how many fingers are held up etc)
|
||||||
|
* @return a new image with all the data drawn on it.
|
||||||
|
*/
|
||||||
Mat findFingersCount(Mat input_image, Mat frame);
|
Mat findFingersCount(Mat input_image, Mat frame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// colors to use
|
||||||
Scalar color_blue;
|
Scalar color_blue;
|
||||||
Scalar color_green;
|
Scalar color_green;
|
||||||
Scalar color_red;
|
Scalar color_red;
|
||||||
@@ -25,12 +33,78 @@ namespace computervision
|
|||||||
Scalar color_white;
|
Scalar color_white;
|
||||||
Scalar color_yellow;
|
Scalar color_yellow;
|
||||||
Scalar color_purple;
|
Scalar color_purple;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief finds the distance between 2 points.
|
||||||
|
*
|
||||||
|
* @param a the first point
|
||||||
|
* @param b the second point
|
||||||
|
* @return a double representing the distance
|
||||||
|
*/
|
||||||
double findPointsDistance(Point a, Point b);
|
double findPointsDistance(Point a, Point b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief compacts the given points on their medians.
|
||||||
|
* what it does is for each point, it checks if the distance to it's neighbour is greater than the
|
||||||
|
* max distance. If so, it just adds it to the list that is returned. If not, it calculates the
|
||||||
|
* median and adds it to the returned list
|
||||||
|
*
|
||||||
|
* @param points the points to compact
|
||||||
|
* @param max_neighbor_distance the maximum distance between points
|
||||||
|
* @return a vector with the points now compacted.
|
||||||
|
*/
|
||||||
vector<Point> compactOnNeighborhoodMedian(vector<Point> points, double max_neighbor_distance);
|
vector<Point> compactOnNeighborhoodMedian(vector<Point> points, double max_neighbor_distance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief finds the angle between 3 different points.
|
||||||
|
*
|
||||||
|
* @param a the first point
|
||||||
|
* @param b the second point
|
||||||
|
* @param c the third point
|
||||||
|
* @return the angle between the 3 points
|
||||||
|
*/
|
||||||
double findAngle(Point a, Point b, Point c);
|
double findAngle(Point a, Point b, Point c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief checks if the given points make up a finger.
|
||||||
|
*
|
||||||
|
* @param a the first point to check for
|
||||||
|
* @param b the second point to check for
|
||||||
|
* @param c the third point to check for
|
||||||
|
* @param limit_angle_inf the limit of the angle between 2 fingers
|
||||||
|
* @param limit_angle_sup the limit of the angle between a finger and a convex point
|
||||||
|
* @param palm_center the center of the palm
|
||||||
|
* @param distance_from_palm_tollerance the distance from the palm tolerance
|
||||||
|
* @return true if the points are a finger, false if not.
|
||||||
|
*/
|
||||||
bool isFinger(Point a, Point b, Point c, double limit_angle_inf, double limit_angle_sup, cv::Point palm_center, double distance_from_palm_tollerance);
|
bool isFinger(Point a, Point b, Point c, double limit_angle_inf, double limit_angle_sup, cv::Point palm_center, double distance_from_palm_tollerance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief finds the closest point to the given point that is in the given list.
|
||||||
|
*
|
||||||
|
* @param points the points to check for
|
||||||
|
* @param pivot the pivot to check against
|
||||||
|
* @return a vector containing the point that is closest
|
||||||
|
*/
|
||||||
vector<Point> findClosestOnX(vector<Point> points, Point pivot);
|
vector<Point> findClosestOnX(vector<Point> points, Point pivot);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief finds the distance between the x coords of the points.
|
||||||
|
*
|
||||||
|
* @param a the first point
|
||||||
|
* @param b the second point
|
||||||
|
* @return the distance between the x values
|
||||||
|
*/
|
||||||
double findPointsDistanceOnX(Point a, Point b);
|
double findPointsDistanceOnX(Point a, Point b);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief draws the points on the image.
|
||||||
|
*
|
||||||
|
* @param image the image to draw on
|
||||||
|
* @param points the points to draw
|
||||||
|
* @param color the color to draw them with
|
||||||
|
* @param with_numbers if the numbers should be drawn with the points
|
||||||
|
*/
|
||||||
void drawVectorPoints(Mat image, vector<Point> points, Scalar color, bool with_numbers);
|
void drawVectorPoints(Mat image, vector<Point> points, Scalar color, bool with_numbers);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,8 @@ namespace computervision
|
|||||||
Mat getSkinMask(Mat input);
|
Mat getSkinMask(Mat input);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// thresholds for hsv calculation
|
||||||
int hLowThreshold = 0;
|
int hLowThreshold = 0;
|
||||||
int hHighThreshold = 0;
|
int hHighThreshold = 0;
|
||||||
int sLowThreshold = 0;
|
int sLowThreshold = 0;
|
||||||
@@ -47,6 +49,7 @@ namespace computervision
|
|||||||
int vLowThreshold = 0;
|
int vLowThreshold = 0;
|
||||||
int vHighThreshold = 0;
|
int vHighThreshold = 0;
|
||||||
|
|
||||||
|
// wether or not the skindetector has calibrated yet.
|
||||||
bool calibrated = false;
|
bool calibrated = false;
|
||||||
|
|
||||||
// rectangles that get drawn to show where the skin color will be sampled
|
// rectangles that get drawn to show where the skin color will be sampled
|
||||||
|
|||||||
Reference in New Issue
Block a user