Table of Contents

Class EM

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

The class implements the Expectation Maximization algorithm.

public class EM : Algorithm, IDisposable
Inheritance
EM
Implements
Inherited Members

Fields

DEFAULT_MAX_ITERS
DEFAULT_NCLUSTERS

Properties

ClustersNumber

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.

CovarianceMatrixType

Constraint on covariance matrices which defines type of matrices.

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.

Methods

Create()

Creates empty EM model.

GetCovs()

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.

GetMeans()

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.

GetWeights()

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

Load(string)

Loads and creates a serialized model from a file.

LoadFromString(string)

Loads algorithm from a String.

Predict2(InputArray, OutputArray)

Predicts the response for sample

TrainE(InputArray, InputArray, InputArray, InputArray, OutputArray, OutputArray, OutputArray)

Estimate the Gaussian mixture parameters from a samples set.

TrainEM(InputArray, OutputArray, OutputArray, OutputArray)

Estimate the Gaussian mixture parameters from a samples set.

TrainM(InputArray, InputArray, OutputArray, OutputArray, OutputArray)

Estimate the Gaussian mixture parameters from a samples set.