displaying video from webcam in OpenCV

Posted by Adi on Stack Overflow See other posts from Stack Overflow or by Adi
Published on 2010-04-15T22:27:53Z Indexed on 2010/04/15 22:33 UTC
Read the original article Hit count: 310

Filed under:

hi all,

I have installed VS2008 and am able to run the demo codes "camshiftdemo and lkdemo " which comes in the opencv library. With this done, now I am trying to run some simple codes from the internet to get acquainted with the OpenCV. I am just trying to display video from webcam and I am getting the following error..

Error I am getting is :

Unhandled exception at 0x5e7e3d10 (highgui200.dll) in opencv.exe: 0xC0000005: Access violation reading location 0x719b3856.

The code I am trying to run is :

include

include

void main(int argc,char argv[]) { int c; IplImage color_img; CvCapture* cv_cap = cvCaptureFromCAM(-1); // -1 = only one cam or doesn't matter cvNamedWindow("Video",1); // create window for(;;) { color_img = cvQueryFrame(cv_cap); // get frame if(color_img != 0) cvShowImage("Video", color_img); // show frame c = cvWaitKey(10); // wait 10 ms or for key stroke if(c == 27) break; // if ESC, break and quit } /* clean up */ cvReleaseCapture( &cv_cap ); cvDestroyWindow("Video"); }

Any help in this will be greatly appreciated.

Thanks aditya

© Stack Overflow or respective owner

Related posts about opencv