-
Notifications
You must be signed in to change notification settings - Fork 0
/
PotholeDetection.h
75 lines (58 loc) · 1.45 KB
/
PotholeDetection.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
#pragma once
#include <opencv2/opencv.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
using namespace cv;
using namespace std;
class PotholeDetection {
private:
// YOLO cfg, weight, name file
string cfg_path;
string weight_path;
string name_path;
// Input size, output frame size, confidences
Size input_size;
Size frame_size;
float min_confidence;
float nms_confidence;
// dnn model
dnn::Net net;
vector<Mat> predictions;
// time check
clock_t start, end;
// YOLO data
vector<string> class_names;
vector<string> output_layers;
public:
vector<Rect> outs;
// constructor
PotholeDetection();
PotholeDetection(const string cfg, const string weight, const string name);
// setting, getting method
void setCfgFile(const string cfg);
void setWeightFile(const string weight);
void setNameFile(const string name);
string getCfgFile();
string getWeightFile();
string getNameFile();
void setSize(const Size target_size);
Size getSize();
void setMinConfidence(const float m_conf);
float getMinConfidence();
void setNmsConfidence(const float n_conf);
float getNmsConfidence();
void setYOLONames();
vector<string> getYOLONames();
void setOutPutLayers();
vector<string> getOutputLayers();
void setInputSize(const Size s);
Size getInputSize();
// setting dnn
void initDnn();
// predict
void predict(Mat& frame, bool isGray = false, bool isFlip = false);
//PostProcess
void PostProcess(Mat& frame);
};