OpenCV  2.4.13
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::CvKNearest ( )
virtual CvKNearest::~CvKNearest ( )
virtual
CvKNearest::CvKNearest ( const CvMat trainData,
const CvMat responses,
const CvMat sampleIdx = 0,
bool  isRegression = false,
int  max_k = 32 
)
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.

Reimplemented in cv::ocl::KNearestNeighbour.

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 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 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 void CvKNearest::find_neighbors_direct ( const CvMat _samples,
int  k,
int  start,
int  end,
float *  neighbor_responses,
const float **  neighbors,
float *  dist 
) const
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 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 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 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

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: