VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】
http://www.opencv.org.cn/index.php/VC_2008_Express下安装OpenCV2.0
#include "stdafx.h"
#include <opencv/cv.h>
#include <opencv/cxcore.h>
#include <opencv/highgui.h>
int main(int argc, _TCHAR* argv[])
{
CvCapture* capture1 = cvCreateCameraCapture( 0 );
double w = 320, h = 240;
cvSetCaptureProperty ( capture1, CV_CAP_PROP_FRAME_WIDTH, w );
cvSetCaptureProperty ( capture1, CV_CAP_PROP_FRAME_HEIGHT, h );
cvNamedWindow( "Camera_1", CV_WINDOW_AUTOSIZE );
IplImage* frame1;
int n = 2;
while(1)
{
frame1 = cvQueryFrame( capture1 );
if( !frame1 ) break;
cvShowImage( "Camera_1", frame1 );
int key = cvWaitKey(30);
if( key == 27 ) break;
}
cvReleaseCapture( &capture1 );
cvDestroyWindow( "Camera_1" );
return 0;
}