Package org.opencv.ml
Class EM
- java.lang.Object
- 
- org.opencv.core.Algorithm
- 
- org.opencv.ml.StatModel
- 
- org.opencv.ml.EM
 
 
 
- 
 public class EM extends StatModel The class implements the Expectation Maximization algorithm. SEE: REF: ml_intro_em
- 
- 
Field SummaryFields Modifier and Type Field Description static intCOV_MAT_DEFAULTstatic intCOV_MAT_DIAGONALstatic intCOV_MAT_GENERICstatic intCOV_MAT_SPHERICALstatic intDEFAULT_MAX_ITERSstatic intDEFAULT_NCLUSTERSstatic intSTART_AUTO_STEPstatic intSTART_E_STEPstatic intSTART_M_STEP- 
Fields inherited from class org.opencv.ml.StatModelCOMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedEM(long addr)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EM__fromPtr__(long addr)static EMcreate()Creates empty %EM model.protected voidfinalize()intgetClustersNumber()SEE: setClustersNumberintgetCovarianceMatrixType()SEE: setCovarianceMatrixTypevoidgetCovs(java.util.List<Mat> covs)Returns covariation matrices Returns vector of covariation matrices.MatgetMeans()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.TermCriteriagetTermCriteria()SEE: setTermCriteriaMatgetWeights()Returns weights of the mixtures Returns vector with the number of elements equal to the number of mixtures.static EMload(java.lang.String filepath)Loads and creates a serialized EM from a file Use EM::save to serialize and store an EM to disk.static EMload(java.lang.String filepath, java.lang.String nodeName)Loads and creates a serialized EM from a file Use EM::save to serialize and store an EM to disk.floatpredict(Mat samples)Returns posterior probabilities for the provided samplesfloatpredict(Mat samples, Mat results)Returns posterior probabilities for the provided samplesfloatpredict(Mat samples, Mat results, int flags)Returns posterior probabilities for the provided samplesdouble[]predict2(Mat sample, Mat probs)Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample.voidsetClustersNumber(int val)getClustersNumber SEE: getClustersNumbervoidsetCovarianceMatrixType(int val)getCovarianceMatrixType SEE: getCovarianceMatrixTypevoidsetTermCriteria(TermCriteria val)getTermCriteria SEE: getTermCriteriabooleantrainE(Mat samples, Mat means0)Estimate the Gaussian mixture parameters from a samples set.booleantrainE(Mat samples, Mat means0, Mat covs0)Estimate the Gaussian mixture parameters from a samples set.booleantrainE(Mat samples, Mat means0, Mat covs0, Mat weights0)Estimate the Gaussian mixture parameters from a samples set.booleantrainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods)Estimate the Gaussian mixture parameters from a samples set.booleantrainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels)Estimate the Gaussian mixture parameters from a samples set.booleantrainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs)Estimate the Gaussian mixture parameters from a samples set.booleantrainEM(Mat samples)Estimate the Gaussian mixture parameters from a samples set.booleantrainEM(Mat samples, Mat logLikelihoods)Estimate the Gaussian mixture parameters from a samples set.booleantrainEM(Mat samples, Mat logLikelihoods, Mat labels)Estimate the Gaussian mixture parameters from a samples set.booleantrainEM(Mat samples, Mat logLikelihoods, Mat labels, Mat probs)Estimate the Gaussian mixture parameters from a samples set.booleantrainM(Mat samples, Mat probs0)Estimate the Gaussian mixture parameters from a samples set.booleantrainM(Mat samples, Mat probs0, Mat logLikelihoods)Estimate the Gaussian mixture parameters from a samples set.booleantrainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels)Estimate the Gaussian mixture parameters from a samples set.booleantrainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs)Estimate the Gaussian mixture parameters from a samples set.- 
Methods inherited from class org.opencv.ml.StatModelcalcError, empty, getVarCount, isClassifier, isTrained, train, train, train
 - 
Methods inherited from class org.opencv.core.Algorithmclear, getDefaultName, getNativeObjAddr, save
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_NCLUSTERSpublic static final int DEFAULT_NCLUSTERS - See Also:
- Constant Field Values
 
 - 
DEFAULT_MAX_ITERSpublic static final int DEFAULT_MAX_ITERS - See Also:
- Constant Field Values
 
 - 
START_E_STEPpublic static final int START_E_STEP - See Also:
- Constant Field Values
 
 - 
START_M_STEPpublic static final int START_M_STEP - See Also:
- Constant Field Values
 
 - 
START_AUTO_STEPpublic static final int START_AUTO_STEP - See Also:
- Constant Field Values
 
 - 
COV_MAT_SPHERICALpublic static final int COV_MAT_SPHERICAL - See Also:
- Constant Field Values
 
 - 
COV_MAT_DIAGONALpublic static final int COV_MAT_DIAGONAL - See Also:
- Constant Field Values
 
 - 
COV_MAT_GENERICpublic static final int COV_MAT_GENERIC - See Also:
- Constant Field Values
 
 - 
COV_MAT_DEFAULTpublic static final int COV_MAT_DEFAULT - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
__fromPtr__public static EM __fromPtr__(long addr) 
 - 
getClustersNumberpublic int getClustersNumber() SEE: setClustersNumber- Returns:
- automatically generated
 
 - 
setClustersNumberpublic void setClustersNumber(int val) getClustersNumber SEE: getClustersNumber- Parameters:
- val- automatically generated
 
 - 
getCovarianceMatrixTypepublic int getCovarianceMatrixType() SEE: setCovarianceMatrixType- Returns:
- automatically generated
 
 - 
setCovarianceMatrixTypepublic void setCovarianceMatrixType(int val) getCovarianceMatrixType SEE: getCovarianceMatrixType- Parameters:
- val- automatically generated
 
 - 
getTermCriteriapublic TermCriteria getTermCriteria() SEE: setTermCriteria- Returns:
- automatically generated
 
 - 
setTermCriteriapublic void setTermCriteria(TermCriteria val) getTermCriteria SEE: getTermCriteria- Parameters:
- val- automatically generated
 
 - 
getWeightspublic Mat getWeights() Returns weights of the mixtures Returns vector with the number of elements equal to the number of mixtures.- Returns:
- automatically generated
 
 - 
getMeanspublic Mat 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.- Returns:
- automatically generated
 
 - 
getCovspublic void getCovs(java.util.List<Mat> covs) 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.- Parameters:
- covs- automatically generated
 
 - 
predictpublic float predict(Mat samples, Mat results, int flags) Returns posterior probabilities for the provided samples- Overrides:
- predictin class- StatModel
- Parameters:
- samples- The input samples, floating-point matrix
- results- The optional output \( nSamples \times nClusters\) matrix of results. It contains posterior probabilities for each sample from the input
- flags- This parameter will be ignored
- Returns:
- automatically generated
 
 - 
predictpublic float predict(Mat samples, Mat results) Returns posterior probabilities for the provided samples
 - 
predictpublic float predict(Mat samples) Returns posterior probabilities for the provided samples
 - 
predict2public double[] predict2(Mat sample, Mat probs) 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 \(1 \times dims\) or \(dims \times 1\) size.
- probs- Optional output matrix that contains posterior probabilities of each component given the sample. It has \(1 \times nclusters\) 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.
- Returns:
- automatically generated
 
 - 
trainEMpublic boolean trainEM(Mat samples, Mat logLikelihoods, Mat labels, Mat probs) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm. Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the *Maximum Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type.
- labels- The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type.
- probs- The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEMpublic boolean trainEM(Mat samples, Mat logLikelihoods, Mat labels) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm. Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the *Maximum Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type.
- labels- The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEMpublic boolean trainEM(Mat samples, Mat logLikelihoods) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm. Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the *Maximum Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEMpublic boolean trainEM(Mat samples) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. Initial values of the model parameters will be estimated by the k-means algorithm. Unlike many of the ML models, %EM is an unsupervised learning algorithm and it does not take responses (class labels or function values) as input. Instead, it computes the *Maximum Likelihood Estimate* of the Gaussian mixture parameters from an input sample set, stores all the parameters inside the structure: \(p_{i,k}\) in probs, \(a_k\) in means , \(S_k\) in covs[k], \(\pi_k\) in weights , and optionally computes the output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEpublic boolean trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- means0- Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- covs0- The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing.
- weights0- Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size.
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type.
- labels- The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type.
- probs- The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEpublic boolean trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- means0- Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- covs0- The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing.
- weights0- Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size.
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type.
- labels- The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEpublic boolean trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- means0- Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- covs0- The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing.
- weights0- Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size.
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEpublic boolean trainE(Mat samples, Mat means0, Mat covs0, Mat weights0) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- means0- Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- covs0- The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing.
- weights0- Initial weights \(\pi_k\) of mixture components. It should be a one-channel floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEpublic boolean trainE(Mat samples, Mat means0, Mat covs0) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- means0- Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- covs0- The vector of initial covariance matrices \(S_k\) of mixture components. Each of covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainEpublic boolean trainE(Mat samples, Mat means0) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Expectation step. You need to provide initial means \(a_k\) of mixture components. Optionally you can pass initial weights \(\pi_k\) and covariance matrices \(S_k\) of mixture components.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- means0- Initial means \(a_k\) of mixture components. It is a one-channel matrix of \(nclusters \times dims\) size. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing. covariance matrices is a one-channel matrix of \(dims \times dims\) size. If the matrices do not have CV_64F type they will be converted to the inner matrices of such type for the further computing. floating-point matrix with \(1 \times nclusters\) or \(nclusters \times 1\) size. each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainMpublic boolean trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- probs0- the probabilities
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type.
- labels- The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type.
- probs- The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainMpublic boolean trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- probs0- the probabilities
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type.
- labels- The optional output "class label" for each sample: \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainMpublic boolean trainM(Mat samples, Mat probs0, Mat logLikelihoods) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- probs0- the probabilities
- logLikelihoods- The optional output matrix that contains a likelihood logarithm value for each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
trainMpublic boolean trainM(Mat samples, Mat probs0) Estimate the Gaussian mixture parameters from a samples set. This variation starts with Maximization step. You need to provide initial probabilities \(p_{i,k}\) to use this option.- Parameters:
- samples- Samples from which the Gaussian mixture model will be estimated. It should be a one-channel matrix, each row of which is a sample. If the matrix does not have CV_64F type it will be converted to the inner matrix of such type for the further computing.
- probs0- the probabilities each sample. It has \(nsamples \times 1\) size and CV_64FC1 type. \(\texttt{labels}_i=\texttt{arg max}_k(p_{i,k}), i=1..N\) (indices of the most probable mixture component for each sample). It has \(nsamples \times 1\) size and CV_32SC1 type. mixture component given the each sample. It has \(nsamples \times nclusters\) size and CV_64FC1 type.
- Returns:
- automatically generated
 
 - 
createpublic static EM create() Creates empty %EM model. The model should be trained then using StatModel::train(traindata, flags) method. Alternatively, you can use one of the EM::train\* methods or load it from file using Algorithm::load<EM>(filename).- Returns:
- automatically generated
 
 - 
loadpublic static EM load(java.lang.String filepath, java.lang.String nodeName) Loads and creates a serialized EM from a file Use EM::save to serialize and store an EM to disk. Load the EM from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier- Parameters:
- filepath- path to serialized EM
- nodeName- name of node containing the classifier
- Returns:
- automatically generated
 
 - 
loadpublic static EM load(java.lang.String filepath) Loads and creates a serialized EM from a file Use EM::save to serialize and store an EM to disk. Load the EM from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier- Parameters:
- filepath- path to serialized EM
- Returns:
- automatically generated
 
 
- 
 
-