View Source Evision.CCM.ColorCorrectionModel (Evision v0.1.28)

Link to this section Summary

Types

t()

Type that represents an CCM.ColorCorrectionModel struct.

Functions

Color Correction Model

get_dst_rgbl

get_src_rgbl

getCCM

getLoss

getMask

getWeights

Infer using fitting ccm.

Infer using fitting ccm.

make color correction

set ColorSpace

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

Link to this section Types

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

Type that represents an CCM.ColorCorrectionModel struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

Link to this function

colorCorrectionModel(src, constcolor)

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

Color Correction Model

Positional Arguments
  • src: Evision.Mat.t().

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

  • constcolor: CONST_COLOR.

    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_DigitalSG, the DigitalSG ColorChecker with 140 squares

Python prototype (for reference only):

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

colorCorrectionModel(src, colors, ref_cs)

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

Color Correction Model

Positional Arguments
  • src: Evision.Mat.t().

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

  • colors: Evision.Mat.t().

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

  • ref_cs: COLOR_SPACE.

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

Return
  • self: ColorCorrectionModel

Python prototype (for reference only):

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

colorCorrectionModel(src, colors, ref_cs, colored)

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

Color Correction Model

Positional Arguments
  • src: Evision.Mat.t().

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

  • colors: Evision.Mat.t().

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

  • ref_cs: COLOR_SPACE.

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

  • colored: Evision.Mat.t().

    mask of colored color

Return
  • self: ColorCorrectionModel

Python prototype (for reference only):

ColorCorrectionModel(src, colors, ref_cs, colored) -> <ccm_ColorCorrectionModel object>
@spec get_dst_rgbl(t()) :: Evision.Mat.t() | {:error, String.t()}

get_dst_rgbl

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

Python prototype (for reference only):

get_dst_rgbl() -> retval
@spec get_src_rgbl(t()) :: Evision.Mat.t() | {:error, String.t()}

get_src_rgbl

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

Python prototype (for reference only):

get_src_rgbl() -> retval
@spec getCCM(t()) :: Evision.Mat.t() | {:error, String.t()}

getCCM

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

Python prototype (for reference only):

getCCM() -> retval
@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(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
@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 infer(t(), Evision.Mat.maybe_mat_in()) :: Evision.Mat.t() | {:error, String.t()}

Infer using fitting ccm.

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

  • img: Evision.Mat.t().

    the input image.

Keyword Arguments
  • islinear: bool.

    default false.

Return
  • retval: Evision.Mat.t()

@return the output array.

Python prototype (for reference only):

infer(img[, islinear]) -> retval
@spec infer(t(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  Evision.Mat.t() | {:error, String.t()}

Infer using fitting ccm.

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

  • img: Evision.Mat.t().

    the input image.

Keyword Arguments
  • islinear: bool.

    default false.

Return
  • retval: Evision.Mat.t()

@return the output array.

Python prototype (for reference only):

infer(img[, islinear]) -> retval
@spec run(t()) :: t() | {:error, String.t()}

make color correction

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

Python prototype (for reference only):

run() -> None
Link to this function

setCCM_TYPE(self, ccm_type)

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

set ccm_type

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

  • ccm_type: CCM_TYPE.

    the shape of color correction matrix(CCM);\n default: @ref CCM_3x3

Python prototype (for reference only):

setCCM_TYPE(ccm_type) -> None
@spec setColorSpace(t(), Evision.CCM.COLOR_SPACE.t()) :: t() | {:error, String.t()}

set ColorSpace

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

  • cs: COLOR_SPACE.

    the absolute color space that detected colors convert to;\n 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_AdobeRGB
  • @ref COLOR_SPACE_WideGamutRGB
  • @ref COLOR_SPACE_ProPhotoRGB
  • @ref COLOR_SPACE_DCI_P3_RGB
  • @ref COLOR_SPACE_AppleRGB
  • @ref COLOR_SPACE_REC_709_RGB
  • @ref COLOR_SPACE_REC_2020_RGB

Python prototype (for reference only):

setColorSpace(cs) -> None
Link to this function

setDistance(self, distance)

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

set Distance

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

  • distance: DISTANCE_TYPE.

    the type of color distance;\n default: @ref DISTANCE_CIE2000

Python prototype (for reference only):

setDistance(distance) -> None
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;\n Terminal criteria to the algorithm;\n default: 1e-4;

Python prototype (for reference only):

setEpsilon(epsilon) -> None
Link to this function

setInitialMethod(self, initial_method_type)

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

set InitialMethod

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

  • initial_method_type: INITIAL_METHOD_TYPE.

    the method of calculating CCM initial value;\n default: INITIAL_METHOD_LEAST_SQUARE

Python prototype (for reference only):

setInitialMethod(initial_method_type) -> None
Link to this function

setLinear(self, linear_type)

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

set Linear

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

  • linear_type: LINEAR_TYPE.

    the method of linearization;\n default: @ref LINEARIZATION_GAMMA

Python prototype (for reference only):

setLinear(linear_type) -> None
Link to this function

setLinearDegree(self, deg)

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

set degree

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

  • deg: int.

    the degree of linearization polynomial;\n 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):

setLinearDegree(deg) -> None
Link to this function

setLinearGamma(self, gamma)

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

set Gamma

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

  • gamma: double.

    the gamma value of gamma correction;\n default: 2.2;

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

Python prototype (for reference only):

setLinearGamma(gamma) -> None
Link to this function

setMaxCount(self, max_count)

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

set MaxCount

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

  • max_count: int.

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

Python prototype (for reference only):

setMaxCount(max_count) -> None
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;\n default: 0;

  • upper: double.

    the upper threshold to determine saturation;\n default: 0

Python prototype (for reference only):

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

setWeightCoeff(self, weights_coeff)

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

set WeightCoeff

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

  • weights_coeff: double.

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

Python prototype (for reference only):

setWeightCoeff(weights_coeff) -> None
Link to this function

setWeightsList(self, weights_list)

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

set WeightsList

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

  • weights_list: Evision.Mat.t().

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

Python prototype (for reference only):

setWeightsList(weights_list) -> None