-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
57 lines (42 loc) · 1.29 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
#include "DIP.h"
#include "Perspective.h"
#include "Tracker.h"
#include "VideoInput.h"
#include "opencv2/videoio.hpp"
#include "opencv2/videoio/videoio.hpp"
using namespace std;
using namespace cv;
int main()
{
VideoInput input("../1.mp4");
Mat actualFrame = input.getFrame();
Perspective perspective(actualFrame, Perspective::InitializationType::Manual, Perspective::TransformMatrixType::FromFile);
perspective.TransformImage(actualFrame);
TrackingClass tr(TrackingClass::Tracking::opencvTracker, TrackingClass::Background::opencvBS, actualFrame);
tr.track(actualFrame);
while (true)
{
actualFrame = input.getFrame();
if (actualFrame.empty())
break;
cout << "Fps: " << input.ms() << endl;
double t1 = getTickCount();
perspective.TransformImage(actualFrame);
double t2 = getTickCount();
double time = (t2 - t1) / getTickFrequency();
cout << "Perspektywa: " << time << endl;
t1 = getTickCount();
tr.track(actualFrame);
t2 = getTickCount();
time = (t2 - t1) / getTickFrequency();
cout << "SledzKlaenie: " << time << endl;
namedWindow("mask", WINDOW_NORMAL);
resizeWindow("mask", 400, 300);
namedWindow("result", WINDOW_NORMAL);
resizeWindow("result", 400, 300);
imshow("mask", tr.returnMask());
imshow("result", actualFrame);
waitKey(20);
}
return 0;
}