Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

CvCapture* capture = cvCreateCameraCapture(0); is not working for me... c++ w10

but VideoCapture cap(0); is working for me..it opens the camera.. please anyone give solution..

click to hide/show revision 2
No.2 Revision

updated 2016-08-06 12:21:58 -0600

berak gravatar image

CvCapture* capture = cvCreateCameraCapture(0); is not working for me... c++ w10

but VideoCapture cap(0); is working for me..it opens the camera.. please anyone give solution..

#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <stdarg.h>

using namespace cv;
using namespace std;
int main( int argc, char** argv ) {
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
CvCapture* capture = cvCaptureFromCAM(0);
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Example2", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
}

above shows the code...but when cv: :videocapture used cvQueryFrame gets error as there are no pointer in use...how to solve this..?