Creating a rectified color image using the libdc1394 software library.

Last Revision Date: 5/15/2015

This article describes the steps required to create a color rectified image using the libdc1394 software library in conjunction with the Triclops SDK. 

In order to produce a color rectified image, users must perform some processing before calling the following Triclops SDK function:

triclopsRectifyColorImage(   triclops, TriCam_REFERENCE, &colorData, &colorImage );

The "colorData" variable is a pointer to a TriclopsInput structure that contains the raw color image. Refer to the grabstereo.cpp example in the latest Triclops SDK for an example of how to use the extractImagesColor() function to obtain pointers to the buffers that contains the raw color images.

The color TriclopsInput has data in only 2 formats:

    • 32-bit packed (with an unused byte in there since it is a 24-bit image); or
    • Planar (i.e. independent red, green, and blue buffers).

Since extractImagesColor() returns a a 24-bit packed image by default, users must make some changes:

    • Modify the libdc1394 extractImagesColor code (from utils/stereohelper.cpp) to fill in the red and blue buffers in addition to the green buffer.
    • Change the call dc1394_deinterlace_green() to _deinterlace_rgb() and provide 3 buffers as input, not just 1.

You can then create the TriclopsInput for the call to triclopsRectifyColorImage() by calling:

TriclopsInput colorData;

colorData = input;

The "input" variable is the input returned by extractImagesColor() for stereo (all the fields such as nrows, ncols, rowinc, inputType will be the same for this input).

Then call:

colorData.u.rgb.red = (your red buffer)

colorData.u.rgb.green = (your green buffer)

colorData.u.rgb.blue = (your blue buffer)

Once this is done, you can pass the input into triclopsRectifyColorImage().

Related Articles