PDA

View Full Version : How can I access webcam in Qt?



tofighi
16th July 2011, 05:24
Is there any way to access list of installed webcam on system and select among them? (I'm working in windows environment, my laptop has a built-in webcam, and I also have a USB webcam. I would like to access them and select them from a drop down)

stampede
16th July 2011, 09:19
I guess you need to use separate framework for capturing, like OpenCV (the easy way) or DirectShow (the hard way). OpenCV has beed discussed many times on the forum, just search for threads.

tofighi
16th July 2011, 17:18
I guess you need to use separate framework for capturing, like OpenCV (the easy way) or DirectShow (the hard way). OpenCV has beed discussed many times on the forum, just search for threads.

Actually I'm using OpenCV! I want to be able to know about each system webcams and in a drop down menu select one of them. In OpenCV I can say the program the id of webcam (0,1,...). I want to choose the webcam from a dropdown and this dropdown provide camera id in the program behind the scene.

tofighi
17th July 2011, 20:55
I found the solution and because I know it is the question of many users I share my solution:
First of all, for working with camera and webcams, use OpenCV library. There are a lot of tutorials for using OpenCV library inside Qt.
It is completely possible to find how many webcams in the system using OpenCV. In this page (http://opencv.willowgarage.com/wiki/faq#Howtouse2cameras.28multiplecameras.29withcvCam library)you can find out how to do this.