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
83 lines (71 loc) · 2.44 KB
/
BaseDetector.cpp
File metadata and controls
83 lines (71 loc) · 2.44 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
#include "BaseDetector.h"
#include "MotionDetector.h"
#include "FaceDetector.h"
#include "PedestrianDetector.h"
#include "DNNDetector.h"
///
/// \brief CreateDetector
/// \param detectorType
/// \param collectPoints
/// \param gray
/// \return
///
BaseDetector* CreateDetector(
tracking::Detectors detectorType,
bool collectPoints,
cv::UMat& gray
)
{
switch (detectorType)
{
case tracking::Motion_VIBE:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_VIBE, collectPoints, gray);
case tracking::Motion_MOG:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_MOG, collectPoints, gray);
case tracking::Motion_GMG:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_GMG, collectPoints, gray);
case tracking::Motion_CNT:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_CNT, collectPoints, gray);
case tracking::Motion_SuBSENSE:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_SuBSENSE, collectPoints, gray);
case tracking::Motion_LOBSTER:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_LOBSTER, collectPoints, gray);
case tracking::Motion_MOG2:
return new MotionDetector(BackgroundSubtract::BGFG_ALGS::ALG_MOG2, collectPoints, gray);
case tracking::Face_HAAR:
{
FaceDetector* detector = new FaceDetector(collectPoints, gray);
if (!detector->Init("../data/haarcascade_frontalface_alt2.xml"))
{
delete detector;
detector = nullptr;
}
return detector;
}
case tracking::Pedestrian_HOG:
case tracking::Pedestrian_C4:
{
PedestrianDetector* detector = new PedestrianDetector(collectPoints, gray);
if (!detector->Init((detectorType == tracking::Pedestrian_HOG) ? PedestrianDetector::HOG : PedestrianDetector::C4,
"../data/combined.txt.model", "../data/combined.txt.model_"))
{
delete detector;
detector = nullptr;
}
return detector;
}
case tracking::DNN:
{
DNNDetector* detector = new DNNDetector(collectPoints, gray);
if (!detector->Init("../data/MobileNetSSD_deploy.prototxt", "../data/MobileNetSSD_deploy.caffemodel"))
{
delete detector;
detector = nullptr;
}
return detector;
}
default:
return nullptr;
}
return nullptr;
}