How to obtain rectified images from a stereo camera without using the Triclops SDK

Last Revision Date: 4/18/2016

This article explains how to obtain rectified images from a stereo camera on a system that does not support using the Triclops SDK. 

 

ANSWER:

The Triclops SDK can generate a rectified image from the left and right images of our stereo camera. The steps are as follows: 

    1. On a Triclops-supported system, grab a single image in Format_7 Mode 3 from the stereo camera. This produces a raw 16-bit image that is byte-interleaved. This means that for each pixel, the upper byte is generated from the right image, and the lower byte is generated from the left image. To generate separate images, your program must then de-interleave the images.
    2. On the same system, re-map the pixels from the left and right images to their corresponding locations in the rectified image. To do this, your program must:
          a) Load the calibration data for the camera into the Triclops library.
          b) Set your output stereo resolution by calling triclopsSetResolutionAndPrepare().
          c) Use method triclopsUnrectifyPixel() to generate mapping tables between the raw images and the rectified image. The script would look something like this:

      float remap[nrows][ncols][2][2];
      for ( int r = 0; r < nrows; r++ )
      {
      for ( int c = 0; c < ncols; c++ )
      {
      float rawr, rawc;
      // Of course you should perform error checking.
      triclopsUnrectifyPixel( triclops, TriCam_RIGHT, r, c, &rawr, &rawc );
      remap[r][c][0][0] = rawr;
      remap[r][c][0][1] = rawc;
      triclopsUnrectifyPixel( triclops, TriCam_LEFT, r, c, &rawr, &rawc );
      remap[r][c][1][0] = rawr;
      remap[r][c][1][1] = rawc;
      }


    3.  Generate a file containing the mapping object, in a format of your choosing. 

    4. Load the mapping file into your target system and use it to rectify multiple images. To generate rectified images, look up the rawr,rawc index value for each pixel of each image, and calculate the value in the specified location in the rectified image. For speed, you can calculate to the nearest integer. Or, you can perform bilinear interpolation.
Zugehörige Artikel