OpenCV  4.1.1-pre
Open Source Computer Vision
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!
cv::BOWKMeansTrainer Class Reference

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

#include <opencv2/features2d.hpp>

Inheritance diagram for cv::BOWKMeansTrainer:
Collaboration diagram for cv::BOWKMeansTrainer:

Public Member Functions

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

Protected Attributes

int attempts
 
int clusterCount
 
std::vector< Matdescriptors
 
int flags
 
int size
 
TermCriteria termcrit
 

Detailed Description

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

:

Constructor & Destructor Documentation

◆ BOWKMeansTrainer()

cv::BOWKMeansTrainer::BOWKMeansTrainer ( int  clusterCount,
const TermCriteria termcrit = TermCriteria(),
int  attempts = 3,
int  flags = KMEANS_PP_CENTERS 
)

The constructor.

See also
cv::kmeans

◆ ~BOWKMeansTrainer()

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

Member Function Documentation

◆ add()

void cv::BOWTrainer::add ( const Mat descriptors)
inherited

Adds descriptors to a training set.

Parameters
descriptorsDescriptors to add to a training set. Each row of the descriptors matrix is a descriptor.

The training set is clustered using clustermethod to construct the vocabulary.

◆ clear()

virtual void cv::BOWTrainer::clear ( )
virtualinherited

◆ cluster() [1/2]

virtual Mat cv::BOWKMeansTrainer::cluster ( ) const
virtual

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

Implements cv::BOWTrainer.

◆ cluster() [2/2]

virtual Mat cv::BOWKMeansTrainer::cluster ( const Mat descriptors) const
virtual

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::BOWTrainer.

◆ descriptorsCount()

int cv::BOWTrainer::descriptorsCount ( ) const
inherited

Returns the count of all descriptors stored in the training set.

◆ getDescriptors()

const std::vector<Mat>& cv::BOWTrainer::getDescriptors ( ) const
inherited

Returns a training set of descriptors.

Member Data Documentation

◆ attempts

int cv::BOWKMeansTrainer::attempts
protected

◆ clusterCount

int cv::BOWKMeansTrainer::clusterCount
protected

◆ descriptors

std::vector<Mat> cv::BOWTrainer::descriptors
protectedinherited

◆ flags

int cv::BOWKMeansTrainer::flags
protected

◆ size

int cv::BOWTrainer::size
protectedinherited

◆ termcrit

TermCriteria cv::BOWKMeansTrainer::termcrit
protected

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