forked from oreillymedia/Learning-OpenCV-3_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_02-03.cpp
More file actions
42 lines (27 loc) · 765 Bytes
/
Copy pathexample_02-03.cpp
File metadata and controls
42 lines (27 loc) · 765 Bytes
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
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace std;
int main( int argc, char** argv ) {
cv::namedWindow( "Example 2-3", cv::WINDOW_AUTOSIZE );
cv::VideoCapture cap;
cap.open( string(argv[1]) );
cout <<"Opened file: " <<argv[1] <<endl;
cv::Mat frame;
for(;;) {
cap >> frame;
if( frame.empty() ) break; // Ran out of film
cv::imshow( "Example 2-3", frame );
if( (char)cv::waitKey(33) >= 0 ) break;
// int c = cv::waitKey(33);
// for(int i=0;i<32;i++) {
// cout <<((c&(0x1<<(31-i)))?1:0);
// }
// cout <<endl;
// cout <<"Breakey: '" <<(int)c <<"'"<<endl;
// if( (signed char)c >= 0 ) {
// break;
// }
}
return 0;
}