(Dis)tortion (Cor)rection (Py)thon-package
Camera calibration and distortion correction software for lens-based detector systems
Discorpy is an open-source Python package designed for camera calibration and distortion correction with sub-pixel accuracy. It calculates parameters of correction models using a grid pattern image. Primarily, the package implements methods published in Optics Express and offers a comprehensive pipeline for data processing. Starting from version 1.4, the package also includes perspective distortion correction capabilities.
Author and maintainer: Nghia Vo, NSLS-II, Brookhaven National Laboratory, US; Diamond Light Source, UK.
Detailed step-by-step demonstrations featuring codes and explanations of how to use Discorpy for various types of calibration images are shown here.
Apply to a visible dot-target collected at Beamline I12, Diamond Light Source, UK:
Apply to an X-ray dot-target collected at Beamline I13, Diamond Light Source, UK:
Improvement of tomographic reconstructed images after distortion correction:
Calibrate a commercial camera with capabilities of correcting radial distortion and perspective distortion independently.
Calibrate a laptop webcam using a checkboard image.
Apply to a hazard camera of the Mars Perseverance Rover. Details of how to estimate distortion coefficients of that camera without using a calibration target are shown here.
Correct perspective distortion: