Trait ColorCorrectionModelTrait

Source
pub trait ColorCorrectionModelTrait: ColorCorrectionModelTraitConst {
Show 16 methods // Required method fn as_raw_mut_ColorCorrectionModel(&mut self) -> *mut c_void; // Provided methods fn set_color_space(&mut self, cs: COLOR_SPACE) -> Result<()> { ... } fn set_ccm_type(&mut self, ccm_type: CCM_TYPE) -> Result<()> { ... } fn set_distance(&mut self, distance: DISTANCE_TYPE) -> Result<()> { ... } fn set_linear(&mut self, linear_type: LINEAR_TYPE) -> Result<()> { ... } fn set_linear_gamma(&mut self, gamma: &f64) -> Result<()> { ... } fn set_linear_degree(&mut self, deg: &i32) -> Result<()> { ... } fn set_saturated_threshold( &mut self, lower: &f64, upper: &f64, ) -> Result<()> { ... } fn set_weights_list( &mut self, weights_list: &impl MatTraitConst, ) -> Result<()> { ... } fn set_weight_coeff(&mut self, weights_coeff: &f64) -> Result<()> { ... } fn set_initial_method( &mut self, initial_method_type: INITIAL_METHOD_TYPE, ) -> Result<()> { ... } fn set_max_count(&mut self, max_count: &i32) -> Result<()> { ... } fn set_epsilon(&mut self, epsilon: &f64) -> Result<()> { ... } fn run(&mut self) -> Result<()> { ... } fn infer(&mut self, img: &impl MatTraitConst, islinear: bool) -> Result<Mat> { ... } fn infer_def(&mut self, img: &impl MatTraitConst) -> Result<Mat> { ... }
}
Expand description

Required Methods§

Provided Methods§

Source

fn set_color_space(&mut self, cs: COLOR_SPACE) -> Result<()>

set ColorSpace

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

§Parameters
  • cs: the absolute color space that detected colors convert to;

        default: [COLOR_SPACE_sRGB]
Source

fn set_ccm_type(&mut self, ccm_type: CCM_TYPE) -> Result<()>

set ccm_type

§Parameters
  • ccm_type: the shape of color correction matrix(CCM);

             default: [CCM_3x3]
Source

fn set_distance(&mut self, distance: DISTANCE_TYPE) -> Result<()>

set Distance

§Parameters
  • distance: the type of color distance;

             default: [DISTANCE_CIE2000]
Source

fn set_linear(&mut self, linear_type: LINEAR_TYPE) -> Result<()>

set Linear

§Parameters
  • linear_type: the method of linearization;

                default: [LINEARIZATION_GAMMA]
Source

fn set_linear_gamma(&mut self, gamma: &f64) -> Result<()>

set Gamma

Note: only valid when linear is set to “gamma”;

§Parameters
  • gamma: the gamma value of gamma correction;

           default: 2.2;
Source

fn set_linear_degree(&mut self, deg: &i32) -> Result<()>

set degree

Note: only valid when linear is set to

§Parameters
  • deg: the degree of linearization polynomial;

     default: 3
Source

fn set_saturated_threshold(&mut self, lower: &f64, upper: &f64) -> Result<()>

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
Source

fn set_weights_list(&mut self, weights_list: &impl MatTraitConst) -> Result<()>

set WeightsList

§Parameters
  • weights_list: the list of weight of each color;

                 default: empty array
Source

fn set_weight_coeff(&mut self, weights_coeff: &f64) -> Result<()>

set WeightCoeff

§Parameters
  • weights_coeff: the exponent number of L* component of the reference color in CIE Lab color space;

                   default: 0
Source

fn set_initial_method( &mut self, initial_method_type: INITIAL_METHOD_TYPE, ) -> Result<()>

set InitialMethod

§Parameters
  • initial_method_type: the method of calculating CCM initial value;

     default: INITIAL_METHOD_LEAST_SQUARE
Source

fn set_max_count(&mut self, max_count: &i32) -> Result<()>

set MaxCount

§Parameters
  • max_count: used in MinProblemSolver-DownhillSolver;

    Terminal criteria to the algorithm;

               default: 5000;
Source

fn set_epsilon(&mut self, epsilon: &f64) -> Result<()>

set Epsilon

§Parameters
  • epsilon: used in MinProblemSolver-DownhillSolver;

    Terminal criteria to the algorithm;

            default: 1e-4;
Source

fn run(&mut self) -> Result<()>

make color correction

Source

fn infer(&mut self, img: &impl MatTraitConst, islinear: bool) -> Result<Mat>

Infer using fitting ccm.

§Parameters
  • img: the input image.
  • islinear: default false.
§Returns

the output array.

§C++ default parameters
  • islinear: false
Source

fn infer_def(&mut self, img: &impl MatTraitConst) -> Result<Mat>

Infer using fitting ccm.

§Parameters
  • img: the input image.
  • islinear: default false.
§Returns

the output array.

§Note

This alternative version of ColorCorrectionModelTrait::infer function uses the following default values for its arguments:

  • islinear: false

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§