opencv: CvKNearest Class Reference

Public Member Functions | Protected Member Functions | Protected Attributes

# CvKNearest Class Reference

`#include <ml.hpp>`

Inheritance diagram for CvKNearest:

List of all members.

## Public Member Functions
virtual void | clear ()
CV_WRAP | CvKNearest ()
| CvKNearest (const CvMat *trainData, const CvMat *responses, const CvMat *sampleIdx=0, bool isRegression=false, int max_k=32)
CV_WRAP | CvKNearest (const cv::Mat &trainData, const cv::Mat &responses, const cv::Mat &sampleIdx=cv::Mat(), bool isRegression=false, int max_k=32)
virtual float | find_nearest (const cv::Mat &samples, int k, cv::Mat *results=0, const float **neighbors=0, cv::Mat *neighborResponses=0, cv::Mat *dist=0) const
virtual CV_WRAP float | find_nearest (const cv::Mat &samples, int k, CV_OUT cv::Mat &results, CV_OUT cv::Mat &neighborResponses, CV_OUT cv::Mat &dists) const
virtual float | find_nearest (const CvMat *samples, int k, CV_OUT CvMat *results=0, const float **neighbors=0, CV_OUT CvMat *neighborResponses=0, CV_OUT CvMat *dist=0) const
int | get_max_k () const
int | get_sample_count () const
int | get_var_count () const
bool | is_regression () const
virtual CV_WRAP bool | train (const cv::Mat &trainData, const cv::Mat &responses, const cv::Mat &sampleIdx=cv::Mat(), bool isRegression=false, int maxK=32, bool updateBase=false)
virtual bool | train (const CvMat *trainData, const CvMat *responses, const CvMat *sampleIdx=0, bool is_regression=false, int maxK=32, bool updateBase=false)
virtual | ~CvKNearest ()
## Protected Member Functions
virtual void | find_neighbors_direct (const CvMat *_samples, int k, int start, int end, float *neighbor_responses, const float **neighbors, float *dist) const
virtual float | write_results (int k, int k1, int start, int end, const float *neighbor_responses, const float *dist, CvMat *_results, CvMat *_neighbor_responses, CvMat *_dist, Cv32suf *sort_buf) const
## Protected Attributes
int | max_k
bool | regression
CvVectors * | samples
int | total
int | var_count

## Constructor & Destructor Documentation

CV_WRAP CvKNearest::CvKNearest | ( | ) |

virtual CvKNearest::~CvKNearest | ( | ) | `[virtual]`

CvKNearest::CvKNearest | ( | const CvMat * | trainData,
|  | const CvMat * | responses,
|  | const CvMat * | sampleIdx = `0`,
|  | bool | isRegression = `false`,
|  | int | max_k = `32`
| ) |  |

CV_WRAP CvKNearest::CvKNearest | ( | const cv::Mat & | trainData,
|  | const cv::Mat & | responses,
|  | const cv::Mat & | sampleIdx = `cv::Mat()`,
|  | bool | isRegression = `false`,
|  | int | max_k = `32`
| ) |  |

## Member Function Documentation

virtual void CvKNearest::clear | ( | ) | `[virtual]`

Reimplemented from CvStatModel.

virtual float CvKNearest::find_nearest | ( | const cv::Mat & | samples,
|  | int | k,
|  | cv::Mat * | results = `0`,
|  | const float ** | neighbors = `0`,
|  | cv::Mat * | neighborResponses = `0`,
|  | cv::Mat * | dist = `0`
| ) |  | const`[virtual]`

virtual CV_WRAP float CvKNearest::find_nearest | ( | const cv::Mat & | samples,
|  | int | k,
|  | CV_OUT cv::Mat & | results,
|  | CV_OUT cv::Mat & | neighborResponses,
|  | CV_OUT cv::Mat & | dists
| ) |  | const`[virtual]`

virtual float CvKNearest::find_nearest | ( | const CvMat * | samples,
|  | int | k,
|  | CV_OUT CvMat * | results = `0`,
|  | const float ** | neighbors = `0`,
|  | CV_OUT CvMat * | neighborResponses = `0`,
|  | CV_OUT CvMat * | dist = `0`
| ) |  | const`[virtual]`

virtual void CvKNearest::find_neighbors_direct | ( | const CvMat * | _samples,
|  | int | k,
|  | int | start,
|  | int | end,
|  | float * | neighbor_responses,
|  | const float ** | neighbors,
|  | float * | dist
| ) |  | const`[protected, virtual]`

int CvKNearest::get_max_k | ( | ) | const

int CvKNearest::get_sample_count | ( | ) | const

int CvKNearest::get_var_count | ( | ) | const

bool CvKNearest::is_regression | ( | ) | const

virtual CV_WRAP bool CvKNearest::train | ( | const cv::Mat & | trainData,
|  | const cv::Mat & | responses,
|  | const cv::Mat & | sampleIdx = `cv::Mat()`,
|  | bool | isRegression = `false`,
|  | int | maxK = `32`,
|  | bool | updateBase = `false`
| ) |  | `[virtual]`

virtual bool CvKNearest::train | ( | const CvMat * | trainData,
|  | const CvMat * | responses,
|  | const CvMat * | sampleIdx = `0`,
|  | bool | is_regression = `false`,
|  | int | maxK = `32`,
|  | bool | updateBase = `false`
| ) |  | `[virtual]`

virtual float CvKNearest::write_results | ( | int | k,
|  | int | k1,
|  | int | start,
|  | int | end,
|  | const float * | neighbor_responses,
|  | const float * | dist,
|  | CvMat * | _results,
|  | CvMat * | _neighbor_responses,
|  | CvMat * | _dist,
|  | Cv32suf * | sort_buf
| ) |  | const`[protected, virtual]`

## Member Data Documentation

int CvKNearest::max_k`[protected]`

bool CvKNearest::regression`[protected]`

CvVectors* CvKNearest::samples`[protected]`

int CvKNearest::total`[protected]`

int CvKNearest::var_count`[protected]`

The documentation for this class was generated from the following file:

- /usr/ports/pobj/OpenCV-2.2.0/OpenCV-2.2.0/modules/ml/include/opencv2/ml/ml.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines