-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraffic.h
executable file
·78 lines (54 loc) · 1.55 KB
/
traffic.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef TRAFFIC_H
#define TRAFFIC_H
#include <iostream>
#include <math.h>
using namespace std;
#include <opencv2/highgui.hpp>
#include <opencv2/cudaimgproc.hpp>
#include <opencv2/cudaobjdetect.hpp>
using namespace cv;
class Traffic
{
private:
vector<Ptr<cuda::CascadeClassifier>> classifiers;
// Distance calculate
double w1;
double d1;
// Image process
Mat splitter(Mat img);
Rect cropbox(Mat img);
// Scoring approximate
int maxFrame;
int crrFrame;
int *score;
// Limit frame detection
int fpslimit;
public:
Traffic();
vector<String> signName;
int getID(Mat frame);
int taquy(Mat frame);
void reset();
vector<Rect> detectGpu(cuda::GpuMat grayMat, int signId);
Mat draw(Mat frame, vector<Rect> boxes, String label);
double calcDistance (double w2);
vector<vector<double>> calcDistanceMult(vector<vector<Rect>> boxtrunk, Mat frame);
double calcAngle(Mat frame, Rect box, Point s);
void drawRuler(Mat frame);
void drawAngle(Mat frame, Rect box, Point s);
static const int RIGHT = 0;
static const int LEFT = 1;
static const int STOP = 2;
static double boundbox[4];
static int difficulty[3];
bool isDetect;
bool isDebug;
int signId;
string signs[5] = {
"Right", // 0
"Left", // 1
"Stop", // 2
"No sign detected" // 3
};
};
#endif // TRAFFIC_H