-
Notifications
You must be signed in to change notification settings - Fork 5
/
detection.h
53 lines (45 loc) · 1.18 KB
/
detection.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
#pragma once
#include "opencv2/opencv.hpp"
#include "config.h"
//template <typename T>
class Detection //should use boost::noncopyable //interface
{
public:
virtual ~Detection() {};
virtual bool init() = 0;
virtual void get_detection(cv::Mat& frame, std::vector<DetectionBox>& vec_db, std::vector<cv::Mat>& vec_features) = 0;
};
class FileDetector :public Detection
{
public:
FileDetector() = delete;
explicit FileDetector(FileDetectorConfig& config);
virtual ~FileDetector();
FileDetector(const FileDetector&) = delete;
FileDetector& operator=(const FileDetector&) = delete;
bool init();
void get_detection(cv::Mat& frame, std::vector<DetectionBox>& vec_db, std::vector<cv::Mat>& vec_features);
private:
bool read_from_list();
private:
FileDetectorConfig& params_;
int frame_idx_;
std::vector<std::string> vec_det_filename_;
std::vector<std::vector<DetectionBox>> vec_vec_det_;
};
// -m
//template <typename T>
class DetectorFactory
{
public:
// FaceDetectionFactory();
// virtual ~FaceDetectionFactory();
static Detection* create_object(DetectorConfig& config)
{
switch (config.method)
{
case DetectorMethod::FromFile:
return new FileDetector(config.fd);
}
}
};