org.opencv.ml

## Class KNearest

- java.lang.Object
- - org.opencv.core.Algorithm
  - - org.opencv.ml.StatModel
    - - org.opencv.ml.KNearest

-     public class KNearest
      extends StatModel

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BRUTE_FORCE`
    `static int` | `KDTREE`

    - ### 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` | `KNearest(long addr)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static KNearest` | `__fromPtr__(long addr)`
    `static KNearest` | `create()`
    `protected void` | `finalize()`
    `float` | `findNearest(Mat samples, int k, Mat results)`
    `float` | `findNearest(Mat samples, int k, Mat results, Mat neighborResponses, Mat dist)`
    `int` | `getAlgorithmType()`
    `int` | `getDefaultK()`
    `int` | `getEmax()`
    `boolean` | `getIsClassifier()`
    `void` | `setAlgorithmType(int val)`
    `void` | `setDefaultK(int val)`
    `void` | `setEmax(int val)`
    `void` | `setIsClassifier(boolean val)`

    - ### 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, getNativeObjAddr, save`

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

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

- - ### Field Detail

    - #### BRUTE_FORCE

          public static final int BRUTE_FORCE

      See Also:
        Constant Field Values

    - #### KDTREE

          public static final int KDTREE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### KNearest

          protected KNearest(long addr)

  - ### Method Detail

    - #### __fromPtr__

          public static KNearest __fromPtr__(long addr)

    - #### create

          public static KNearest create()

    - #### getIsClassifier

          public boolean getIsClassifier()

    - #### findNearest

          public float findNearest(Mat samples,
                                   int k,
                                   Mat results,
                                   Mat neighborResponses,
                                   Mat dist)

    - #### findNearest

          public float findNearest(Mat samples,
                                   int k,
                                   Mat results)

    - #### getAlgorithmType

          public int getAlgorithmType()

    - #### getDefaultK

          public int getDefaultK()

    - #### getEmax

          public int getEmax()

    - #### setAlgorithmType

          public void setAlgorithmType(int val)

    - #### setDefaultK

          public void setDefaultK(int val)

    - #### setEmax

          public void setEmax(int val)

    - #### setIsClassifier

          public void setIsClassifier(boolean val)

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

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

Generated on Fri Feb 23 2018 13:10:16 UTC / OpenCV 3.4.1