Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webcam access in c++

Tags:

I want to access the webcam so I can do some precessing on the images, like tracking a light, but I can't find a way to access the webcam. I googled it but I got confused.

Can you point me to a library that can do that (windows)? and maybe also provide an example?

I would need to periodically get a pixel map of the image, about 20 time per second or so if it would be possible.

like image 517
csiz Avatar asked Aug 11 '09 09:08

csiz


People also ask

What is webcam access?

Webcam software enables users to record a video or stream the video on the Internet.

What is webcam and its function?

A webcam is a digital video device commonly built into a computer. Its main function is to transmit pictures over the Internet. It is popularly used with instant messaging services and for recording images. *Note: The instructions for this webcam are specific to a brand and may vary for other brands and products.


2 Answers

You need DirectShow. This is a Windows framework for video playback and capture.

It's included in Windows SDK and there are many samples for video input capture included.

But, as Vijay mentioned, you can also try using OpenCV since it not only abstracts away the platform-specific video capture API, it also includes many image processing algorithms you could use to track the light in your project.

like image 80
macbirdie Avatar answered Oct 05 '22 04:10

macbirdie


There's a wrapper for DirectMedia/DirectShow called Extremely Simple Capture API or ESCAPI. If you don't need to do anything complicated, ESCAPI might be a good bet.

like image 44
Jonba Avatar answered Oct 05 '22 04:10

Jonba