Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I've downloaded an OpenCV project that captures video from a web camera. It calls the OpenCV function cvCaptureFromCAM( CV_CAP_ANY ) to capture the video from the cam.

I compile with a debug win32 configuration on a 64bit windows 7 computer. When I choose 'start without debugging' from the Debug menu, the program works and and displays the 'capture source' diaglog to allow me to select a web cam and then displays the capture video as it should.

However, when I choose 'Start Debuggin', cvCaptureFromCAM returns null without allowing me to select the device.

I'm not sure what I need to do to get to step into the code. I'm not even sure if this is an OpenCv issue or a Visual C++ problem.

I was hoping someone could throw a little light on this issue????

Many thanks...
Posted

1 solution

It would be certainly seem to be an OpenCV issue, since the call to cvCaptureFromCAM(0 is returning a NULL. However, it may well be that something you have done either earlier in your code, or in your setup is the root cause. Try a complete rebuild of your Debug project and also check that your setup is identical for the Debug and Release versions.
 
Share this answer
 
Comments
FlurryKnox 29-Dec-11 6:04am    
Thanks for the hints...

Initially I thought it was a debug/release build issue...

However, I now build in Debug configuration and it works when I select 'Start without debugging' even with the debug build. The thing is that when I then select 'Start debugging' (also with debug build), the cvCaptureFromCAM function then returns null...

Not sure what could be causing this....
Richard MacCutchan 29-Dec-11 6:24am    
When you click "Start without debugging" (Ctrl-F5) it runs the Release version, when you click "Start debugging" (F5) it runs the Debug version. Try a complete rebuild of both versions and check the setup as I suggested.
FlurryKnox 30-Dec-11 18:38pm    
Thanks for explaining...I looked at the project settings for the release and debug builds and I couldn't find anything suspicious except that that in linker-> input included both the release and debug libraries for opencv. When I try to remove the release versions of the libs and include only the debug versions, I get compilation errors...
FlurryKnox 30-Dec-11 20:34pm    
I just installed Visual Studio 2010 and created a new project with only the the debug libs in additional dependencies and it compiles and works in 'Start Debugging'...As to exactly what was wrong with my Visual Studio 2008 installation that prevented me debugging this application, I don't know...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900