OpenCV  5.0.0alpha
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::xfeatures2d::BOWKMeansTrainer Class Reference

kmeans -based class to train visual vocabulary using the bag of visual words approach. : More...

#include <opencv2/xfeatures2d.hpp>

Collaboration diagram for cv::xfeatures2d::BOWKMeansTrainer:

Public Member Functions

 BOWKMeansTrainer (int clusterCount, const TermCriteria &termcrit=TermCriteria(), int attempts=3, int flags=KMEANS_PP_CENTERS)
 The constructor.
 
virtual ~BOWKMeansTrainer ()
 
virtual Mat cluster () const CV_OVERRIDE
 
virtual Mat cluster (const Mat &descriptors) const CV_OVERRIDE
 Clusters train descriptors.
 
- Public Member Functions inherited from cv::xfeatures2d::BOWTrainer
 BOWTrainer ()
 
virtual ~BOWTrainer ()
 
void add (const Mat &descriptors)
 Adds descriptors to a training set.
 
virtual void clear ()
 
int descriptorsCount () const
 Returns the count of all descriptors stored in the training set.
 
const std::vector< Mat > & getDescriptors () const
 Returns a training set of descriptors.
 

Protected Attributes

int attempts
 
int clusterCount
 
int flags
 
TermCriteria termcrit
 
- Protected Attributes inherited from cv::xfeatures2d::BOWTrainer
std::vector< Matdescriptors
 
int size
 

Detailed Description

kmeans -based class to train visual vocabulary using the bag of visual words approach. :

Constructor & Destructor Documentation

◆ BOWKMeansTrainer()

cv::xfeatures2d::BOWKMeansTrainer::BOWKMeansTrainer ( int clusterCount,
const TermCriteria & termcrit = TermCriteria(),
int attempts = 3,
int flags = KMEANS_PP_CENTERS )
Python:
cv.xfeatures2d.BOWKMeansTrainer(clusterCount[, termcrit[, attempts[, flags]]]) -> <xfeatures2d_BOWKMeansTrainer object>

The constructor.

See also
cv::kmeans

◆ ~BOWKMeansTrainer()

virtual cv::xfeatures2d::BOWKMeansTrainer::~BOWKMeansTrainer ( )
virtual

Member Function Documentation

◆ cluster() [1/2]

virtual Mat cv::xfeatures2d::BOWKMeansTrainer::cluster ( ) const
virtual
Python:
cv.xfeatures2d.BOWKMeansTrainer.cluster() -> retval
cv.xfeatures2d.BOWKMeansTrainer.cluster(descriptors) -> retval

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Implements cv::xfeatures2d::BOWTrainer.

◆ cluster() [2/2]

virtual Mat cv::xfeatures2d::BOWKMeansTrainer::cluster ( const Mat & descriptors) const
virtual
Python:
cv.xfeatures2d.BOWKMeansTrainer.cluster() -> retval
cv.xfeatures2d.BOWKMeansTrainer.cluster(descriptors) -> retval

Clusters train descriptors.

Parameters
descriptorsDescriptors to cluster. Each row of the descriptors matrix is a descriptor. Descriptors are not added to the inner train descriptor set.

The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object are clustered. In the second variant, input descriptors are clustered.

Implements cv::xfeatures2d::BOWTrainer.

Member Data Documentation

◆ attempts

int cv::xfeatures2d::BOWKMeansTrainer::attempts
protected

◆ clusterCount

int cv::xfeatures2d::BOWKMeansTrainer::clusterCount
protected

◆ flags

int cv::xfeatures2d::BOWKMeansTrainer::flags
protected

◆ termcrit

TermCriteria cv::xfeatures2d::BOWKMeansTrainer::termcrit
protected

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