Trait opencv::ml::EMConst

source ·
pub trait EMConst: StatModelConst {
    // Required method
    fn as_raw_EM(&self) -> *const c_void;

    // Provided methods
    fn get_clusters_number(&self) -> Result<i32> { ... }
    fn get_covariance_matrix_type(&self) -> Result<i32> { ... }
    fn get_term_criteria(&self) -> Result<TermCriteria> { ... }
    fn get_weights(&self) -> Result<Mat> { ... }
    fn get_means(&self) -> Result<Mat> { ... }
    fn get_covs(&self, covs: &mut Vector<Mat>) -> Result<()> { ... }
    fn predict(
        &self,
        samples: &dyn ToInputArray,
        results: &mut dyn ToOutputArray,
        flags: i32
    ) -> Result<f32> { ... }
    fn predict2(
        &self,
        sample: &dyn ToInputArray,
        probs: &mut dyn ToOutputArray
    ) -> Result<Vec2d> { ... }
}
Expand description

Constant methods for crate::ml::EM

Required Methods§

Provided Methods§

source

fn get_clusters_number(&self) -> Result<i32>

The number of mixture components in the Gaussian mixture model. Default value of the parameter is EM::DEFAULT_NCLUSTERS=5. Some of %EM implementation could determine the optimal number of mixtures within a specified value range, but that is not the case in ML yet.

See also

setClustersNumber

source

fn get_covariance_matrix_type(&self) -> Result<i32>

Constraint on covariance matrices which defines type of matrices. See EM::Types.

See also

setCovarianceMatrixType

source

fn get_term_criteria(&self) -> Result<TermCriteria>

The termination criteria of the %EM algorithm. The %EM algorithm can be terminated by the number of iterations termCrit.maxCount (number of M-steps) or when relative change of likelihood logarithm is less than termCrit.epsilon. Default maximum number of iterations is EM::DEFAULT_MAX_ITERS=100.

See also

setTermCriteria

source

fn get_weights(&self) -> Result<Mat>

Returns weights of the mixtures

Returns vector with the number of elements equal to the number of mixtures.

source

fn get_means(&self) -> Result<Mat>

Returns the cluster centers (means of the Gaussian mixture)

Returns matrix with the number of rows equal to the number of mixtures and number of columns equal to the space dimensionality.

source

fn get_covs(&self, covs: &mut Vector<Mat>) -> Result<()>

Returns covariation matrices

Returns vector of covariation matrices. Number of matrices is the number of gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality.

source

fn predict( &self, samples: &dyn ToInputArray, results: &mut dyn ToOutputArray, flags: i32 ) -> Result<f32>

Returns posterior probabilities for the provided samples

Parameters
  • samples: The input samples, floating-point matrix
  • results: The optional output inline formula matrix of results. It contains posterior probabilities for each sample from the input
  • flags: This parameter will be ignored
C++ default parameters
  • results: noArray()
  • flags: 0
source

fn predict2( &self, sample: &dyn ToInputArray, probs: &mut dyn ToOutputArray ) -> Result<Vec2d>

Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample.

Parameters
  • sample: A sample for classification. It should be a one-channel matrix of inline formula or inline formula size.
  • probs: Optional output matrix that contains posterior probabilities of each component given the sample. It has inline formula size and CV_64FC1 type.

The method returns a two-element double vector. Zero element is a likelihood logarithm value for the sample. First element is an index of the most probable mixture component for the given sample.

Implementors§

source§

impl EMConst for Ptr<dyn EM>