-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHandDetector.h
More file actions
59 lines (52 loc) · 1.22 KB
/
HandDetector.h
File metadata and controls
59 lines (52 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __HAND_DETECTOR_H__
#define __HAND_DETECTOR_H__
#include <iostream>
#include <vector>
#include <math.h>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
/*
#include <core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
*/
class Hand
{
public:
Hand(){};
~Hand(){};
std::vector<cv::Point> fingers;
cv::Point center;
std::vector<cv::Point> contour;
};
class HandDetector
{
public:
struct Params
{
int area;
int r;
int step;
double cosThreshold;
double equalThreshold;
};
public:
HandDetector(){};
~HandDetector(){};
void detect(cv::Mat& mask, std::vector<Hand>& hands);
void setParams(Params& p);
cv::Point getMaxDist(std::vector<Hand>& hands);
private:
Params param;
signed int rotation(std::vector<cv::Point>& contour, int pt, int r);
double angle(std::vector<cv::Point>& contour, int pt, int r);
bool isEqual(double a, double b);
};
double dist(cv::Point p1, cv::Point p2);
void drawHands(cv::Mat& image, std::vector<Hand>& hands);
#endif