-
Notifications
You must be signed in to change notification settings - Fork 204
/
denseImage.cpp
43 lines (35 loc) · 911 Bytes
/
denseImage.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
#include <opencv2/video/tracking.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <stdio.h>
#include <iostream>
using namespace cv;
int main(int argc, char** argv){
// IO operation
const char* keys =
{
"{ f | vidFile | ex2.avi | filename of video }"
"{ i | imgFile | flow_i | filename of flow image}"
};
CommandLineParser cmd(argc, argv, keys);
string vidFile = cmd.get<string>("vidFile");
string imgFile = cmd.get<string>("imgFile");
VideoCapture capture(vidFile);
if(!capture.isOpened()) {
printf("Could not initialize capturing..\n");
return -1;
}
int frame_num = 1;
Mat frame;
while(true) {
capture >> frame;
if(frame.empty())
break;
char tmp[20];
sprintf(tmp,"_%05d.jpg",int(frame_num));
imwrite(imgFile + tmp, frame);
frame_num = frame_num + 1;
}
return 0;
}