OpenCV  2.4.13.3
Open Source Computer Vision
CvKNearest Class Reference

#include <ml.hpp>

Inheritance diagram for CvKNearest:
CvStatModel cv::ocl::KNearestNeighbour

Public Member Functions

 CvKNearest ()
 
virtual ~CvKNearest ()
 
 CvKNearest (const CvMat *trainData, const CvMat *responses, const CvMat *sampleIdx=0, bool isRegression=false, int max_k=32)
 
virtual bool train (const CvMat *trainData, const CvMat *responses, const CvMat *sampleIdx=0, bool is_regression=false, int maxK=32, bool updateBase=false)
 
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
 
 CvKNearest (const cv::Mat &trainData, const cv::Mat &responses, const cv::Mat &sampleIdx=cv::Mat(), bool isRegression=false, int max_k=32)
 
virtual 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 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 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 void clear ()
 
int get_max_k () const
 
int get_var_count () const
 
int get_sample_count () const
 
bool is_regression () 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
 
virtual void find_neighbors_direct (const CvMat *_samples, int k, int start, int end, float *neighbor_responses, const float **neighbors, float *dist) const
 
- Public Member Functions inherited from CvStatModel
 CvStatModel ()
 
virtual ~CvStatModel ()
 
virtual void save (const char *filename, const char *name=0) const
 
virtual void load (const char *filename, const char *name=0)
 
virtual void write (CvFileStorage *storage, const char *name) const
 
virtual void read (CvFileStorage *storage, CvFileNode *node)
 

Protected Attributes

int max_k
 
int var_count
 
int total
 
bool regression
 
CvVectorssamples
 
- Protected Attributes inherited from CvStatModel
const char * default_model_name
 

Constructor & Destructor Documentation

§ CvKNearest() [1/3]

CvKNearest::CvKNearest ( )

§ ~CvKNearest()

virtual CvKNearest::~CvKNearest ( )
virtual

§ CvKNearest() [2/3]

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

§ CvKNearest() [3/3]

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

§ clear()

virtual void CvKNearest::clear ( )
virtual

Reimplemented from CvStatModel.

Reimplemented in cv::ocl::KNearestNeighbour.

§ find_nearest() [1/3]

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

§ find_nearest() [2/3]

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

§ find_nearest() [3/3]

virtual 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

§ find_neighbors_direct()

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

§ get_max_k()

int CvKNearest::get_max_k ( ) const

§ get_sample_count()

int CvKNearest::get_sample_count ( ) const

§ get_var_count()

int CvKNearest::get_var_count ( ) const

§ is_regression()

bool CvKNearest::is_regression ( ) const

§ train() [1/2]

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

§ train() [2/2]

virtual 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

§ write_results()

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
virtual

Member Data Documentation

§ max_k

int CvKNearest::max_k
protected

§ regression

bool CvKNearest::regression
protected

§ samples

CvVectors* CvKNearest::samples
protected

§ total

int CvKNearest::total
protected

§ var_count

int CvKNearest::var_count
protected

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