Skip to content

stereo rectification/calibration from almost^^ scatch

Notifications You must be signed in to change notification settings

xmba15/stereo_calibration

Repository files navigation

📝 Stereo Rectification/Calibration from almost^^ scatch


This repository implements algorithms for stereo rectification/calibration using checkerboard patterns with the following procedures:

  • estimate rectified homographies for left and right images using combination of uncalibrated methods of Hartley and Loop&Zhang's.

  • estimate the remapping tables for undistortion. This requires each of the cameras' intrinsic parameters, which is out of scope of this repository. Therefore, opencv's functions are used for calculating monocular camera intrinsic matrix and distortion coefficients.

  • this repository is for pure interest of better understanding of stereo calibration's mechanism/algorithms, so might not be suitable for production purpose.

Sample Result Images


  • rectification without undistortion

rectified_distorted

  • rectification with undistortion

rectified_undistorted

🎉 TODO


  • estimation of fundamental matrix by eight-point algorithm, and refinement by gold-standard algorithm
  • estimation of uncalibrated rectification homographies based on combination of Hartley and Loop&Zhang's methods.
  • test on calibration board dataset

🎛 Dependencies


  • from debian
sudo apt-get install \
    libopencv-dev \
    rapidjson-dev \

🔨 How to Build


# build the lib
make default

# build examples
make apps

🏃 How to Run


  • Download sample calibration data from HERE. This is modified version of The EuRoC MAV Dataset (custom calibration).

  • Uncompress the data

tar -xf ./data/calibration_data.tar.xz -C ./data/
  • Each monocular camera (left/right) has been calibrated separately, and the intrinsic calibration params can be seen in ./data/calibration/left(right)_calib_params.yml. You can also test the simple monocular camera calibration app in examples after build by:
./build/examples/mono_cam_intrinsic_calib ./data/calibration_data/left_param_config.json ./left_calib_params.yml

# or
./build/examples/mono_cam_intrinsic_calib ./data/calibration_data/right_param_config.json ./right_calib_params.yml
  • Run stereo rectification app (that does estimation of fundamental matrix and image rectification)
./build/examples/stereo_rectification_app ./data/stereo_param_config.json ./data/sample_left.png ./data/sample_right.png

💎 References


  1. Computing Rectifying Homographies for Stereo Vision, CVPR 1999
  2. Determining the Epipolar Geometry and its Uncertainty: A Review
  3. A “Loop and Zhang” Reader for Stereo Rectification
  4. Multiple View Geometry in Computer Vision
  5. Machine Vision Toolbox Matlab
  6. CS231A Course Notes 3: Epipolar Geometry