From d7c86bbcdced7f478348e725c4a76e755b3f22c1 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Mon, 8 Nov 2010 15:21:56 +0000 Subject: [PATCH] minor change of BOW --- modules/features2d/include/opencv2/features2d/features2d.hpp | 2 +- modules/features2d/src/bagofwords.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 0691f8a..e381e44 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -2468,7 +2468,7 @@ public: void setVocabulary( const Mat& vocabulary ); const Mat& getVocabulary() const { return vocabulary; } void compute( const Mat& image, vector& keypoints, Mat& imgDescriptor, - vector >* pointIdxsOfClusters=0 ); //not constant because DescriptorMatcher::match is not constant + vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ); //not constant because DescriptorMatcher::match is not constant int descriptorSize() const { return vocabulary.empty() ? 0 : vocabulary.rows; } int descriptorType() const { return CV_32FC1; } diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 3cf0960..dc056cc 100755 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -112,7 +112,7 @@ void BOWImgDescriptorExtractor::setVocabulary( const Mat& _vocabulary ) } void BOWImgDescriptorExtractor::compute( const Mat& image, vector& keypoints, Mat& imgDescriptor, - vector >* pointIdxsOfClusters ) + vector >* pointIdxsOfClusters, Mat* _descriptors ) { imgDescriptor.release(); @@ -122,7 +122,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector& key int clusterCount = descriptorSize(); // = vocabulary.rows // Compute descriptors for the image. - Mat descriptors; + Mat descriptors = _descriptors ? *_descriptors : Mat(); dextractor->compute( image, keypoints, descriptors ); // Match keypoint descriptors to cluster center (to vocabulary) -- 2.7.4