Skip to content

Aramist/camera-calibration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fisheye calibration

Removes fisheye distortion.

Description

Contains two scripts, calibrate.py and undistort.py, which respectively handle calibration of the camera over a set of training images and post-calibration transformations of any images or videos captured by the same camera to remove fisheye distortion.

Getting Started

Dependencies

  • Python 3, OpenCV 3, NumPy
python3 -m pip install opencv-python, numpy

Installing

  • Ensure all prerequisites are installed
  • Clone the repository:
git clone https://github.com/Aramist/camera-calibration

Executing program

  • Print a checkerboard pattern onto a sheet of paper and affix it to a flat surface. Take note of its width and height.
  • Produce a set of calibration images, 20 is more than sufficient. Try to capture the checkerboard pattern from multiple angles and positions
  • Move the calibration images into a single folder, calibration_images in the sample execution below, and run calibrate.py with the board_width and board_height parameters equal to the width and height (in tiles) of the board minus 1[1]
  • To verify the calibration, try running undistort.py over the entire calibration image directory (line 3 of the sample execution below). If the results look strange, double-check the order of the board size parameters and consider removing some training images taken from ambiguous perspectives.
  • Once you have a good calibration, the undistort.py script can be used to transform individual images and videos or entire directories of images and videos. Sample execution:
python3 calibrate.py --board_width 8 --board_height 6 calibration_images camera_params
python3 undistort.py camera_params distorted_video.avi undistorted_video.avi
python3 undistort.py camera_params calibration_images undistorted_media

Notes

Only .avi files can be written

Authors

Aramis Tanelus

Version History

  • 0.1
    • Initial Release

Acknowledgments

Inspiration, code snippets, etc.

[1] The board_width and board_height don't actually refer to the tiles, but to the matrix of points formed by the intersections of the lines running horizontally and vertically between the tiles. This does not include the points along the edge of the board, so the width and height of this matrix ends up being that of the board minus one in each dimension.

About

Calibration for fisheye distortion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages