Skip to main content

Correction for radial distortion and perspective distortion in Python

Project description

Discorpy

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

Distortion calibration and correction software for lens-based detector systems

Discorpy is an open-source Python package for distortion correction with sub-pixel accuracy as required by tomography detector systems. It calculates parameters of correction models using a grid pattern image. The package implements methods published by Nghia T. Vo et al. "Radial lens distortion correction with sub-pixel accuracy for X-ray micro- tomography," Optics Express, 23, 32859-32868 (2015), https://doi.org/10.1364/OE.23.032859. From version 1.4, correction for perspective distortion has been added to the package.

Author: Nghia Vo, Diamond Light Source, UK.

Update notes

Features

  • Pre-processing methods for: extracting reference-points from a dot-pattern image, line-pattern image, and chessboard 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: undistorting 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:
    • Correct non-uniform background using a FFT-based filter and a median filter.
    • Select binary objects in a certain range of values.
    • Unwarp slices of a 3D dataset.

Documentation

Installation

How to use

Demonstrations

  • 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 a tomographic reconstructed image after distortion correction.

    • Before the correction:

      tomo_before

    • After the correction:

      tomo_before

  • 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

    Mars_rover

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discorpy-1.4.0.tar.gz (26.9 kB view hashes)

Uploaded Source

Built Distributions

discorpy-1.4.0-py3-none-any.whl (31.0 kB view hashes)

Uploaded Python 3

discorpy-1.4-py3-none-any.whl (31.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page