I'm trying to do a project with OpenCV 2.2. I've successfully compiled OpenCV and QT (so I can get support for opengl). All of the samples work. However, when I try to create my own project from scratch and link against the opencv libs the camera examples give me a black screen. The exact same code compiles but when the application runs it somehow f开发者_StackOverflow社区ails. The webcam led is on but nothing is shown in the window.
Normally the console window would show something like this (when the program works correctly):
press q or esc to quit init done opengl support available
In my own project it just shows: press q or esc to quit
Could something be the matter with the initialization? Also I am giving my application
HAVE_VIDEOINPUT HAVE_DSHOW HAVE_QT HAVE_QT_OPENGL HAVE_CONFIG_H
definitions through the Visual Studio project properties options. I am using Visual Studio 2010 on Windows 7 64 bits.
Does anyone have any idea how to fix this? Thank you
You need to patch OpenCV 2.2 to work correctly with webcams in windows.
See http://dissipatedheat.com/2011/04/24/opencv-ile-webcam-goruntusu-isleme/, it is in Turkish, you can try google translate.
精彩评论