Class to compute an image descriptor using the bag of visual words.
More...
#include <opencv2/features2d.hpp>
|
| BOWImgDescriptorExtractor (const Ptr< DescriptorExtractor > &dextractor, const Ptr< DescriptorMatcher > &dmatcher) |
| The constructor. More...
|
|
| BOWImgDescriptorExtractor (const Ptr< DescriptorMatcher > &dmatcher) |
|
virtual | ~BOWImgDescriptorExtractor () |
|
void | compute (InputArray image, std::vector< KeyPoint > &keypoints, OutputArray imgDescriptor, std::vector< std::vector< int > > *pointIdxsOfClusters=0, Mat *descriptors=0) |
| Computes an image descriptor using the set visual vocabulary. More...
|
|
void | compute (InputArray keypointDescriptors, OutputArray imgDescriptor, std::vector< std::vector< int > > *pointIdxsOfClusters=0) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
|
void | compute2 (const Mat &image, std::vector< KeyPoint > &keypoints, Mat &imgDescriptor) |
|
int | descriptorSize () const |
| Returns an image descriptor size if the vocabulary is set. More...
|
|
int | descriptorType () const |
| Returns an image descriptor type. More...
|
|
const Mat & | getVocabulary () const |
| Returns the set vocabulary. More...
|
|
void | setVocabulary (const Mat &vocabulary) |
| Sets a visual vocabulary. More...
|
|
Class to compute an image descriptor using the bag of visual words.
Such a computation consists of the following steps:
- Compute descriptors for a given image and its keypoints set.
- Find the nearest visual words from the vocabulary for each keypoint descriptor.
- Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the vocabulary in the given image.
◆ BOWImgDescriptorExtractor() [1/2]
The constructor.
- Parameters
-
dextractor | Descriptor extractor that is used to compute descriptors for an input image and its keypoints. |
dmatcher | Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image. |
◆ BOWImgDescriptorExtractor() [2/2]
cv::BOWImgDescriptorExtractor::BOWImgDescriptorExtractor |
( |
const Ptr< DescriptorMatcher > & |
dmatcher | ) |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ ~BOWImgDescriptorExtractor()
virtual cv::BOWImgDescriptorExtractor::~BOWImgDescriptorExtractor |
( |
| ) |
|
|
virtual |
◆ compute() [1/2]
void cv::BOWImgDescriptorExtractor::compute |
( |
InputArray |
image, |
|
|
std::vector< KeyPoint > & |
keypoints, |
|
|
OutputArray |
imgDescriptor, |
|
|
std::vector< std::vector< int > > * |
pointIdxsOfClusters = 0 , |
|
|
Mat * |
descriptors = 0 |
|
) |
| |
Computes an image descriptor using the set visual vocabulary.
- Parameters
-
image | Image, for which the descriptor is computed. |
keypoints | Keypoints detected in the input image. |
imgDescriptor | Computed output image descriptor. |
pointIdxsOfClusters | Indices of keypoints that belong to the cluster. This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) returned if it is non-zero. |
descriptors | Descriptors of the image keypoints that are returned if they are non-zero. |
◆ compute() [2/2]
void cv::BOWImgDescriptorExtractor::compute |
( |
InputArray |
keypointDescriptors, |
|
|
OutputArray |
imgDescriptor, |
|
|
std::vector< std::vector< int > > * |
pointIdxsOfClusters = 0 |
|
) |
| |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
keypointDescriptors | Computed descriptors to match with vocabulary. |
imgDescriptor | Computed output image descriptor. |
pointIdxsOfClusters | Indices of keypoints that belong to the cluster. This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) returned if it is non-zero. |
◆ compute2()
void cv::BOWImgDescriptorExtractor::compute2 |
( |
const Mat & |
image, |
|
|
std::vector< KeyPoint > & |
keypoints, |
|
|
Mat & |
imgDescriptor |
|
) |
| |
|
inline |
◆ descriptorSize()
int cv::BOWImgDescriptorExtractor::descriptorSize |
( |
| ) |
const |
Returns an image descriptor size if the vocabulary is set.
Otherwise, it returns 0.
◆ descriptorType()
int cv::BOWImgDescriptorExtractor::descriptorType |
( |
| ) |
const |
Returns an image descriptor type.
◆ getVocabulary()
const Mat& cv::BOWImgDescriptorExtractor::getVocabulary |
( |
| ) |
const |
Returns the set vocabulary.
◆ setVocabulary()
void cv::BOWImgDescriptorExtractor::setVocabulary |
( |
const Mat & |
vocabulary | ) |
|
Sets a visual vocabulary.
- Parameters
-
vocabulary | Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the vocabulary is a visual word (cluster center). |
◆ dextractor
◆ dmatcher
◆ vocabulary
Mat cv::BOWImgDescriptorExtractor::vocabulary |
|
protected |
The documentation for this class was generated from the following file: