Abstract base class for training the bag of visual words vocabulary from a set of descriptors. More...
#include <opencv2/features2d.hpp>
Public Member Functions | |
BOWTrainer () | |
virtual | ~BOWTrainer () |
void | add (const Mat &descriptors) |
Adds descriptors to a training set. More... | |
virtual void | clear () |
virtual Mat | cluster () const =0 |
virtual Mat | cluster (const Mat &descriptors) const =0 |
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 | |
std::vector< Mat > | descriptors |
int | size |
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. :
cv::BOWTrainer::BOWTrainer | ( | ) |
|
virtual |
void cv::BOWTrainer::add | ( | const Mat & | descriptors | ) |
Adds descriptors to a training set.
descriptors | Descriptors 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.
|
virtual |
|
pure virtual |
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::BOWKMeansTrainer.
Clusters train descriptors.
descriptors | Descriptors 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::BOWKMeansTrainer.
int cv::BOWTrainer::descriptorsCount | ( | ) | const |
Returns the count of all descriptors stored in the training set.
const std::vector<Mat>& cv::BOWTrainer::getDescriptors | ( | ) | const |
Returns a training set of descriptors.
|
protected |
|
protected |