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 Summary
Fields Modifier and Type Field Description static int
COV_MAT_DEFAULT
static int
COV_MAT_DIAGONAL
static int
COV_MAT_GENERIC
static int
COV_MAT_SPHERICAL
static int
DEFAULT_MAX_ITERS
static int
DEFAULT_NCLUSTERS
static int
START_AUTO_STEP
static int
START_E_STEP
static int
START_M_STEP
-
Fields inherited from class org.opencv.ml.StatModel
COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EM(long addr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EM
__fromPtr__(long addr)
static EM
create()
Creates empty %EM model.protected void
finalize()
int
getClustersNumber()
SEE: setClustersNumberint
getCovarianceMatrixType()
SEE: setCovarianceMatrixTypevoid
getCovs(java.util.List<Mat> covs)
Returns covariation matrices Returns vector of covariation matrices.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.TermCriteria
getTermCriteria()
SEE: setTermCriteriaMat
getWeights()
Returns weights of the mixtures Returns vector with the number of elements equal to the number of mixtures.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.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.float
predict(Mat samples)
Returns posterior probabilities for the provided samplesfloat
predict(Mat samples, Mat results)
Returns posterior probabilities for the provided samplesfloat
predict(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.void
setClustersNumber(int val)
getClustersNumber SEE: getClustersNumbervoid
setCovarianceMatrixType(int val)
getCovarianceMatrixType SEE: getCovarianceMatrixTypevoid
setTermCriteria(TermCriteria val)
getTermCriteria SEE: getTermCriteriaboolean
trainE(Mat samples, Mat means0)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainE(Mat samples, Mat means0, Mat covs0)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainE(Mat samples, Mat means0, Mat covs0, Mat weights0)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels)
Estimate the Gaussian mixture parameters from a samples set.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.boolean
trainEM(Mat samples)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainEM(Mat samples, Mat logLikelihoods)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainEM(Mat samples, Mat logLikelihoods, Mat labels)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainEM(Mat samples, Mat logLikelihoods, Mat labels, Mat probs)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainM(Mat samples, Mat probs0)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainM(Mat samples, Mat probs0, Mat logLikelihoods)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels)
Estimate the Gaussian mixture parameters from a samples set.boolean
trainM(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.StatModel
calcError, empty, getVarCount, isClassifier, isTrained, train, train, train
-
Methods inherited from class org.opencv.core.Algorithm
clear, getDefaultName, getNativeObjAddr, save
-
-
-
-
Field Detail
-
DEFAULT_NCLUSTERS
public static final int DEFAULT_NCLUSTERS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_ITERS
public static final int DEFAULT_MAX_ITERS
- See Also:
- Constant Field Values
-
START_E_STEP
public static final int START_E_STEP
- See Also:
- Constant Field Values
-
START_M_STEP
public static final int START_M_STEP
- See Also:
- Constant Field Values
-
START_AUTO_STEP
public static final int START_AUTO_STEP
- See Also:
- Constant Field Values
-
COV_MAT_SPHERICAL
public static final int COV_MAT_SPHERICAL
- See Also:
- Constant Field Values
-
COV_MAT_DIAGONAL
public static final int COV_MAT_DIAGONAL
- See Also:
- Constant Field Values
-
COV_MAT_GENERIC
public static final int COV_MAT_GENERIC
- See Also:
- Constant Field Values
-
COV_MAT_DEFAULT
public static final int COV_MAT_DEFAULT
- See Also:
- Constant Field Values
-
-
Method Detail
-
__fromPtr__
public static EM __fromPtr__(long addr)
-
getClustersNumber
public int getClustersNumber()
SEE: setClustersNumber- Returns:
- automatically generated
-
setClustersNumber
public void setClustersNumber(int val)
getClustersNumber SEE: getClustersNumber- Parameters:
val
- automatically generated
-
getCovarianceMatrixType
public int getCovarianceMatrixType()
SEE: setCovarianceMatrixType- Returns:
- automatically generated
-
setCovarianceMatrixType
public void setCovarianceMatrixType(int val)
getCovarianceMatrixType SEE: getCovarianceMatrixType- Parameters:
val
- automatically generated
-
getTermCriteria
public TermCriteria getTermCriteria()
SEE: setTermCriteria- Returns:
- automatically generated
-
setTermCriteria
public void setTermCriteria(TermCriteria val)
getTermCriteria SEE: getTermCriteria- Parameters:
val
- automatically generated
-
getWeights
public Mat getWeights()
Returns weights of the mixtures Returns vector with the number of elements equal to the number of mixtures.- Returns:
- automatically generated
-
getMeans
public 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
-
getCovs
public 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
-
predict
public float predict(Mat samples, Mat results, int flags)
Returns posterior probabilities for the provided samples- Overrides:
predict
in classStatModel
- Parameters:
samples
- The input samples, floating-point matrixresults
- The optional output \( nSamples \times nClusters\) matrix of results. It contains posterior probabilities for each sample from the inputflags
- This parameter will be ignored- Returns:
- automatically generated
-
predict
public float predict(Mat samples, Mat results)
Returns posterior probabilities for the provided samples
-
predict
public float predict(Mat samples)
Returns posterior probabilities for the provided samples
-
predict2
public 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
-
trainEM
public 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
-
trainEM
public 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
-
trainEM
public 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
-
trainEM
public 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
-
trainE
public 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
-
trainE
public 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
-
trainE
public 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
-
trainE
public 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
-
trainE
public 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
-
trainE
public 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
-
trainM
public 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 probabilitieslogLikelihoods
- 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
-
trainM
public 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 probabilitieslogLikelihoods
- 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
-
trainM
public 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 probabilitieslogLikelihoods
- 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
-
trainM
public 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
-
create
public 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
-
load
public 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 EMnodeName
- name of node containing the classifier- Returns:
- automatically generated
-
load
public 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
-
-