RSS

Capture Video With OpenCV

29 Jan
#include "stdafx.h"
#include<opencv\cv.h>
#include<opencv\cxcore.h>
#include<opencv\highgui.h>

using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{

 CvCapture *capture = cvCaptureFromCAM(0);
 if( !capture ) return 1;
 cvNamedWindow("Video");

while(true) {

 IplImage* frame = cvQueryFrame( capture );
 if( !frame ) break;
 cvShowImage( "Video", frame );
 int c = cvWaitKey(40);
 if((char)c==20 ) break;
 }

cvDestroyWindow("Video");
 cvReleaseCapture( &capture );
 return 0;
}

&nbsp;

Advertisements
 
Leave a comment

Posted by on January 29, 2013 in C++

 

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: