Skip to content

Latest commit

 

History

History
executable file
·
118 lines (84 loc) · 7.64 KB

README.md

File metadata and controls

executable file
·
118 lines (84 loc) · 7.64 KB

Discorpy

(Dis)tortion (Cor)rection (Py)thon-package

Camera calibration and distortion correction software for lens-based detector systems

GitHub Workflow Status Downloads former_vounwarp_downloads Anaconda-Server Badge Documentation Status Anaconda-Server Badge GitHub code size in bytes Anaconda-Server Badge Coverage

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.

Features

  • The polynomial model used by the package is versatile enough to calibrate images with varying levels of radial distortion. This practical feature eliminates the need for users to switch between different models based on the degree of distortion in the images.
  • Discorpy offers a unique feature where radial distortion, the center of distortion, and perspective distortion can be independently determined and corrected using a single calibration image.
  • The software provides a full pipeline of data processing including:
    • Pre-processing methods for: extracting reference-points from a dot-pattern image, line-pattern image, and chessboard (checkerboard) image; grouping these points line-by-line.
    • Processing methods for calculating the optical center, coefficients of polynomial models for correcting radial distortion, and parameters of a model for correcting perspective distortion.
    • Post-processing methods for: unwarping lines of points, images, or slices of a 3D dataset; and evaluating the accuracy of the correction results.
    • Some methods may be useful for other applications:

Installation

Documentation

Usage

Demonstrations

  • 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:

    I12_before_after1

    I12_before_after2

  • Apply to an X-ray dot-target collected at Beamline I13, Diamond Light Source, UK:

    I13_before_after1

    I13_before_after2

  • Improvement of tomographic reconstructed images after distortion correction:

    • For a detector with strong radial distortion:

      tomo_strong

    • For a detector with small radial distortion:

      tomo_small

  • Calibrate a commercial camera with capabilities of correcting radial distortion and perspective distortion independently.

    show_case

  • Calibrate a laptop webcam using a checkboard image.

    webcam_before

    webcam_after

  • 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.

    Percy_cam1

    Percy_cam2

  • Correct perspective distortion:

    perspective_correction