-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoCapture
More file actions
31 lines (30 loc) · 786 Bytes
/
Copy pathVideoCapture
File metadata and controls
31 lines (30 loc) · 786 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
//#include "opencv2/stdafx/stdafx.h"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#ifdef _EiC
#define WIN32
#endif
char path[50];
int main ( int argc, const char* argv[] ){
CvCapture* capture = cvCaptureFromCAM(0);
IplImage* image = 0;
cvNamedWindow("Window");
int count = 1;
while (true)
{
image = cvQueryFrame(capture);
cvShowImage("Window", image);
int ch = cvWaitKey(1);
if(ch == 115){
sprintf(path,"d:/OpenCV/captured%d.bmp",count++);
cvSaveImage(path,image,0);
}
if(ch == 27) break;
}
cvDestroyWindow("Window");
cvReleaseCapture(&capture);
return 0;
}