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

- - ### Field Summary

    Fields
    Modifier and Type | Field and 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`

    - ### Fields inherited from class org.opencv.core.Algorithm

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EM(long addr)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static EM` | `create()`
    `protected void` | `finalize()`
    `int` | `getClustersNumber()`
    `int` | `getCovarianceMatrixType()`
    `void` | `getCovs(java.util.List<Mat> covs)`
    `Mat` | `getMeans()`
    `TermCriteria` | `getTermCriteria()`
    `Mat` | `getWeights()`
    `double[]` | `predict2(Mat sample, Mat probs)`
    `void` | `setClustersNumber(int val)`
    `void` | `setCovarianceMatrixType(int val)`
    `void` | `setTermCriteria(TermCriteria val)`
    `boolean` | `trainE(Mat samples, Mat means0)`
    `boolean` | `trainE(Mat samples, Mat means0, Mat covs0, Mat weights0, Mat logLikelihoods, Mat labels, Mat probs)`
    `boolean` | `trainEM(Mat samples)`
    `boolean` | `trainEM(Mat samples, Mat logLikelihoods, Mat labels, Mat probs)`
    `boolean` | `trainM(Mat samples, Mat probs0)`
    `boolean` | `trainM(Mat samples, Mat probs0, Mat logLikelihoods, Mat labels, Mat probs)`

    - ### Methods inherited from class org.opencv.ml.StatModel

      `calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, train, train, train`

    - ### Methods inherited from class org.opencv.core.Algorithm

      `clear, getDefaultName, save`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### 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

    - #### 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

  - ### Constructor Detail

    - #### EM

          protected EM(long addr)

  - ### Method Detail

    - #### getMeans

          public Mat getMeans()

    - #### getWeights

          public Mat getWeights()

    - #### create

          public static EM create()

    - #### getTermCriteria

          public TermCriteria getTermCriteria()

    - #### predict2

          public double[] predict2(Mat sample,
                                   Mat probs)

    - #### trainE

          public boolean trainE(Mat samples,
                                Mat means0,
                                Mat covs0,
                                Mat weights0,
                                Mat logLikelihoods,
                                Mat labels,
                                Mat probs)

    - #### trainE

          public boolean trainE(Mat samples,
                                Mat means0)

    - #### trainEM

          public boolean trainEM(Mat samples,
                                 Mat logLikelihoods,
                                 Mat labels,
                                 Mat probs)

    - #### trainEM

          public boolean trainEM(Mat samples)

    - #### trainM

          public boolean trainM(Mat samples,
                                Mat probs0,
                                Mat logLikelihoods,
                                Mat labels,
                                Mat probs)

    - #### trainM

          public boolean trainM(Mat samples,
                                Mat probs0)

    - #### getClustersNumber

          public int getClustersNumber()

    - #### getCovarianceMatrixType

          public int getCovarianceMatrixType()

    - #### getCovs

          public void getCovs(java.util.List<Mat> covs)

    - #### setClustersNumber

          public void setClustersNumber(int val)

    - #### setCovarianceMatrixType

          public void setCovarianceMatrixType(int val)

    - #### setTermCriteria

          public void setTermCriteria(TermCriteria val)

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `StatModel`
      Throws:
        `java.lang.Throwable`