-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathframework.cpp
33 lines (28 loc) · 951 Bytes
/
framework.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
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <stdio.h>
int main( int argc, char** argv )
{
cvNamedWindow( "Press Any Key to Quit", CV_WINDOW_AUTOSIZE );
CvCapture *capture = cvCreateCameraCapture(0);
if( capture == NULL )
{
printf( "\n!ERROR! - Could not open camera at /dev/video0\n\n" );
printf( "\nIf you are using VMWare, verify that the camera is connected" );
printf( "\nto the VMWare image by selecting 'Virtual Machine' in the" );
printf( "\nVMWare player window header above. " );
printf( "\nThen select 'removable devices' and verify your camera is connected.\n\n\n" );
assert(0);
}
IplImage *frame;
while(1)
{
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Press Any Key to Quit", frame );
char c = cvWaitKey(33);
if( c != -1 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Press Any Key to Quit" );
}