#include <cv.h>
#include <cvaux.h>
#include <cxcore.h>
#include <highgui.h>
#include <iostream>
using namespace std;
int main()
{
CvCapture* capture = cvCaptureFromCAM(0);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,320.0);
cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,240.0);
cvSetCaptureProperty(capture,CV_CAP_PROP_FPS,30.0);
IplImage* img = 0;
cvNamedWindow("imgWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("imgWin", 100, 100);
if(!cvGrabFrame(capture)){ // capture a frame
printf("Could not grab a frame\n\7");
exit(0);
}
img=cvRetrieveFrame(capture); // retrieve the captured frame
while(cvGrabFrame(capture)){
img=cvRetrieveFrame(capture);
cout << "Tamaño: " << img->width << "x" << img->height << endl;
cvShowImage("imgWin", img);
cvWaitKey(2);
}
cvReleaseCapture(&capture);
return 0;
}