Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV 1.0 not grabbing from webcam

I'm trying to get this project working using OpenCV 1.0, the most recent Qt 4.x release, and Visual Studio 2010. However, when it's supposed to grab an image from the webcam (using a wrapped call to cvQueryFrame), the pointer that's returned is null. I tried setting up some simple code myself to figure out where the problem is, but it still persists. Here is my code:

opencvWebcam webcam;
IplImage* testImage = nullptr;
CvCapture *test = cvCaptureFromCAM(0);

int dummy = cvGrabFrame(test);
testImage = cvRetrieveFrame(test);  // testImage is null here

cvNamedWindow("image");
cvShowImage("image", testImage);