Hi I am trying to detect web cam in opencv using following code i am getting blank black screen though my web cam is attached to my pc via usb
my web cam is using *ICatch(VI) PC Camera * driver & i am using opencv 2.1 with VS 2008
#include "cv.h"
#include "highgui.h"
int main( int argc, char** argv ) {
cvNamedWindow( "cam", CV_WINDOW_AUTOSIZE );
CvCapture* capture;
if (argc==1) {
capture = cvCreateCameraCapture( 0 );
} else {
capture = cvCreateFileCapture( argv[1] );
}
assert( capture != NULL );
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "cam", frame );
char c = cvWaitKey(10);
if( c == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "cam" );
}