0
votes

I'm learning OpenCV because I want to build and program a 3D Scanner over the summer.

I bought three webcams for this purpose (two for the actual stereo images and one for texture [or as a backup]).

I tried to get a webcam's video with OpenCV. However, this does not work, as I ended up with a black screen, instead of video.

I then tried the same code with my grandmother's webcam. It worked fine. However, I already bought 3 webcams of the type that I was planning on using to build my scanner: http://www.amazon.com/Webcam-Camera-Vision-Meeting-compatible/dp/B0015TJNEY/ref=pd_bxgy_e_img_b

I don't want to buy any new webcams.

Does anybody have any idea of why my webcams don't work with OpenCV (they work with other programs)?

How can I get OpenCV to accept my webcams?

Any suggestions would be appreciated!

Thanks

1
@shobhit Well, I looked for any error messages - none. I also looked at the driver file. It's called: usbvideo.sys. I also looked around Stackoverflow and found: stackoverflow.com/questions/4430367/…. It basically states my problem. But the first solution doesn't work because I had already included the cvWaitKey. The second solution seems to be my problem, but I want to know how to fix it.eboix
What is your operating system? We can tell it is windows by the usbvideo.sys driver file but even so. Is the camera working with other programs?Rui Marques
The camera works with other programs, such as VLC player. I have Windows 7 Enterprise. If I can't get my webcam to work with OpenCV, then I'll download some other library and get the webcam input into a file, which I will then read with OpenCV.eboix

1 Answers

0
votes

If your program pass this step , you should try a different number for cvCaptureFromCAM(0); 0 is the first web cam but maybe your's is set as 1, 2 or 3. you can also try -1 and see what happens

CvCapture *capture;
capture = cvCaptureFromCAM(0);
if (!capture)
{
    printf("Error at capture");
    return 1;
}