Skip to content

Commit cdcb5ed

Browse files
Andrey PavlenkoOpenCV Buildbot
authored andcommitted
Merge pull request opencv#1156 from StevenPuttemans:bugfix_1873_new
2 parents 1c35f12 + 52bfa7b commit cdcb5ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/features2d/src/bagofwords.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& key
149149
int clusterCount = descriptorSize(); // = vocabulary.rows
150150

151151
// Compute descriptors for the image.
152-
Mat descriptors = _descriptors ? *_descriptors : Mat();
152+
Mat descriptors;
153153
dextractor->compute( image, keypoints, descriptors );
154154

155155
// Match keypoint descriptors to cluster center (to vocabulary)
@@ -178,6 +178,11 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& key
178178

179179
// Normalize image descriptor.
180180
imgDescriptor /= descriptors.rows;
181+
182+
// Add the descriptors of image keypoints
183+
if (_descriptors) {
184+
*_descriptors = descriptors.clone();
185+
}
181186
}
182187

183188
int BOWImgDescriptorExtractor::descriptorSize() const

0 commit comments

Comments
 (0)