Hello, is it possible to read data from a generic webcam in C++ as you would from a stream object? Is there a common API or standard that works with all webcams?
I'm talking about C++ in *nix environment.
Thanks in advance.
Hello, is it possible to read data from a generic webcam in C++ as you would from a stream object? Is there a common API or standard that works with all webcams?
I'm talking about C++ in *nix environment.
Thanks in advance.
You might wanna check if webcams are TWAIN compatible and use their apis to do that.
First find out if the web cam streams video or not? Typically they would stream the video to a particular port. You can then open a Socket in C++ on that port and get the video data. Most webcams should be able to do this.
The main thing here is you need to understand what video format does the webcam use and how to process it. Silverlight or DirectX will help as they can directly listen at the particular port, but you have not mentioned which OS you are using.
In case the web cam does not stream it should at least have the feature to save video to a file. In this case also find out the video format and that should help you decide which API to use.
For linux, V4L. AFAIR, BSD uses the same codebase. I do not know about the others...
In Linux, webcams are supported using Video4Linux. Take a look at the userspace API and an Video4Linux introduction.