How do I get a web camera to send the video to my program?

Nov 9, 2011 at 6:42pm
I am using opencv to make a computer vision application. I want a web camera hooked up to a computer to get a video and send it into my c++ program so I can operate on the frames.

How do I interface the web camera to do this with the program?
Last edited on Nov 9, 2011 at 7:09pm
Nov 9, 2011 at 9:18pm
I don't know opencv, so I can't say if there is something "integrated" and read-made just to be used to achieve your goal, BUT I think WIA (Windows Image Acquisition) is still the technology to use in Windows for cameras and scanners.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx

EDIT: I think WIA is no longer the one for video, just for still images. In the link above is mentioned the new thing: Windows Portable Devices.

http://msdn.microsoft.com/en-us/library/dd388998(VS.85).aspx
Last edited on Nov 9, 2011 at 9:26pm
Nov 10, 2011 at 5:32pm
Opencv has functions to receive images and video live from a webcam or from a file. I dont know the exact functions but you use cvNameWindow() to create an opencv window. I found a great article showing how to display video and images as well as perform transformations on them.

http://www.pages.drexel.edu/~nk752/tutorials.html

here is a link to the tutorials but i dont think it shows how to access video. Once you get the camera to take a picture or record video you can save it to a file.
Last edited on Nov 10, 2011 at 5:37pm
Nov 10, 2011 at 11:57pm
This article list the functions to capture video and images from a camera and save them or to read them from a file. Its very straightfoward and easy to grasp.

http://opencv.willowgarage.com/documentation/python/reading_and_writing_images_and_video.html

unfortunately its not that easy to display the opencv video or images in a window other then the opencv window. You have to use the api to display it in an opencv window which gets rid of all the UI elements you have in other api's. I myself am currently looking for a way to implement it in some way that gives me the option to have a UI and other important things. I'm trying to make an open source, not for profit, project for disabled people.
Last edited on Nov 11, 2011 at 12:06am
Topic archived. No new replies allowed.