Skip to content

pvphan/camera-calibration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camera Calibration using Zhang's Method

Build Status

A simple Python library for calibrating camera intrinsics from sensor (2D) and model point (3D) correspondences. Written with few external dependencies (numpy, sympy, imageio) for a more manual implementation and a deeper understanding. OpenCV is imported only for debug and sanity checking implementation. Non-linear optimization is done through minimizing projection error and computing partial derivatives with sympy to populate the Jacobian matrix. Generates synthetic datasets for testing and rudimentary visualization. Can animate the reprojection error each iteration of the calibration. Dockerized for convenience of development, testing, and maybe deployment. Supports radial-tangential (k1, k2, p1, p2, k3) and fisheye (k1, k2, k3, k4) distortion models.

Does not include any feature detection for sensor points. Takes sets of points as inputs, not images.

Prerequisites: make, docker

Getting started

If you'd like to try out the code:

  • Clone the repo and cd into it
  • (Modify code if desired)
  • $ make test

Animated reprojection

This is an example of the reprojection animation of a calibration on a checkerboard, showing all views simultaneously (see animate.py).

  • Green: the measured points
  • Magenta: the reprojection of the model points

reprojection animation

Maybe later:

  • Fix bug in distortion when projecting points outside of field of view

References: