This script creates bilinear parameters for fast stereo image rectification and determines the calibration data
with several stereo checkerboard image pairs in an easy way.
The parameters are reduced to get the largest rectangular image pairs with only valid pixel values
and are sorted in the way images are read in (First pixels of first row, then pixels of 2nd row etc.).
The bilinear parameters are placed in matrices. The rectification of distorted images is done
by simple matrix multiplications and additions.
This results in much faster image rectification.
The script works only in conjunction with the Matlab Computer Vision System Toolbox.
Tested with Matlab R2016a.
0.) Take approx. 15 stereo pictures from a checker board.
Name left and right images similar (e.g. left01.tif, right01.tif)
Place the left in an empty folder. Place right images into another folder.
Hint: Put '_Xmm' at the end of the folder name. X is the square size in mm.
Not mandatory, helps to fill out GUI.
Follow the steps 1.) to 3.) in the GUI.
4.) In step 4.): Select the desired precision for the bilinear parameters.
Double is recommended for use in Matlab only.
Uint8 is suitable for most cases, especially with FPGA.
Uint8 produces a few intensity errors of +- 1.
Uint16 is like uint8, but with even less intensity errors.
Nearest neighbor has many intensity errors, is very fast for rectifying.
5a.) OR 5b.) Run and follow instructions in message box.
6.) Compares the rectification speeds.
7.) Compares the intensity errors according to 4.)
Outputs of this script are matrices with bilinear parameters for the largest image rectangle
which contains only image pixels.
You find the matrices in in the folder 'Parameters'. E.g. the mat-file for double precision is
Process to rectify images:
You will find all examples in 'compareRectificationSpeed.m'.
Select folders 1.) LeftImages and 2.) RightImages
Click on 5b.)
Some files out of "Camera Calibration Toolbox for Matlab" by Jean-Yves Bouguet
(http://www.vision.caltech.edu/bouguetj/calib_doc/) are implemented and altered slightly.
Peter Seibold (2021). Creating matrices for fast rectification of stereo images (https://www.mathworks.com/matlabcentral/fileexchange/62827-creating-matrices-for-fast-rectification-of-stereo-images), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!