darsia.RelativeColorCorrection#
- class RelativeColorCorrection(baseline=None, images=None, config=None)[source]#
Bases:
BaseCorrectionRelative color correction based on global analysis.
Methods
Calibrate the color correction based on the samples and reference colors.
correct_array(img)Rescale an array using heterogeneous color correction.
correct_metadata([metadata])Correction routine on metadata level.
Set the correction method.
Define reference color for calibration.
Define similar and reference colors for calibration.
Define similar colors for calibration.
load(path)Load the linear approximation incl.
save(path)Save the linear approximation incl.
setup()Setup the color correction based on the baseline image.
Attributes
Baseline image.
Calibration images.
Configuration dictionary.
Color correction as linear approximation.
Samples and colors for calibration.
Reference colors for calibration.
- calibrate()[source]#
Calibrate the color correction based on the samples and reference colors.
A least-squares problem is solved to find the optimal coefficients.
- correct_array(img)[source]#
Rescale an array using heterogeneous color correction.
- Parameters:
- img
np.ndarray Input image.
- img
- Returns:
np.ndarrayCorrected image.
- define_correction()[source]#
Set the correction method.
- Returns:
darsia.LinearApproximationLinear approximation for color correction.
- define_reference_color()[source]#
Define reference color for calibration.
Use an interactive assistant to select a reference color. Only the first image is considered for now.
- define_similar_and_reference_colors_tensorial()[source]#
Define similar and reference colors for calibration.
Use an interactive assistant to select similar colors and a reference color. A 2-stage procedure is used to select similar colors. First, a grid of distinct colors is selected. Second, a set of grid of the same colors through the entire image is selected. Tensorial fill-in is used to extract all similar colors. As reference colors, the selected colors from stage 1 are used.
- define_similar_colors()[source]#
Define similar colors for calibration.
Use an interactive assistant to select similar colors for each calibration image.
- baseline#
Baseline image.
- calibration_images#
Calibration images.
- config#
Configuration dictionary.
- correction#
Color correction as linear approximation.
- data#
Samples and colors for calibration.
- reference_data#
Reference colors for calibration.