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=.
crop and dewarp to the four rig corners; the workhorse for wide-angle FluidFlower photos |
|
affine map from matched point pairs |
|
perspective / homography, incl. piecewise |
|
compensate small frame-to-frame camera drift using a fixed reference patch |
|
apply a known displacement field |
|
pure translation; |
|
rigid rotation |
|
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#
Image registration – recovering an unknown deformation between images