forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
95 lines (77 loc) · 2.8 KB
/
main.cpp
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
93
94
95
#include "MouseExample.h"
#include "VideoExample.h"
#include <opencv2/opencv.hpp>
#include <opencv2/core/ocl.hpp>
// ----------------------------------------------------------------------
static void Help()
{
printf("\nExamples of the Multitarget tracking algorithm\n"
"Usage: \n"
" ./MultitargetTracker <path to movie file> [--example]=<number of example 0..5> [--start_frame]=<start a video from this position> [--end_frame]=<play a video to this position> [--end_delay]=<delay in milliseconds after video ending> [--out]=<name of result video file> [--show_logs]=<show logs> \n\n"
"Press:\n"
"\'m\' key for change mode: play|pause. When video is paused you can press any key for get next frame. \n\n"
"Press Esc to exit from video \n\n"
);
}
const char* keys =
{
"{ @1 |../data/atrium.avi | movie file | }"
"{ e example |1 | number of example 0 - MouseTracking, 1 - MotionDetector, 2 - FaceDetector, 3 - PedestrianDetector, 4 - MobileNet SSD detector, 5 - Yolo detector | }"
"{ sf start_frame |0 | Start a video from this position | }"
"{ ef end_frame |0 | Play a video to this position (if 0 then played to the end of file) | }"
"{ ed end_delay |0 | Delay in milliseconds after video ending | }"
"{ o out | | Name of result video file | }"
"{ sl show_logs |1 | Show Trackers logs | }"
"{ g gpu |0 | Use OpenCL acceleration | }"
};
// ----------------------------------------------------------------------
int main(int argc, char** argv)
{
Help();
cv::CommandLineParser parser(argc, argv, keys);
bool useOCL = parser.get<int>("gpu") ? 1 : 0;
cv::ocl::setUseOpenCL(useOCL);
std::cout << (cv::ocl::useOpenCL() ? "OpenCL is enabled" : "OpenCL not used") << std::endl;
int exampleNum = parser.get<int>("example");
switch (exampleNum)
{
case 0:
MouseTracking(parser);
break;
case 1:
{
MotionDetectorExample mdetector(parser);
mdetector.Process();
break;
}
case 2:
{
FaceDetectorExample face_detector(parser);
face_detector.Process();
break;
}
case 3:
{
PedestrianDetectorExample ped_detector(parser);
ped_detector.Process();
break;
}
case 4:
{
SSDMobileNetExample dnn_detector(parser);
dnn_detector.Process();
break;
}
case 5:
{
YoloExample yolo_detector(parser);
yolo_detector.Process();
break;
}
default:
std::cerr << "Wrong example number!" << std::endl;
break;
}
cv::destroyAllWindows();
return 0;
}