Video grabbing under linux is a bit problematic, due to the variety of available protocols and the lack of drivers. This thread, tries to explain how to know if your device is supported under linux. I’ll present some tools that should work with every kind of device, if your camera works with some of this software but not under openframeworks, please post a message with your device model, the program it works with, and the output of the videoGrabbingExample.
Webcams: v4l/v4l2
For webcams the most common standard is v4l, that although is an old standard and has some design failures, it’s the most used nowadays. The new one is v4l2. Normally every camera that supports v4l2, also support v4l.
To try if those cameras are supported you can use:
Camorama: only for v4l devices, under debian and derivates you can install it with:
sudo apt-get install camorama
Ekiga: is the videoconference software that ships with most of the gnome based distributions, under edit > preferences > devices > video devices, you can select your video device, it works both for v4l and v4l2
UCView: see below
Firewire devices:
Coriander: For raw firewire devices, (not dv cams) you can use this. A little bit ugly but it’s supposed to work with almost every 1394 device. Under debian derivates you can install it with:
sudo apt-get install coriander
UCView: see below
DV devices
Kino: The most known program to work with dv cameras is kino, a non linear video editing software for linux. To install it:
sudo apt-get install kino
UCView
As far as I know this is the only program that works with v4l, v4l2 and raw firewire devices. Also I’ve been talking with Arne Caspari (the unicap developer) and he is going to set up a simple DV module without transportation (no support for forwarding, playing… the tape) so I can extend it to our needs. Openframeworks 0.05, will ship with the same library that this program use, so if your device works with it, it have to work under the next openframeworks version. It’s also really useful to adjust your device properties before working with it (ie: deactivating auto mode for artificial vision apps).
You can download it from
http://www.unicap-imaging.org/download.htm
If you use ubuntu, the easiest way to install it, is to follow the instructions in
http://www.unicap-imaging.org/using-repository.htm
and then
sudo apt-get install ucview
Opencv
opencv provides video grabbing functions for v4l/v4l2 and raw firewire devices under linux:
#include "highgui.h"
#include "cv.h"
#include "cxcore.h"
#include "cvaux.h"
int main( int argc, const char* argv[] ){
CvCapture * vidGrabber= cvCreateCameraCapture( device_id );
cvSetCaptureProperty(vidGrabber,CV_CAP_PROP_FRAME_WIDTH,width);
cvSetCaptureProperty(vidGrabber,CV_CAP_PROP_FRAME_HEIGHT,height);
while(true){
IplImage* image = cvQueryFrame(vidGrabber);
// do whatever you want with image
...
}
}
where device_id is:
autodetect: 0
v4l/v4l2: 200
firewire: 300
Add device number to that if you have more than one of that kind. ie: if you have two firewire devices, to open the second one, device_id will be 301.
hope that helps
arturo