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

Abstract base class for training the bag of visual words vocabulary from a set of descriptors. More...

#include <opencv2/xfeatures2d.hpp>

Collaboration diagram for cv::xfeatures2d::BOWTrainer:

Public Member Functions

 BOWTrainer ()
 
virtual ~BOWTrainer ()
 
void add (const Mat &descriptors)
 Adds descriptors to a training set.
 
virtual void clear ()
 
virtual Mat cluster () const =0
 
virtual Mat cluster (const Mat &descriptors) const =0
 Clusters train descriptors.
 
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

std::vector< Matdescriptors
 
int size
 

Detailed Description

Abstract base class for training the bag of visual words vocabulary from a set of descriptors.

For details, see, for example, Visual Categorization with Bags of Keypoints by Gabriella Csurka, Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :

Constructor & Destructor Documentation

◆ BOWTrainer()

cv::xfeatures2d::BOWTrainer::BOWTrainer ( )

◆ ~BOWTrainer()

virtual cv::xfeatures2d::BOWTrainer::~BOWTrainer ( )
virtual

Member Function Documentation

◆ add()

void cv::xfeatures2d::BOWTrainer::add ( const Mat & descriptors)
Python:
cv.xfeatures2d.BOWTrainer.add(descriptors) -> None

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::xfeatures2d::BOWTrainer::clear ( )
virtual
Python:
cv.xfeatures2d.BOWTrainer.clear() -> None

◆ cluster() [1/2]

virtual Mat cv::xfeatures2d::BOWTrainer::cluster ( ) const
pure virtual
Python:
cv.xfeatures2d.BOWTrainer.cluster() -> retval
cv.xfeatures2d.BOWTrainer.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.

Implemented in cv::xfeatures2d::BOWKMeansTrainer.

◆ cluster() [2/2]

virtual Mat cv::xfeatures2d::BOWTrainer::cluster ( const Mat & descriptors) const
pure virtual
Python:
cv.xfeatures2d.BOWTrainer.cluster() -> retval
cv.xfeatures2d.BOWTrainer.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.

Implemented in cv::xfeatures2d::BOWKMeansTrainer.

◆ descriptorsCount()

int cv::xfeatures2d::BOWTrainer::descriptorsCount ( ) const
Python:
cv.xfeatures2d.BOWTrainer.descriptorsCount() -> retval

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

◆ getDescriptors()

const std::vector< Mat > & cv::xfeatures2d::BOWTrainer::getDescriptors ( ) const
Python:
cv.xfeatures2d.BOWTrainer.getDescriptors() -> retval

Returns a training set of descriptors.

Member Data Documentation

◆ descriptors

std::vector<Mat> cv::xfeatures2d::BOWTrainer::descriptors
protected

◆ size

int cv::xfeatures2d::BOWTrainer::size
protected

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