Rectifying stereo images

1. Theory

(Write me!)

See also the documentation from Willow Garage's OpenCV for cv::stereoRectify()

The following video (view on YouTube) illustrates the effects of each of these parameters:

 

2. In practice: step by step procedure with MRPT

See docs for the class: mrpt::vision::CStereoRectifyMap

 

3. Example C++ code

mrpt::vision::CStereoRectifyMap   rectify_map;
// Set options as desired:
// rectify_map.setAlpha(...);
// rectify_map.enableBothCentersCoincide(...); 

while (true) {
  // Grab stereo observation from wherever
  mrpt::slam::CObservationStereoImagesPtr obs_stereo = ... 

  // Only once, construct the rectification maps:
  if (!rectify_map.isSet()) 
    rectify_map.setFromCamParams(*obs_stereo);

  // Rectify in place:
  unmap.rectify(*obs_stereo);
  // Rectified images are now in: obs_stereo->imageLeft & obs_stereo->imageRight
}

 

4. A complete example

See the example: <MRPT>/samples/stereoRectify

Syndicate content

The Mobile Robot Programming Toolkit (MRPT) initiative (C) 2012