Discorpy is an open-source Python package for correcting radial distortion with sub-pixel accuracy as required by tomography detector systems [C1]. It is used to calculate parameters of a correction model, which are the center of distortion and the polynomial coefficients, using a grid pattern image. From version 1.4, perspective distortion correction and methods for processing line-pattern and chessboard (checkerboard) images were added to the package.
A key feature of Discorpy is that radial distortion, the center of distortion, and perspective distortion are determined and corrected independently using a single calibration image. Discorpy was developed for calibrating lens-coupled detectors of tomography systems but it also can be used for commercial cameras.
Source code: https://github.com/DiamondLightSource/discorpy
Author: Nghia T. Vo - NSLS-II, Brookhaven National Laboratory, US; Diamond Light Source, UK.
Keywords: Camera calibration, radial lens distortion, perspective distortion, distortion correction, tomography.
- 1. Installation
- 2. Tutorials
- 2.1. Causes of distortion
- 2.2. Methods for correcting distortions
- 2.2.1. Introduction
- 2.2.2. Extracting reference-points from a calibration image
- 2.2.3. Grouping reference-points into horizontal lines and vertical lines
- 2.2.4. Calculating the optical center of radial distortion
- 2.2.5. Correcting perspective effect
- 2.2.6. Calculating coefficients of a polynomial model for radial-distortion correction
- 2.2.7. Calculating coefficients of a correction model for perspective distortion
- 2.2.8. Correcting a distorted image
- 2.2.9. Summary
- 3. Usage
- 3.1. Resources
- 3.2. Notes related to Python programming
- 3.3. Demonstrations
- 3.3.1. Process a high-quality calibration image
- 3.3.2. Process an X-ray target image having perspective effect
- 3.3.3. Process a challenging X-ray target image
- 3.3.4. Process a line-pattern image
- 3.3.5. Correct both radial distortion and perspective distortion
- 3.3.6. Calibrate a camera using a chessboard image
- 3.3.7. Correct perspective distortion
- 3.3.8. Correct radial distortion of an image without using a calibration target
- 3.3.9. Useful tips
- 4. API reference
- 5. Credit