-
Notifications
You must be signed in to change notification settings - Fork 7
/
VideoHandler.h
102 lines (87 loc) · 2.28 KB
/
VideoHandler.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "RinkBackgroundSubtractor.h"
#include "Developing/OcclusionHandler.h"
#include "Developing/Tracker.h"
#include "Utils/RegionChooser.h"
#include <vector>
/**
* This class composes all kind of work on video stream.
*/
class VideoHandler {
private:
/**
* OpenCV class to capture video.
*/
cv::VideoCapture videoCapture;
/**
* Class that delegates to IndependentMultimodalBGS method from bgslibrary.
*/
RinkBackgroundSubtractor rinkBackgroundSubtractor;
/**
* Class for tracking management
*/
Tracker tracker;
/**
* Region of interess. It will be loaded from file at first start
* if file exists or user will be able to create new one by RegionChooser automatical usage.
*/
cv::Mat region;
/**
* Mode of output video.
* 0 - original, 1 - background subtraction, 2 - contoured image.
*/
int mode;
/**
* Write output information
*/
bool writeOutput = false;
/**
* Write directory
*/
std::string writeDirectory;
/**
* Show system information of process in the left top corner.
*/
bool showSystemInformation;
/**
* Original width of frame.
*/
int width;
/**
* Original height of frame.
*/
int height;
/**
* Fps of video stream.
*/
int fps;
/**
* Original width will be truncated due to performance reasons.
* Height will be truncated in proportional manner.
* If you have intention to change this parameter, delete region.png at first.
*/
const int truncatedWidth = 800;
/**
*
* Method delegates to RegionChooser class and add warning lables onto image.
*
* @param img_input Current frame of image
* @return Region of interest
*/
cv::Mat chooseRegion(cv::Mat);
public:
/**
* It performs initialization and truncates frame according to {@link #truncatedWidth}.
* If there is no region of interst, it will suggest to create one.
*
* @param file_name Name of video file with hockey game.
*/
VideoHandler(char const*, int = 0, char*[] = nullptr);
/**
* Handle the video stream using necessary classes.
*/
void handle();
/**
* Releases memory from windows.
*/
~VideoHandler();
};