forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseDetector.cpp
More file actions
92 lines (77 loc) · 2.43 KB
/
BaseDetector.cpp
File metadata and controls
92 lines (77 loc) · 2.43 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "BaseDetector.h"
#include "MotionDetector.h"
#include "FaceDetector.h"
#include "PedestrianDetector.h"
#include "SSDMobileNetDetector.h"
#include "YoloDetector.h"
#ifdef BUILD_YOLO_LIB
#include "YoloDarknetDetector.h"
#endif
///
/// \brief CreateDetector
/// \param detectorType
/// \param collectPoints
/// \param gray
/// \return
///
BaseDetector* CreateDetector(
tracking::Detectors detectorType,
const config_t& config,
bool collectPoints,
cv::UMat& gray
)
{
BaseDetector* detector = nullptr;
switch (detectorType)
{
case tracking::Motion_VIBE:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_VIBE, collectPoints, gray);
break;
case tracking::Motion_MOG:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_MOG, collectPoints, gray);
break;
case tracking::Motion_GMG:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_GMG, collectPoints, gray);
break;
case tracking::Motion_CNT:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_CNT, collectPoints, gray);
break;
case tracking::Motion_SuBSENSE:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_SuBSENSE, collectPoints, gray);
break;
case tracking::Motion_LOBSTER:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_LOBSTER, collectPoints, gray);
break;
case tracking::Motion_MOG2:
detector = new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_MOG2, collectPoints, gray);
break;
case tracking::Face_HAAR:
detector = new FaceDetector(collectPoints, gray);
break;
case tracking::Pedestrian_HOG:
case tracking::Pedestrian_C4:
detector = new PedestrianDetector(collectPoints, gray);
break;
case tracking::SSD_MobileNet:
detector = new SSDMobileNetDetector(collectPoints, gray);
break;
case tracking::Yolo_OCV:
detector = new YoloOCVDetector(collectPoints, gray);
break;
case tracking::Yolo_Darknet:
#ifdef BUILD_YOLO_LIB
detector = new YoloDarknetDetector(collectPoints, gray);
#else
std::cerr << "Darknet inference engine was not configured in CMake" << std::endl;
#endif
break;
default:
break;
}
if (!detector->Init(config))
{
delete detector;
detector = nullptr;
}
return detector;
}