Shape correction#

Shape corrections change the geometry of the pixel container – dewarping lens curvature, straightening perspective, aligning frames that have shifted. They derive from BaseCorrection and are usually passed to imread() via transformations=.

CurvatureCorrection

crop and dewarp to the four rig corners; the workhorse for wide-angle FluidFlower photos

AffineCorrection

affine map from matched point pairs

GeneralizedPerspectiveCorrection

perspective / homography, incl. piecewise

DriftCorrection

compensate small frame-to-frame camera drift using a fixed reference patch

DeformationCorrection

apply a known displacement field

TranslationCorrection

pure translation; TranslationEstimator finds it from image features

RotationCorrection

rigid rotation

ResizeCorrection

rescale (also available as resize() / Resize)

import json, darsia

cfg = json.load(open("config.json"))
curvature = darsia.CurvatureCorrection(config=cfg["curvature"])

photo = darsia.imread("photo.jpg", transformations=[curvature],
                      width=2.8, height=1.5)

The stand-alone transforms (AffineTransformation, GeneralizedPerspectiveTransformation, PiecewisePerspectiveTransform) can also be used directly on arrays of points.

Note

Shape corrections change pixels and keep the physical metadata consistent. To align two images by editing only their metadata, use CoordinateTransformation (see Coordinate systems).

See also#