View Source Evision.CCM.ColorCorrectionModel (Evision v1.0.0-rc.0)

Summary

Types

t()

Type that represents an CCM.ColorCorrectionModel struct.

Functions

ColorCorrectionModel

Color Correction Model

make color correction

Applies color correction to the input image using a fitted color correction matrix.

Applies color correction to the input image using a fitted color correction matrix.

getColorCorrectionMatrix

getRefLinearRGB

getSrcLinearRGB

set ColorSpace

Set whether the input image is in RGB color space

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

Types

@type t() :: %Evision.CCM.ColorCorrectionModel{ref: reference()}

Type that represents an CCM.ColorCorrectionModel struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec colorCorrectionModel() :: t() | {:error, String.t()}

ColorCorrectionModel

Return
  • self: ColorCorrectionModel

Python prototype (for reference only):

ColorCorrectionModel() -> <ccm_ColorCorrectionModel object>
Link to this function

colorCorrectionModel(named_args)

View Source
@spec colorCorrectionModel(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

colorCorrectionModel(src, constColor)

View Source
@spec colorCorrectionModel(Evision.Mat.maybe_mat_in(), integer()) ::
  t() | {:error, String.t()}

Color Correction Model

Positional Arguments
  • src: Evision.Mat.

    detected colors of ColorChecker patches; the color type is RGB not BGR, and the color values are in [0, 1];

  • constColor: integer().

    the Built-in color card

Return
  • self: ColorCorrectionModel

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

Python prototype (for reference only):

ColorCorrectionModel(src, constColor) -> <ccm_ColorCorrectionModel object>
Link to this function

colorCorrectionModel(src, colors, refColorSpace)

View Source
@spec colorCorrectionModel(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  Evision.CCM.ColorSpace.t()
) :: t() | {:error, String.t()}

Color Correction Model

Positional Arguments
  • src: Evision.Mat.

    detected colors of ColorChecker patches; the color type is RGB not BGR, and the color values are in [0, 1];

  • colors: Evision.Mat.

    the reference color values, the color values are in [0, 1].

  • refColorSpace: ColorSpace.

    the corresponding color space If the color type is some RGB, the format is RGB not BGR;

Return
  • self: ColorCorrectionModel

Python prototype (for reference only):

ColorCorrectionModel(src, colors, refColorSpace) -> <ccm_ColorCorrectionModel object>
Link to this function

colorCorrectionModel(src, colors, refColorSpace, coloredPatchesMask)

View Source
@spec colorCorrectionModel(
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  Evision.CCM.ColorSpace.t(),
  Evision.Mat.maybe_mat_in()
) :: t() | {:error, String.t()}

Color Correction Model

Positional Arguments
  • src: Evision.Mat.

    detected colors of ColorChecker patches; the color type is RGB not BGR, and the color values are in [0, 1];

  • colors: Evision.Mat.

    the reference color values, the color values are in [0, 1].

  • refColorSpace: ColorSpace.

    the corresponding color space If the color type is some RGB, the format is RGB not BGR;

  • coloredPatchesMask: Evision.Mat.

    binary mask indicating which patches are colored (non-gray) patches

Return
  • self: ColorCorrectionModel

Python prototype (for reference only):

ColorCorrectionModel(src, colors, refColorSpace, coloredPatchesMask) -> <ccm_ColorCorrectionModel object>
@spec compute(Keyword.t()) :: any() | {:error, String.t()}
@spec compute(t()) :: Evision.Mat.t() | {:error, String.t()}

make color correction

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

compute() -> retval
Link to this function

correctImage(named_args)

View Source
@spec correctImage(Keyword.t()) :: any() | {:error, String.t()}
@spec correctImage(t(), Evision.Mat.maybe_mat_in()) ::
  Evision.Mat.t() | {:error, String.t()}

Applies color correction to the input image using a fitted color correction matrix.

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • src: Evision.Mat.

    Input 8-bit, 16-bit unsigned or 32-bit float 3-channel image..

Keyword Arguments
  • islinear: bool.

    default false.

Return
  • dst: Evision.Mat.t().

    Output image of the same size and datatype as src.

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

Python prototype (for reference only):

correctImage(src[, dst[, islinear]]) -> dst
Link to this function

correctImage(self, src, opts)

View Source
@spec correctImage(t(), Evision.Mat.maybe_mat_in(), [{:islinear, term()}] | nil) ::
  Evision.Mat.t() | {:error, String.t()}

Applies color correction to the input image using a fitted color correction matrix.

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • src: Evision.Mat.

    Input 8-bit, 16-bit unsigned or 32-bit float 3-channel image..

Keyword Arguments
  • islinear: bool.

    default false.

Return
  • dst: Evision.Mat.t().

    Output image of the same size and datatype as src.

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

Python prototype (for reference only):

correctImage(src[, dst[, islinear]]) -> dst
Link to this function

getColorCorrectionMatrix(named_args)

View Source
@spec getColorCorrectionMatrix(Keyword.t()) :: any() | {:error, String.t()}
@spec getColorCorrectionMatrix(t()) :: Evision.Mat.t() | {:error, String.t()}

getColorCorrectionMatrix

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

getColorCorrectionMatrix() -> retval
@spec getLoss(Keyword.t()) :: any() | {:error, String.t()}
@spec getLoss(t()) :: number() | {:error, String.t()}

getLoss

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: double

Python prototype (for reference only):

getLoss() -> retval
@spec getMask(Keyword.t()) :: any() | {:error, String.t()}
@spec getMask(t()) :: Evision.Mat.t() | {:error, String.t()}

getMask

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

getMask() -> retval
Link to this function

getRefLinearRGB(named_args)

View Source
@spec getRefLinearRGB(Keyword.t()) :: any() | {:error, String.t()}
@spec getRefLinearRGB(t()) :: Evision.Mat.t() | {:error, String.t()}

getRefLinearRGB

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

getRefLinearRGB() -> retval
Link to this function

getSrcLinearRGB(named_args)

View Source
@spec getSrcLinearRGB(Keyword.t()) :: any() | {:error, String.t()}
@spec getSrcLinearRGB(t()) :: Evision.Mat.t() | {:error, String.t()}

getSrcLinearRGB

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

getSrcLinearRGB() -> retval
@spec getWeights(Keyword.t()) :: any() | {:error, String.t()}
@spec getWeights(t()) :: Evision.Mat.t() | {:error, String.t()}

getWeights

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()
Return
  • retval: Evision.Mat.t()

Python prototype (for reference only):

getWeights() -> retval
@spec read(Keyword.t()) :: any() | {:error, String.t()}
@spec read(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}

read

Positional Arguments

Python prototype (for reference only):

read(node) -> None
@spec setCcmType(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setCcmType(self, ccmType)

View Source
@spec setCcmType(t(), Evision.CCM.CcmType.t()) :: t() | {:error, String.t()}

set ccmType

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • ccmType: CcmType.

    the shape of color correction matrix(CCM); default: @ref CCM_LINEAR

Python prototype (for reference only):

setCcmType(ccmType) -> None
Link to this function

setColorSpace(named_args)

View Source
@spec setColorSpace(Keyword.t()) :: any() | {:error, String.t()}
@spec setColorSpace(t(), Evision.CCM.ColorSpace.t()) :: t() | {:error, String.t()}

set ColorSpace

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • cs: ColorSpace.

    the absolute color space that detected colors convert to; default: @ref COLOR_SPACE_SRGB

Note: It should be some RGB color space; Supported list of color cards:

  • @ref COLOR_SPACE_SRGB
  • @ref COLOR_SPACE_ADOBE_RGB
  • @ref COLOR_SPACE_WIDE_GAMUT_RGB
  • @ref COLOR_SPACE_PRO_PHOTO_RGB
  • @ref COLOR_SPACE_DCI_P3_RGB
  • @ref COLOR_SPACE_APPLE_RGB
  • @ref COLOR_SPACE_REC_709_RGB
  • @ref COLOR_SPACE_REC_2020_RGB

Python prototype (for reference only):

setColorSpace(cs) -> None
@spec setDistance(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setDistance(self, distance)

View Source
@spec setDistance(t(), Evision.CCM.DistanceType.t()) :: t() | {:error, String.t()}

set Distance

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • distance: DistanceType.

    the type of color distance; default: @ref DISTANCE_CIE2000

Python prototype (for reference only):

setDistance(distance) -> None
@spec setEpsilon(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setEpsilon(self, epsilon)

View Source
@spec setEpsilon(t(), number()) :: t() | {:error, String.t()}

set Epsilon

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • epsilon: double.

    used in MinProblemSolver-DownhillSolver; Terminal criteria to the algorithm; default: 1e-4;

Python prototype (for reference only):

setEpsilon(epsilon) -> None
Link to this function

setInitialMethod(named_args)

View Source
@spec setInitialMethod(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setInitialMethod(self, initialMethodType)

View Source
@spec setInitialMethod(t(), Evision.CCM.InitialMethodType.t()) ::
  t() | {:error, String.t()}

set InitialMethod

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • initialMethodType: InitialMethodType.

    the method of calculating CCM initial value; default: INITIAL_METHOD_LEAST_SQUARE

Python prototype (for reference only):

setInitialMethod(initialMethodType) -> None
Link to this function

setLinearization(named_args)

View Source
@spec setLinearization(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setLinearization(self, linearizationType)

View Source
@spec setLinearization(t(), Evision.CCM.LinearizationType.t()) ::
  t() | {:error, String.t()}

set Linear

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • linearizationType: LinearizationType.

    the method of linearization; default: @ref LINEARIZATION_GAMMA

Python prototype (for reference only):

setLinearization(linearizationType) -> None
Link to this function

setLinearizationDegree(named_args)

View Source
@spec setLinearizationDegree(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setLinearizationDegree(self, deg)

View Source
@spec setLinearizationDegree(t(), integer()) :: t() | {:error, String.t()}

set degree

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • deg: integer().

    the degree of linearization polynomial default: 3

Note: only valid when linear is set to

  • @ref LINEARIZATION_COLORPOLYFIT
  • @ref LINEARIZATION_GRAYPOLYFIT
  • @ref LINEARIZATION_COLORLOGPOLYFIT
  • @ref LINEARIZATION_GRAYLOGPOLYFIT

Python prototype (for reference only):

setLinearizationDegree(deg) -> None
Link to this function

setLinearizationGamma(named_args)

View Source
@spec setLinearizationGamma(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setLinearizationGamma(self, gamma)

View Source
@spec setLinearizationGamma(t(), number()) :: t() | {:error, String.t()}

set Gamma

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • gamma: double.

    the gamma value of gamma correction; default: 2.2;

Note: only valid when linear is set to "gamma";

Python prototype (for reference only):

setLinearizationGamma(gamma) -> None
@spec setMaxCount(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMaxCount(self, maxCount)

View Source
@spec setMaxCount(t(), integer()) :: t() | {:error, String.t()}

set MaxCount

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • maxCount: integer().

    used in MinProblemSolver-DownhillSolver; Terminal criteria to the algorithm; default: 5000;

Python prototype (for reference only):

setMaxCount(maxCount) -> None
@spec setRGB(Keyword.t()) :: any() | {:error, String.t()}
@spec setRGB(t(), boolean()) :: t() | {:error, String.t()}

Set whether the input image is in RGB color space

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • rgb: bool.

    If true, the model expects input images in RGB format. If false, input is assumed to be in BGR (default).

Python prototype (for reference only):

setRGB(rgb) -> None
Link to this function

setSaturatedThreshold(named_args)

View Source
@spec setSaturatedThreshold(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setSaturatedThreshold(self, lower, upper)

View Source
@spec setSaturatedThreshold(t(), number(), number()) :: t() | {:error, String.t()}

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

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • lower: double.

    the lower threshold to determine saturation; default: 0;

  • upper: double.

    the upper threshold to determine saturation; default: 0

Python prototype (for reference only):

setSaturatedThreshold(lower, upper) -> None
Link to this function

setWeightCoeff(named_args)

View Source
@spec setWeightCoeff(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setWeightCoeff(self, weightsCoeff)

View Source
@spec setWeightCoeff(t(), number()) :: t() | {:error, String.t()}

set WeightCoeff

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • weightsCoeff: double.

    the exponent number of L* component of the reference color in CIE Lab color space; default: 0

Python prototype (for reference only):

setWeightCoeff(weightsCoeff) -> None
Link to this function

setWeightsList(named_args)

View Source
@spec setWeightsList(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setWeightsList(self, weightsList)

View Source
@spec setWeightsList(t(), Evision.Mat.maybe_mat_in()) :: t() | {:error, String.t()}

set WeightsList

Positional Arguments
  • self: Evision.CCM.ColorCorrectionModel.t()

  • weightsList: Evision.Mat.

    the list of weight of each color; default: empty array

Python prototype (for reference only):

setWeightsList(weightsList) -> None
@spec write(Keyword.t()) :: any() | {:error, String.t()}
@spec write(t(), Evision.FileStorage.t()) :: t() | {:error, String.t()}

write

Positional Arguments

Python prototype (for reference only):

write(fs) -> None