From 52bfa7b850a0119eeb5e5bd7b8bb9a9025560223 Mon Sep 17 00:00:00 2001 From: StevenPuttemans Date: Fri, 19 Jul 2013 09:29:48 +0200 Subject: [PATCH] Fixed bug 1873 : return image keypoint descriptors + fix on line 152 pure declaration --- modules/features2d/src/bagofwords.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 9770064c90..898c6342dd 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -149,7 +149,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector& key int clusterCount = descriptorSize(); // = vocabulary.rows // Compute descriptors for the image. - Mat descriptors = _descriptors ? *_descriptors : Mat(); + Mat descriptors; dextractor->compute( image, keypoints, descriptors ); // Match keypoint descriptors to cluster center (to vocabulary) @@ -178,6 +178,11 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector& key // Normalize image descriptor. imgDescriptor /= descriptors.rows; + + // Add the descriptors of image keypoints + if (_descriptors) { + *_descriptors = descriptors.clone(); + } } int BOWImgDescriptorExtractor::descriptorSize() const