ofxVideoGrabber - Libdc1394 grabber with plugin SDKs

I finally finished up the first release of this addon which was a collaboration of myself with Andreas Müller (nanika) with some tips and suggestions from the OF regulars, especially Memo, plus some unreleased GUI code from Theo which proved very useful as well.

As it stands, this addon is meant to be extensible such that you can eventually plug in your own camera SDKs and also customize the GUI (albeit using the same GUI elements).

The addon currently defaults to using Libdc1394, a very useful library which connects well with (mostly firewire) IIDC cameras such as those from Point Grey research and the popular Fire-i from Unibrain.

Currently this addon only has compiled Libdc1394 libraries for Linux and OSX. I’m going to have a try at compiling for Windows, but it’s lower priority because windows currently supports the Fly Capture SDK for Point Grey cameras.

A Fly Capture SDK using the new version 2.0 API from Point Grey is forthcoming…actually if anyone wants to help out with this I would appreciate it.

Current (minor) issues:

  • I have supplied a font in the download because currently you need to supply a font for the GUI drop downs to render properly. The default bitmapfont has issues on OSX (couldn’t get it to render behind opengl quads even with depth testing switched on).

  • Also I was getting an occasional hang on OSX on app exit. I seemed to have fixed this by sleeping a little after shutting down the capture thread before stopping the camera. I you experience any weird issues please let me know.

  • Saving and loading of settings is not implemented yet

I’ve zipped up a version of the code with Codeblocks Linux and XCode projects here:


You can also check out the svn if you like.

Works great with my firelfy mv on Mac OS X; only issue I’ve seen so far is a wrong camera fps counter. Works if I set the cam at 30fps, doesn’t (shows negative numbers) at 60.

Thanks so much for this! Will play with it and report more soon

PD: Seems like libdc1394 supports format7, any ideas on how to set it to use such mode?

PD2: Found a bug; if you don’t request it to create Textures ( bUseTexture==false in initGrabber() ), it doesn’t allocate space to put the pixels on…

//pixels = new unsigned char[width * height * bpp];

And crashes at the first Libdc1394Grabber::grabFrame() call trying to copy pixels to a non allocated structure.

Placing an else clause seems to fix it:

// FILE: ofxVideoGrabber.cpp (line 32) //  
if (bUseTexture){  
// NEW CODE HERE  ///////////////////////////////////  
     if(  targetFormat == VID_FORMAT_GREYSCALE ||   
          targetFormat == VID_FORMAT_RGB) {  
            pixels = new unsigned char[width * height * bpp];  
            memset(pixels, 0, width*height*bpp);  

Aaah yes, forgot to test without the texture, thanks for that!

I haven’t used format 7 yet but one of my cameras supports it, so I’ll check it out, shouldn’t be too hard to hook up.

I saw some weirdness with the FPS counter but didn’t investigate further as I was too busy testing the rest of the code…I’ll have another look.

I kept the api simple for the moment just to get things going. For example I disabled absolute values of features which might be useful for some people later but isn’t really that important.

Have to step out for a bit but I’ll upload those fixes later tonight.

This thing is awesome man; good job!

I really thank you for releasing this, I was always too lazy to try get libdc to work (as quicktime kind of did the job anyway). This seems to be waaay smoother than quicktime’s firewire implementation.

Now i can retrieve 640 x 480 grayscale image @ 60fps using only 10% of my old macbook’s cpu; quite awesome!

Now if I could get mode_7 to work and get a 320 x 240 @ 120fps image I’d be pretty damn happy.

hey grimus,

thanks for doing this.

I have recently needed a similar addon and started a project here:

Feel free to take any code you want. I use simple format_7 for both libdc1394 and flycapture 2.0. For my use I only needed grayscale so there is no color support in there.

OK I’ve uploaded those changes armadillu…

Thanks Stefan!
This works with the latest version of the 2.0 PG SDK? Basically I had a copy of some FlyCapture SDK code from Andreas but I don’t think it was the new api that also runs under Linux.

By the way the Libdc1394 version ofxVideoGrabber is threaded…and for the record so far I’ve connected 3 unibrain fire-i cameras to it at the same time (at 320x240), so multiple cameras should be fine.

Big thanks to Andreas who actually wrote the initial capture code. I’ve made a lot of changes but the core stuff is still basically his I think.

top work!
can’t wait for my firefly mv to arrive… put in an order today.
this should make setting it up for the first time a lot simpler.

After I valiant attempt I gave up trying to build a windows version for the libdc1394 library…I thought I’d do it to give people on windows extra options but it turns out that it’s a bit of a nightmare…if possible at all. Using minGW and MSys the current release version begins compiling ok then hits a slew of errors. From the forums someone is working on a VS2008 version but it’s not finished yet.

This library (http://code.astraw.com/projects/motmot/libcamiface.html) doesn’t support windows on libdc1394 either…if that’s any indication.

While researching this I came across this link which might be of interest to Windows XP users:
Article 171: Performance of 1394 devices may decrease after installing Windows XP SP2 or SP3


I am trying to make AVT Guppy f80 work in OF. I am reading on the AVT site that with Libdc1394 I should get it to work on Mac OSX.

I tried running the ofxVideoGrapper but got many errors.

/Applications/of_preRelease_v0.06_xcode_FAT/apps/my/guppy/src/Libdc1394Grabber/Libdc1394Grabber.h:9:27: error: dc1394/dc1394.h: No such file or directory

i downloaded the libdc1394-2.1.2.tar from http://damien.douxchamps.net/ieee1394/libdc1394/

i did:
make install

but still, it seems to not find dc1394
please advice on where to place certain files and other steps that i might have forgotten.


Hey grimus,

Prosilica cams would be cool to support too. Here is a start:

This is for osx but getting this to run on linux or windows should be a matter of substituting the static link libraries.

@ stephanschulz:

In the files I uploaded, the libdc1394 library and header files (including libdc1394.h) are in an included folder called “libs”.

Are you able to run the example app I have provided?

I don’t recommend you try and build your own XCode project from scratch - you’re better off using my example and building from that.

Unless you specify to link to a system version of libdc1394 (I’m linking to the local static library), your application won’t find it, so doing the install as you did won’t help. If you want to go down this path (which you don’t need to as I’ve already provided the libraries) you would need to open up the XCode project settings and include “-ldc1394” in the linker settings.

Great work stefan!
Do you want me to host that on the google code site? Eventually this should all go on the upcoming new addons site I guess…

hey grimus

i will rather use your included libdc1394 library. thanks for clearing this up for me.

but i am still getting a lot of poco errors, like
Poco/Foundation.h: No such file or directory

i never had this problem but maybe i never used poco.
do you have any inside on where and what to do.
maybe i never initilazed/installed poco properly. it is in my lib folder though.

do i have to place ofxVideoGrapper in the addon folder or in the app folder?

i will do some forum search on poco maybe i can find the reason.


by placing grimus files in apps/examples it stopped giving me the poco erros

now i get errors like this (but less :slight_smile: )
‘::memcpy’ has not been declared
‘::strncpy’ has not been declared

ok it compiles now.

i placed it in the app/example folder.
and i learned not to rename the ofxVideoGrabber folder.

still my guppy f80 does not work with this addon. the two little LEDs on the back start blinking. I will have to check the AVT website to learn what that means.

  1. update:
    the led blinking code i am getting indicates a VMode_ERROR_STATUS. ???

  2. update:
    i get an image now. i had to uncomment
    bool result = vidGrabber.initGrabber( camWidth, camHeight, VID_FORMAT_GREYSCALE, VID_FORMAT_GREYSCALE, 30, true, new Libdc1394Grabber);

now i need to figure out the debayering / demosaicing.
Thank you.

P.S. I guess this become more a report than a regular post. i hope this is ok with you guys.


if you can keep it close to ofxVideoGrabber with the eventual goal to integrate it that would be great. At the moment I don’t have the time but I might be able to help with that at a later point.

as mentioned earlier i am now getting a video image from the guppy

it only works when i set the vidGrabber.initGrabber to VID_FORMAT_GREYSCALE, VID_FORMAT_GREYSCALE

but i would like to get an output frame in RGB (VID_FORMAT_RGB). see error message (bold text) below when i set it to VID_FORMAT_GREYSCALE, VID_FORMAT_RGB

any ideas?

///error message ///
Libdc1394Grabber() constructor
width: 640 height: 480
There were 1 cameras found attached to your PC
Using Camera with GUID 2892819639788047
Listing Modes
Mode: DC1394_VIDEO_MODE_640x480_MONO8
Frame Rates:
[0] rate = 3.750000
[1] rate = 7.500000
[2] rate = 15.000000
[3] rate = 30.000000
[4] rate = 60.000000
Mode: Unknown format

libdc1394 error: Invalid video format: in dc1394_video_get_supported_framerates (control.c, line 595): Modes corresponding for format6 and format7 do not have framerates!

Can’t get frame rates
Frame Rates:
[0] rate = 3.750000
[1] rate = 7.500000
[2] rate = 15.000000
[3] rate = 30.000000
[4] rate = 60.000000
Source bpp = 8
Setting capture
chosen video format: DC1394_VIDEO_MODE_640x480_MONO8
chosen frame rate: DC1394_FRAMERATE_30
start transmission
wait transmission
Name Abs. Curr. Curr2. Min. Max.
Brightness : 0 58 0 255
Exposure : 0 159 50 205
White Balance : 0 643 393 0 1022
Gamma : 0 0 0 1
Shutter : 0 2434 1 4095
Gain : 1 0 0 0
Trigger : 0 0 2.68839e+09 1
Trigger Delay : 1 0 0 0
Libdc1394Grabber::setBayerPatternIfNeeded(), Failed to get the dc1394_format7_get_color_filter.
grabbed a bayer pattern from the camera

Hi Stephan,

Just ignore those error messages, I need to clean them up. They are just related to format 7 capability but are a little confusing at the moment.
Do you have a monochrome or a colour camera? If you have a monochrome camera then you can only use VID_FORMAT_GREYSCALE for input and output. When you grab a frame it will return you a greyscale frame, not an RGB one.

It is a color cam. If I look through it with skype than the image is grey and look not debayered. Use ofxvideograbber gives me a more normal looking image. But still grey with every 2nd pixel dark grey.
When I try using any thing other than GREYSCALE I get no cam image at all.

Any ideas?

here is what i further found out on my quest

if i set

 bool result = vidGrabber.initGrabber( camWidth, camHeight, VID_FORMAT_GREYSCALE, VID_FORMAT_GREYSCALE, 30, true, new Libdc1394Grabber, new ofxIIDCSettings);  

to get a grey image from my color guppy f033C.

from reading the AVT manual the guppys output video format is Mono8 at 640x480.
this mean i should do set the following:

bool result = vidGrabber.initGrabber( camWidth, camHeight, VID_FORMAT_Y8, VID_FORMAT_RGB, 30, true, new Libdc1394Grabber, new ofxIIDCSettings);  

but all i get is a black image which makes me believe the debaying does not work.

in file Libdc1394Grabber.cpp the folowing gets called:

dc1394_bayer_decoding_8bit( _cameraImageData, pixels, width, height,  bayerPattern, bayerMethod );  

i tried all kinds of bayerPattern and bayerMethod, still nothing.

so i looked where dc1394_bayer_decoding_8bit is located. conversions.h but there is no conversion.c file

than I downloaded the most current libdc1394-2.1.2 from http://sourceforge.net/projects/libdc1394/files/ and the is also a conversion.h and conversion.c

so is it just missing in the ofxVideoGrabber version or am i just too green:)

there is also a bayer.c file that is not included in the ofxVideoGabber version.

What does that mean. Any clues.


ok, so mono 8 normally just means greyscale, but maybe it’s bayer pattern mono 8?

So you’ve traced the code and it’s calling the libdc1394 bayer call? …in which case it sounds like you have bayer 8 format. The function is contained in the static library which you are linking to, so you won’t find it, but yes you can see the code in the libdc1394 source code.

Have you tried VID_FORMAT_RGB, VID_FORMAT_RGB or does that not work?