Merge pull request #1156 from StevenPuttemans:bugfix_1873_new

This commit is contained in:
Andrey Pavlenko 2013-07-21 18:46:58 +04:00 committed by OpenCV Buildbot
commit cdcb5ed134

View File

@ -149,7 +149,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& key
int clusterCount = descriptorSize(); // = vocabulary.rows int clusterCount = descriptorSize(); // = vocabulary.rows
// Compute descriptors for the image. // Compute descriptors for the image.
Mat descriptors = _descriptors ? *_descriptors : Mat(); Mat descriptors;
dextractor->compute( image, keypoints, descriptors ); dextractor->compute( image, keypoints, descriptors );
// Match keypoint descriptors to cluster center (to vocabulary) // Match keypoint descriptors to cluster center (to vocabulary)
@ -178,6 +178,11 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& key
// Normalize image descriptor. // Normalize image descriptor.
imgDescriptor /= descriptors.rows; imgDescriptor /= descriptors.rows;
// Add the descriptors of image keypoints
if (_descriptors) {
*_descriptors = descriptors.clone();
}
} }
int BOWImgDescriptorExtractor::descriptorSize() const int BOWImgDescriptorExtractor::descriptorSize() const