Ask Your Question
0

Problems with webcam in Windows 7, OpenCV 2.4.6

asked 2013-07-30 12:22:12 -0600

Bismarky gravatar image

Hi,

I have used OpenCV for a long time, but now I have problems with the last version 2.4.6. Capture from the webcam is not working at all (neither in my own programs nor the C and C++ samples that come with OpenCV).

I am using Windows 7 and I usually work with the IDE QtCreator. I downloaded OpenCV 2.4.6 and the last version of QtCreator 2.7.2, that uses Qt 5.1.0 and MinGW 4.8. I have tried everything: using the precompiled mingw binaries and libs; compiling OpenCV in mingw with optimizations, without optimizations, with Qt, without Qt, with Debug configuration, with Release configuration, with SSE, without SSE... I have even tried downloading and compiling with Visual C++ 11, with optimizations, without optimization..., using the precompiled VC11 files and compiling the samples... I'm desperate!!! In all cases, I can compile OpenCV 2.4.6 correctly and also the samples, but when I execute the samples, all the programs that use the webcam doesn't work. There are also some problems with programs that use several highgui windows, because the windows doesn't refresh correctly.

The webcam is working correctly in previous versions of OpenCV (in DShow mode), and also in other applications not related to OpenCV.

I don't know what else I can try!!! Please, any indication or suggestion would be appreciated.

Best regards,
-------
Bismarky

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2013-07-30 16:29:45 -0600

SR gravatar image

I guess it is an issue related to the Linux capturing bug as you use MingW which is gcc-based. Try OpenCV 2.4.6.1 where this issue should be fixed. OpenCV 2.4.6(.0) built with Visual Studio worked for me.

edit flag offensive delete link more

Comments

Thank you, SR. But that was not the problem. I have found the solution (or "one" solution).

I decided to take a look into the source code; more specifically, into: modules/highgui/src/cap_dshow.cpp

There is only one change in that file with respect to version 2.4.5. In function CvCaptureCAM_DShow::retrieveFrame, the old version 2.4.5 says in line 3198:

VI.getPixels( index, (uchar*)frame->imageData, false, true );
return frame;

In the new version 2.4.6 it is replaced by:

if (VI.getPixels( index, (uchar*)frame->imageData, false, true ))
    return frame;
else
    return NULL;

Probably there is some reason for that if-else. But the fact is that replacing that piece of code with the old version the camera works fine for me, and also all the samples

Bismarky gravatar imageBismarky ( 2013-07-31 09:48:18 -0600 )edit
0

answered 2013-10-11 16:55:27 -0600

I have a similar problem. I installed today new OpenCV 2.4.6. Camera doesn't work with this release. I use g++ compilation in Eclipse. Why with older release is everything OK and with newer it doesn't work?

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-07-30 12:22:12 -0600

Seen: 1,339 times

Last updated: Oct 11 '13