darsia.ColorCorrection#
- class ColorCorrection(base=None, config=None)[source]#
Bases:
BaseCorrectionColor correction with user-specified location of a color checker.
Precise user-input is required for detecting the color checker. The Calibrite/ X-rite color checker has four corner landmarks on the colorchecker. The pixel coordinates of these have to be provided as input parameters, starting with the corner close to the brown swatch, and continuing in counter-clockwise direction. The color correction is applied prior to curvature correction in the darsia.Image initialization, and therefore, the roi should be with respect to the uncorrected image.
Set up all data needed for fast colour conversion.
- Parameters:
- base
darsia.ImageorColorChecker,optional Reference defining a colour checker; if None, a
CustomColorCheckeris used.- config
dict,optional Configuration. Recognised keys:
roi (tuple of slices | ndarray | None) ROI containing the colour checker, as intervals or corner points; an array of coordinates is recommended. whitebalancing (bool) default True; white-balance on the third bottom-left swatch verbosity (bool) display the extracted ROIs and swatch colours (debugging)
- base
Methods
correct_array(img)Similar workflow as by colour-science to match the colors of the color checker with the corresponding reference values, but tailored and simplified, based on the precise user-input on the location of the color checker.
correct_metadata([metadata])Correction routine on metadata level.
load(path)Load the color correction from a file.
save(path)Save the color correction to a file.
write_config_to_file(path)Writes the config dictionary to a json-file.
Attributes
Config dictionary for initialization of color correction.
- correct_array(img)[source]#
Similar workflow as by colour-science to match the colors of the color checker with the corresponding reference values, but tailored and simplified, based on the precise user-input on the location of the color checker. Reference to the general workflow: colour-science/colour-checker-detection
- Parameters:
- img
np.ndarray Image in RGB space, with values in uint8, uint16, float32, or float64.
- img
- Returns:
np.ndarrayCorrected image.
- write_config_to_file(path)[source]#
Writes the config dictionary to a json-file.
- Parameters:
- path
Path Path to the json file.
- path
- config#
Config dictionary for initialization of color correction.