Sunday, May 15, 2011

Setup ieee 1394 camera with OpenCV support

Hi folks,
I'm sure that some of you might have tried to interface a IEEE 1394 firewire camera with Linux but found no success.

This is the way I could use Imaging Source IEEE 1394 camera with Ubuntu 10.4 OS using libdc1394 / Coriander.

Follow the steps:
  1. Plug your camera to the 6 pin IEEE 1394 port on your PC. (Obviously ;) )
  2. Install Libraw1394, Libdc1394 libraries and corriander. 

  3. Open a text file and save the following as bash script:

  4. You will most of the times need to execute the above script before running any program (especially if, something may have gone wrong in your program in runtime or if you have any segmentation fault after running the program, whatsoever). This script makes sure that everything is right for the your libdc1394 program to execute. (you don't have to chmod every time, so its basically, the first 2 lines of code that you want to use).
  5. Write your program in C++/C specification of libdc1394 and execute it.
  6. You can also make sure that your camera is working using coriander (just go to command line 
  7. terminal and execute the command $ coriander to open up coriander).

Code to convert dc1394video_frame_t to IplImage:

(thanks to Rohith Reddy for the following code):

Most of the documentation available on the web for very old versions of libdc1394. For latest documentation and working example programs visit

Old resources/documentation of libdc1394 is available on the following links:

Rahul Kavi.


  1. Hi,
    I have a ImagingSource firewire camera, and I have been trying to get it working with OpenCV on Ubuntu for ages. I was very happy to find your post. How do you get the image from dc1394 into a openCV cv::mat ? Any "hello camera!" code for OpenCV would be great. THanks.

  2. Hi. I will post the code soon(in a few days) if thats Ok. I don't have access to it right now. Basically you need to access the images (YCrCb, YUV) format and copy it to IplImage/Mat format (RGB, etc).

  3. hi. Thanks.
    Yeah, I have found the hello world code from the link above, and I'm getting the image now. I'll wait to see your code to see the best way to convert it from YCrCb to way is a bit clumsy I think.
    Thanks a lot , this was really helpful.

  4. Thank you. I'm not sure if that is the most efficient way of doing it. Anyway I'll post it by the end of this week. Keep visiting the blog for more updates.

  5. Ok, after a bit of digging I'm using ffmpeg swscale function for format conversion instead of doing the maths in code myself, which was not efficient.
    All good now.

  6. Can you post the "ffmpeg swscale function" way of doing it? It would be helpful for the blog readers.

    Also, I posted my code above (updated).