Table of Contents

Class ColorCorrectionModel

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Core class of the color correction model (ccm). Produces a ColorCorrectionModel instance for inference.

public class ColorCorrectionModel : CvObject, IDisposable
Inheritance
ColorCorrectionModel
Implements
Inherited Members

Constructors

ColorCorrectionModel()

The default constructor.

ColorCorrectionModel(InputArray, ColorCheckerType)

Color Correction Model, initialized from a built-in color card.

ColorCorrectionModel(InputArray, InputArray, ColorSpace)

Color Correction Model, initialized from explicit reference color values.

ColorCorrectionModel(InputArray, InputArray, ColorSpace, InputArray)

Color Correction Model, initialized from explicit reference color values and a colored-patches mask.

Methods

Compute()

Makes the color correction, fitting the CCM to the configured reference colors.

CorrectImage(InputArray, OutputArray, bool)

Applies color correction to the input image using the fitted color correction matrix. The conventional ranges for R, G, and B channel values are 0 to 255 for CV_8U images, 0 to 65535 for CV_16U images, and 0 to 1 for CV_32F images.

DisposeUnmanaged()

Releases unmanaged resources

GetColorCorrectionMatrix()

Gets the fitted color correction matrix.

GetLoss()

Gets the loss of the fitted color correction matrix.

GetMask()

Gets the mask of the patches used during fitting.

GetRefLinearRGB()

Gets the linearized reference RGB values used during fitting.

GetSrcLinearRGB()

Gets the linearized source RGB values used during fitting.

GetWeights()

Gets the weights of each color used during fitting.

Read(FileNode)

Reads this color correction model from a file node.

SetCcmType(CcmType)

Sets the shape of the color correction matrix (CCM). Default: CcmType.Linear.

SetColorSpace(ColorSpace)

Sets the absolute color space that detected colors convert to. It should be some RGB color space. Default: ColorSpace.SRGB.

SetDistance(DistanceType)

Sets the type of color distance. Default: DistanceType.CIE2000.

SetEpsilon(double)

Sets the terminal criteria epsilon used in MinProblemSolver-DownhillSolver. Default: 1e-4.

SetInitialMethod(InitialMethodType)

Sets the method of calculating the CCM initial value. Default: InitialMethodType.LeastSquare.

SetLinearization(LinearizationType)

Sets the method of linearization. Default: LinearizationType.Gamma.

SetLinearizationDegree(int)

Sets the degree of the linearization polynomial. Only valid when linearization is set to ColorPolyFit, GrayPolyFit, ColorLogPolyFit, or GrayLogPolyFit. Default: 3.

SetLinearizationGamma(double)

Sets the gamma value of gamma correction. Only valid when linearization is set to Gamma. Default: 2.2.

SetMaxCount(int)

Sets the terminal criteria max count used in MinProblemSolver-DownhillSolver. Default: 5000.

SetRGB(bool)

Sets whether the input image is in RGB color space.

SetSaturatedThreshold(double, double)

Sets the saturation threshold. The colors in the closed interval [lower, upper] are reserved to participate in the calculation of the loss function and initialization parameters.

SetWeightCoeff(double)

Sets the exponent number of the L* component of the reference color in CIE Lab color space. Default: 0.

SetWeightsList(Mat)

Sets the list of weights of each color. Default: empty array.

Write(FileStorage)

Stores this color correction model in a file storage.