OpenCV for Unity 2.6.5
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
|
The class implements the Expectation Maximization algorithm. More...
Public Member Functions | |
int | getClustersNumber () |
int | getCovarianceMatrixType () |
void | getCovs (List< Mat > covs) |
Returns covariation matrices. | |
Mat | getMeans () |
Returns the cluster centers (means of the Gaussian mixture) | |
TermCriteria | getTermCriteria () |
double double double epsilon | getTermCriteriaAsValueTuple () |
Vec3d | getTermCriteriaAsVec3d () |
Mat | getWeights () |
Returns weights of the mixtures. | |
override float | predict (Mat samples) |
Returns posterior probabilities for the provided samples. | |
override float | predict (Mat samples, Mat results) |
Returns posterior probabilities for the provided samples. | |
override float | predict (Mat samples, Mat results, int flags) |
Returns posterior probabilities for the provided samples. | |
double[] | 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) |
void | setCovarianceMatrixType (int val) |
void | setTermCriteria (in Vec3d val) |
void | setTermCriteria (in(double type, double maxCount, double epsilon) val) |
void | setTermCriteria (TermCriteria val) |
bool | trainE (Mat samples, Mat means0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainE (Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples, Mat logLikelihoods) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples, Mat logLikelihoods, Mat labels) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainEM (Mat samples, Mat logLikelihoods, Mat labels, Mat probs) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0, Mat logLikelihoods) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0, Mat logLikelihoods, Mat labels) |
Estimate the Gaussian mixture parameters from a samples set. | |
bool | trainM (Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs) |
Estimate the Gaussian mixture parameters from a samples set. | |
![]() | |
float | calcError (TrainData data, bool test, Mat resp) |
Computes error on the training or test dataset. | |
override bool | empty () |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. | |
int | getVarCount () |
Returns the number of variables in training samples. | |
bool | isClassifier () |
Returns true if the model is classifier. | |
bool | isTrained () |
Returns true if the model is trained. | |
bool | train (Mat samples, int layout, Mat responses) |
Trains the statistical model. | |
bool | train (TrainData trainData) |
Trains the statistical model. | |
bool | train (TrainData trainData, int flags) |
Trains the statistical model. | |
![]() | |
virtual void | clear () |
Clears the algorithm state. | |
virtual string | getDefaultName () |
IntPtr | getNativeObjAddr () |
void | save (string filename) |
![]() | |
void | Dispose () |
void | ThrowIfDisposed () |
Static Public Member Functions | |
static new EM | __fromPtr__ (IntPtr addr) |
static EM | create () |
static EM | load (string filepath) |
Loads and creates a serialized EM from a file. | |
static EM | load (string filepath, string nodeName) |
Loads and creates a serialized EM from a file. | |
![]() | |
static new StatModel | __fromPtr__ (IntPtr addr) |
![]() | |
static Algorithm | __fromPtr__ (IntPtr addr) |
![]() | |
static IntPtr | ThrowIfNullIntPtr (IntPtr ptr) |
Public Attributes | |
double double | maxCount |
double | type |
Static Public Attributes | |
const int | COV_MAT_DEFAULT = COV_MAT_DIAGONAL |
const int | COV_MAT_DIAGONAL = 1 |
const int | COV_MAT_GENERIC = 2 |
const int | COV_MAT_SPHERICAL = 0 |
const int | DEFAULT_MAX_ITERS = 100 |
const int | DEFAULT_NCLUSTERS = 5 |
const int | START_AUTO_STEP = 0 |
const int | START_E_STEP = 1 |
const int | START_M_STEP = 2 |
![]() | |
const int | COMPRESSED_INPUT = 2 |
const int | PREPROCESSED_INPUT = 4 |
const int | RAW_OUTPUT = 1 |
const int | UPDATE_MODEL = 1 |
Protected Member Functions | |
override void | Dispose (bool disposing) |
![]() | |
override void | Dispose (bool disposing) |
![]() | |
![]() | |
DisposableOpenCVObject () | |
DisposableOpenCVObject (bool isEnabledDispose) | |
DisposableOpenCVObject (IntPtr ptr) | |
DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose) | |
![]() | |
DisposableObject () | |
DisposableObject (bool isEnabledDispose) | |
Additional Inherited Members | |
![]() | |
![]() | |
![]() | |
![]() | |
bool | IsDisposed [get, protected set] |
bool | IsEnabledDispose [get, set] |
The class implements the Expectation Maximization algorithm.
|
static |
|
static |
|
protectedvirtual |
Reimplemented from OpenCVForUnity.CoreModule.Algorithm.
int OpenCVForUnity.MlModule.EM.getClustersNumber | ( | ) |
int OpenCVForUnity.MlModule.EM.getCovarianceMatrixType | ( | ) |
void OpenCVForUnity.MlModule.EM.getCovs | ( | 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.
Mat OpenCVForUnity.MlModule.EM.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 OpenCVForUnity.MlModule.EM.getTermCriteria | ( | ) |
double double double epsilon OpenCVForUnity.MlModule.EM.getTermCriteriaAsValueTuple | ( | ) |
Vec3d OpenCVForUnity.MlModule.EM.getTermCriteriaAsVec3d | ( | ) |
Mat OpenCVForUnity.MlModule.EM.getWeights | ( | ) |
Returns weights of the mixtures.
Returns vector with the number of elements equal to the number of mixtures.
|
static |
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
filepath | path to serialized EM |
nodeName | name of node containing the classifier |
|
static |
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
filepath | path to serialized EM |
nodeName | name of node containing the classifier |
|
virtual |
Returns posterior probabilities for the provided samples.
samples | The input samples, floating-point matrix |
results | The optional output |
flags | This parameter will be ignored |
Reimplemented from OpenCVForUnity.MlModule.StatModel.
Returns posterior probabilities for the provided samples.
samples | The input samples, floating-point matrix |
results | The optional output |
flags | This parameter will be ignored |
Reimplemented from OpenCVForUnity.MlModule.StatModel.
Returns posterior probabilities for the provided samples.
samples | The input samples, floating-point matrix |
results | The optional output |
flags | This parameter will be ignored |
Reimplemented from OpenCVForUnity.MlModule.StatModel.
Returns a likelihood logarithm value and an index of the most probable mixture component for the given sample.
sample | A sample for classification. It should be a one-channel matrix of |
probs | Optional output matrix that contains posterior probabilities of each component given the sample. It has |
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.
void OpenCVForUnity.MlModule.EM.setClustersNumber | ( | int | val | ) |
void OpenCVForUnity.MlModule.EM.setCovarianceMatrixType | ( | int | val | ) |
void OpenCVForUnity.MlModule.EM.setTermCriteria | ( | in Vec3d | val | ) |
void OpenCVForUnity.MlModule.EM.setTermCriteria | ( | in(double type, double maxCount, double epsilon) | val | ) |
void OpenCVForUnity.MlModule.EM.setTermCriteria | ( | TermCriteria | val | ) |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means
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 |
covs0 | The vector of initial covariance matrices |
weights0 | Initial weights |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means
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 |
covs0 | The vector of initial covariance matrices |
weights0 | Initial weights |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Expectation step. You need to provide initial means
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 |
covs0 | The vector of initial covariance matrices |
weights0 | Initial weights |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
bool OpenCVForUnity.MlModule.EM.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
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 |
covs0 | The vector of initial covariance matrices |
weights0 | Initial weights |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
bool OpenCVForUnity.MlModule.EM.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
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 |
covs0 | The vector of initial covariance matrices |
weights0 | Initial weights |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
bool OpenCVForUnity.MlModule.EM.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
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 |
covs0 | The vector of initial covariance matrices |
weights0 | Initial weights |
logLikelihoods | The optional output matrix that contains a likelihood logarithm value for each sample. It has |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
bool OpenCVForUnity.MlModule.EM.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:
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
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:
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
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:
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
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:
The trained model can be used further for prediction, just like any other classifier. The trained model is similar to the NormalBayesClassifier.
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
Estimate the Gaussian mixture parameters from a samples set.
This variation starts with Maximization step. You need to provide initial probabilities
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
bool OpenCVForUnity.MlModule.EM.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
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 |
labels | The optional output "class label" for each sample: |
probs | The optional output matrix that contains posterior probabilities of each Gaussian mixture component given the each sample. It has |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
double double OpenCVForUnity.MlModule.EM.maxCount |
|
static |
|
static |
|
static |
double OpenCVForUnity.MlModule.EM.type |