-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
48 lines (35 loc) · 888 Bytes
/
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
/*
* Robust motion segmentation
* by Jakub Vojvoda, [email protected]
* 2016
*
* licence: GNU LGPL v3
* file: main.cpp
*
*/
#include "src/motionsegmentation.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
int main(int argc, char **argv)
{
if (argc != 2) {
std::cout << "usage: " << argv[0] << " filepath" << std::endl;
return 1;
}
cv::VideoCapture cap(argv[1]);
MotionSegmentation motion;
cv::Mat frame;
while (1) {
cap >> frame;
if (frame.empty()) {
return 1;
}
// TODO: command-line arguments parsing
cv::Mat segm = motion.segment(frame, 12.0, 0.25, 0.25, 0.25, 0.25);
cv::Mat result = motion.computeMask(segm, 7, 5, 80.0);
cv::imshow("Motion segmentation", result);
if (cv::waitKey(1) > 0) {
break;
}
}
}