Corrections#

Corrections are callables that take an Image and return a corrected Image. Colour corrections calibrate recorded colours against a colour checker or reference illumination; shape corrections change the geometry of the data container (curvature, perspective, drift, deformation). All of them derive from BaseCorrection and can be passed to imread() to run during reading.

Base#

BaseCorrection()

Abstract base correction, providing template for tailored corrections.

TypeCorrection([data_type])

Correction to convert image to a specified data type.

read_correction(path)

General function to read corrections from a file.

Colour correction#

With a known or approximately known colour-checker location, recorded colours are matched to reference values.

ColorCorrection([base, config])

Color correction with user-specified location of a color checker.

ColorChecker()

Base class for color checkers.

ColorCheckerAfter2014()

Definition of the classic color checker under (hardcoded) default illumination conditions.

CustomColorChecker([reference_colors, ...])

Swatch colors determined from user-prescribed input image.

ClassicColorChecker()

Definition of the classic color checker under default illumination conditions.

find_colorchecker(img, strategy[, update])

Detect colorchecker in corner.

RelativeColorCorrection([baseline, images, ...])

Relative color correction based on global analysis.

Illumination correction#

IlluminationCorrection()

Class for illumination correction.

PatchwiseIlluminationCorrection([...])

Class for performing patchwise illumination correction on images.

DynamicIlluminationCorrection()

Class for illumination correction.

Colour balance#

ColorBalance()

Class for finding and applying a linear color balance.

WhiteBalance()

Class for finding and applying a diagional linear balance.

AffineBalance()

Class for finding and applying a general affine balance.

AdaptiveBalance()

Affine colour balance whose scaling and translation adapt to the data.

color_balance(img, swatches_src, swatches_dst)

Apply the color balance to an image.

white_balance(img, swatches_src, swatches_dst)

Apply the color balance to an image.

affine_balance(img, swatches_src, swatches_dst)

Apply the color balance to an image.

Shape correction#

CurvatureCorrection([config])

Polynomial curvature correction.

AffineCorrection(coordinatesystem_src, ...)

Affine correction (translation, scaling, rotation).

GeneralizedPerspectiveCorrection(...[, ...])

Class for applying generalized perspective transformation to images.

DriftCorrection([base, config])

Class for drift correction of images wrt.

DeformationCorrection(base, config)

Patch-wise defined deformation correction defined through image registration.

TranslationCorrection([translation])

Translation correction based on user-input global translation.

RotationCorrection(anchor, **kwargs)

Rotation correction.

ResizeCorrection([ref_image, shape, fx, fy, ...])

Shape correction wrapping darsia.Resize to fit the BaseCorrection interface.

TransformationCorrection(...)

Class for applying a transformation to an image as correction.

Stand-alone transformations#

AffineTransformation(dim)

Affine map, restricted to translation, scaling, rotation, resulting in conservation of angles.

GeneralizedPerspectiveTransformation()

Combination of perspective map, bulge and stretch for 2d images.

PiecewisePerspectiveTransform(**kwargs)

Globally constant, patch-wise defined perspective transform.

TranslationEstimator([max_features, tol, ...])

Estimator of translation to align images based on feature detection.

Advanced#

BaseBalance()

Base class for finding and applying a color/white balance.

BaseTransformation()

Base class for geometrical transformations of images.

EOTF()

Electro-optical transfer function (EOTF),the standard transfer function for sRGB, cf.

ExperimentalColorCorrection([config, roi, ...])

Colour correction that locates the colour checker automatically.

load_curvature_correction_config_from_dict(sec)

Load curvature correction config from a dictionary.

load_curvature_correction_config_from_toml(path)

Load curvature correction config from a toml file.