The Lirec camera & Linux

The official lirec camera is:

Getting it working

  • After plugging the camera in, you may need to do:
modprobe raw1394
modprobe video1394
chmod 777 /dev/raw1394
chmod 777 /dev/video1394

To get an image working it's a bit picky - you have to press the buttons in the following order:

  1. In the services tab click 'Receive' at the top
  2. Then in the ISO Control box in the same tab, click 'Start'
  3. Click 'Display' at the top

To test OpenCV, install libunicap from, then rebuild opencv by rerunning:

./configure --use-unicap=yes

The examples in libunicap are very useful for debugging, such as device_info, raw_image and sdl_display. There is also an OpenCV example here.

Getting debayering working in coriander

  1. In services tab again, in Format select 'Format_1, Mode_5:1024×768 Mono 8bpp'
  2. In options click Nearest and GBRG
  3. In Trigger you should be able to select 30fps

You can also get OpenCV to read from this mode, but it will get the raw image directly.

Getting the camera working with OpenCV

The caminfo for OpenCV I used for the raw image was as follows (I think Marek has a better way):

static struct caminfo cameras[] =
      handle:            NULL,
      device_identifier: "Imaging Source DFx 31AF03-Z 1940800048",
      fourcc:            UCIL_FOURCC( 'Y', '8', '0', '0' ),
      format_size:       { 0, 0, 1024, 768 },
      window:            "Camera 1",
      image:             NULL,
      properties:        camera0_properties,
      property_count:    sizeof( camera0_properties ) / sizeof( unicap_property_t ),

      cascade: NULL,
      storage: NULL,

Using OpenCV for the debayering

OpenCV has a built in debayering algorithm, as part of it's colour space conversions. The one which works with the lirec camera is:

cvCvtColor(bayerimage, rgbimage, CV_BayerGB2RGB);

Where the input is a 1 channel image and the output is 3 channel RGB image.

The bayer pattern image, raw data from the camera CCD

Converted to RGB

  • lirec/firewire_camera_notes.txt
  • Last modified: 2009-05-08 12:55
  • by davegriffiths