Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // #include <cv.h>
- #include <highgui.h>
- #include <stdio.h>
- int main() {
- CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
- if ( !capture ) {
- fprintf( stderr, "ERROR: capture is NULL \n" );
- getchar();
- return -1;
- }
- while ( 1 ) {
- IplImage* frame = cvQueryFrame( capture );
- if ( !frame ) {
- fprintf( stderr, "ERROR: frame is null...\n" );
- getchar();
- break;
- }
- cvSaveImage( "image.jpg", frame, 0);
- if ( (cvWaitKey(10) & 255) == 27 ) break;
- }
- cvReleaseCapture( &capture );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement