Colour correction#
Cameras and lighting distort recorded colour. Because DarSIA turns colour changes into physical quantities, calibrating colour against a known reference is usually the first correction in a pipeline.
Colour-checker correction#
ColorCorrection matches the swatches of a Classic X-Rite colour checker
visible in the image to their reference values and applies the resulting
transform to the whole frame.
import darsia
base = darsia.imread("baseline.jpg", width=2.8, height=1.5)
# give the pixel coordinates of the four white L-marks on the chart
cfg = {"roi": darsia.make_voxel([[154, 176], [222, 176], [222, 68], [154, 68]])}
cc = darsia.ColorCorrection(base=base, config=cfg)
corrected = darsia.imread("test.jpg", transformations=[cc], width=2.8, height=1.5)
ColorChecker,ColorCheckerAfter2014,ClassicColorChecker,CustomColorChecker– reference charts.ExperimentalColorCorrection– locates the chart automatically with a machine-learning detector; convenient, less robust on high-resolution images.RelativeColorCorrection– calibrate one image relative to another rather than to an absolute standard.
Colour balance#
When there is no chart, WhiteBalance, ColorBalance,
AffineBalance and AdaptiveBalance (and the function forms
white_balance(), color_balance(), affine_balance()) correct a
global cast from a neutral reference region.
See also#
Illumination correction – spatially varying lighting