Class ColorCorrectionModel
java.lang.Object
org.opencv.photo.ColorCorrectionModel
Core class of ccm model
Produce a ColorCorrectionModel instance for inference
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedColorCorrectionModel(long addr) ColorCorrectionModel(Mat src, int constColor) Color Correction Model Supported list of color cards: REF: COLORCHECKER_MACBETH, the Macbeth ColorChecker REF: COLORCHECKER_VINYL, the DKK ColorChecker REF: COLORCHECKER_DIGITAL_SG, the DigitalSG ColorChecker with 140 squares -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorCorrectionModel__fromPtr__(long addr) compute()make color correctionvoidcorrectImage(Mat src, Mat dst) Applies color correction to the input image using a fitted color correction matrix.voidcorrectImage(Mat src, Mat dst, boolean islinear) Applies color correction to the input image using a fitted color correction matrix.doublegetLoss()getMask()longvoidsetEpsilon(double epsilon) set EpsilonvoidsetLinearizationDegree(int deg) set degree Note: only valid when linear is set to REF: LINEARIZATION_COLORPOLYFIT REF: LINEARIZATION_GRAYPOLYFIT REF: LINEARIZATION_COLORLOGPOLYFIT REF: LINEARIZATION_GRAYLOGPOLYFITvoidsetLinearizationGamma(double gamma) set Gamma Note: only valid when linear is set to "gamma";voidsetMaxCount(int maxCount) set MaxCountvoidsetRGB(boolean rgb) Set whether the input image is in RGB color spacevoidsetSaturatedThreshold(double lower, double upper) set SaturatedThreshold.voidsetWeightCoeff(double weightsCoeff) set WeightCoeffvoidsetWeightsList(Mat weightsList) set WeightsList
-
Field Details
-
nativeObj
protected final long nativeObj
-
-
Constructor Details
-
ColorCorrectionModel
protected ColorCorrectionModel(long addr) -
ColorCorrectionModel
public ColorCorrectionModel() -
ColorCorrectionModel
Color Correction Model Supported list of color cards:- REF: COLORCHECKER_MACBETH, the Macbeth ColorChecker
- REF: COLORCHECKER_VINYL, the DKK ColorChecker
- REF: COLORCHECKER_DIGITAL_SG, the DigitalSG ColorChecker with 140 squares
- Parameters:
src- detected colors of ColorChecker patches; the color type is RGB not BGR, and the color values are in [0, 1];constColor- the Built-in color card
-
-
Method Details
-
getNativeObjAddr
public long getNativeObjAddr() -
__fromPtr__
-
setLinearizationGamma
public void setLinearizationGamma(double gamma) set Gamma Note: only valid when linear is set to "gamma";- Parameters:
gamma- the gamma value of gamma correction; default: 2.2;
-
setLinearizationDegree
public void setLinearizationDegree(int deg) set degree Note: only valid when linear is set to- REF: LINEARIZATION_COLORPOLYFIT
- REF: LINEARIZATION_GRAYPOLYFIT
- REF: LINEARIZATION_COLORLOGPOLYFIT
- REF: LINEARIZATION_GRAYLOGPOLYFIT
- Parameters:
deg- the degree of linearization polynomial default: 3
-
setSaturatedThreshold
public void setSaturatedThreshold(double lower, double upper) set SaturatedThreshold. The colors in the closed interval [lower, upper] are reserved to participate in the calculation of the loss function and initialization parameters- Parameters:
lower- the lower threshold to determine saturation; default: 0;upper- the upper threshold to determine saturation; default: 0
-
setWeightsList
set WeightsList- Parameters:
weightsList- the list of weight of each color; default: empty array
-
setWeightCoeff
public void setWeightCoeff(double weightsCoeff) set WeightCoeff- Parameters:
weightsCoeff- the exponent number of L* component of the reference color in CIE Lab color space; default: 0
-
setMaxCount
public void setMaxCount(int maxCount) set MaxCount- Parameters:
maxCount- used in MinProblemSolver-DownhillSolver; Terminal criteria to the algorithm; default: 5000;
-
setEpsilon
public void setEpsilon(double epsilon) set Epsilon- Parameters:
epsilon- used in MinProblemSolver-DownhillSolver; Terminal criteria to the algorithm; default: 1e-4;
-
setRGB
public void setRGB(boolean rgb) Set whether the input image is in RGB color space- Parameters:
rgb- If true, the model expects input images in RGB format. If false, input is assumed to be in BGR (default).
-
compute
-
getColorCorrectionMatrix
-
getLoss
public double getLoss() -
getSrcLinearRGB
-
getRefLinearRGB
-
getMask
-
getWeights
-
correctImage
Applies color correction to the input image using a 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
- 0 to 1 for CV_32F images
- Parameters:
src- Input 8-bit, 16-bit unsigned or 32-bit float 3-channel image..dst- Output image of the same size and datatype as src.islinear- default false.
-
correctImage
Applies color correction to the input image using a 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
- 0 to 1 for CV_32F images
- Parameters:
src- Input 8-bit, 16-bit unsigned or 32-bit float 3-channel image..dst- Output image of the same size and datatype as src.
-