成功運作
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace cv;
using namespace std;
int main (int argc, const char * argv[])
{
cvNamedWindow("ccav", 1);
CvCapture *capture = cvCaptureFromCAM(0);
if (!capture)
{
printf("get camera error!\n");
exit(1);
}
IplImage *frame;
int key = 0;
while (1 > key)
{
frame = cvQueryFrame(capture);
cvShowImage("ccav", frame);
key = cvWaitKey(10);
}
cvReleaseCapture(&capture);
cvDestroyWindow("ccav");
return 0;
}
其實是opencv1的東東。