From 43c98188953f1a31b333346495883c7c112a1fce Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Sun, 18 Aug 2013 11:32:04 +1200 Subject: [PATCH 01/11] Adding class for BOW image matcher (Feature #3005). Same prototype as BOWImgDescriptorExtractor, but do only the matching. If the feature is accepted, the BOWImgDescriptorExtractor and BOWImgDescriptorMatcher should probably refactor with inheritance. Add a class to compute the keypoints, descriptors and matching from an image should be added to. --- .../features2d/include/opencv2/features2d.hpp | 35 +++++++++ modules/features2d/src/bagofwords.cpp | 72 +++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 1f0a92c188..2474dd5940 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -1519,6 +1519,41 @@ protected: Ptr dmatcher; }; +/* + * Class to match image descriptors using bag of visual words. + */ +class CV_EXPORTS BOWImgDescriptorMatcher +{ +public: + BOWImgDescriptorMatcher( const Ptr& _dmatcher ); + virtual ~BOWImgDescriptorMatcher(); + + /* + * Compute the matching of the current descriptor according to the vocabulary. + * + * vocDescriptor the descriptors to match + * pointIdxsOfClusters vector of matching + */ + void compute( const Mat & descriptors, Mat& vocDescriptor, std::vector< std::vector< int > > * pointIdxsOfClusters = 0 ); + + /* + * Set the vocabulary + */ + void setVocabulary( const Mat& vocabulary ); + const Mat& getVocabulary() const; + + int descriptorSize() const; + int descriptorType() const; + +protected: + Mat vocabulary; + Ptr dmatcher; + +private: + int _type; +}; + + } /* namespace cv */ #endif diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 4307983fe0..5ef8b5c4bb 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -193,4 +193,76 @@ int BOWImgDescriptorExtractor::descriptorType() const return CV_32FC1; } +BOWImgDescriptorMatcher::BOWImgDescriptorMatcher( const Ptr& _dmatcher ) : + dmatcher(_dmatcher), + _type( -1 ) +{} + +BOWImgDescriptorMatcher::~BOWImgDescriptorMatcher() +{} + +void BOWImgDescriptorMatcher::setVocabulary( const Mat& _vocabulary ) +{ + dmatcher->clear(); + CV_Assert( _vocabulary.type() == CV_32F ); + vocabulary = _vocabulary; + dmatcher->add( std::vector(1, vocabulary) ); +} + +const Mat& BOWImgDescriptorMatcher::getVocabulary() const +{ + return vocabulary; +} + +void BOWImgDescriptorMatcher::compute( const Mat & descriptors, Mat& vocDescriptor, std::vector > * pointIdxsOfClusters ) +{ + vocDescriptor.release(); + + int clusterCount = descriptorSize(); // = vocabulary.rows + + _type = descriptors.type(); + + Mat _descriptors; + if( _type != CV_32F ) + descriptors.convertTo( _descriptors, CV_32F ); + else + descriptors.copyTo( _descriptors ); + // Match keypoint descriptors to cluster center (to vocabulary) + std::vector matches; + dmatcher->match( _descriptors, matches ); + + // Compute image descriptor + if( pointIdxsOfClusters ) + { + pointIdxsOfClusters->clear(); + pointIdxsOfClusters->resize(clusterCount); + } + + vocDescriptor = Mat::zeros( 1, clusterCount, descriptorType() ); + float *dptr = (float*)vocDescriptor.data; + for( size_t i = 0; i < matches.size(); i++ ) + { + int queryIdx = matches[i].queryIdx; + int trainIdx = matches[i].trainIdx; // cluster index + CV_Assert( queryIdx == (int)i ); + + dptr[trainIdx] = dptr[trainIdx] + 1.f; + if( pointIdxsOfClusters ) + (*pointIdxsOfClusters)[trainIdx].push_back( queryIdx ); + } + + // Normalize image descriptor. + vocDescriptor /= descriptors.rows; +} + +int BOWImgDescriptorMatcher::descriptorSize() const +{ + return vocabulary.empty() ? 0 : vocabulary.rows; +} + +int BOWImgDescriptorMatcher::descriptorType() const +{ + return _type; +} + } From 464985205c3a011dec5a789adb38f7a50ebf9df9 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Thu, 5 Sep 2013 16:05:54 +1200 Subject: [PATCH 02/11] Update PR after mdim review. --- .../features2d/doc/object_categorization.rst | 7 ++ .../features2d/include/opencv2/features2d.hpp | 38 +-------- modules/features2d/src/bagofwords.cpp | 85 +++---------------- 3 files changed, 22 insertions(+), 108 deletions(-) diff --git a/modules/features2d/doc/object_categorization.rst b/modules/features2d/doc/object_categorization.rst index 73089ce7ad..3cde0ec5bd 100644 --- a/modules/features2d/doc/object_categorization.rst +++ b/modules/features2d/doc/object_categorization.rst @@ -118,6 +118,7 @@ The class declaration is the following: :: public: BOWImgDescriptorExtractor( const Ptr& dextractor, const Ptr& dmatcher ); + BOWImgDescriptorExtractor( const Ptr& dmatcher ); virtual ~BOWImgDescriptorExtractor(){} void setVocabulary( const Mat& vocabulary ); @@ -126,6 +127,8 @@ The class declaration is the following: :: Mat& imgDescriptor, vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ); + void compute( const Mat& descriptors, Mat& imgDescriptor, + std::vector >* pointIdxsOfClusters=0 ); int descriptorSize() const; int descriptorType() const; @@ -141,6 +144,7 @@ BOWImgDescriptorExtractor::BOWImgDescriptorExtractor The constructor. .. ocv:function:: BOWImgDescriptorExtractor::BOWImgDescriptorExtractor( const Ptr& dextractor, const Ptr& dmatcher ) +.. ocv:function:: BOWImgDescriptorExtractor::BOWImgDescriptorExtractor( const Ptr& dmatcher ) :param dextractor: Descriptor extractor that is used to compute descriptors for an input image and its keypoints. @@ -171,11 +175,14 @@ BOWImgDescriptorExtractor::compute Computes an image descriptor using the set visual vocabulary. .. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& image, vector& keypoints, Mat& imgDescriptor, vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ) +.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& descriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) :param image: Image, for which the descriptor is computed. :param keypoints: Keypoints detected in the input image. + :param descriptors: Computed descriptors to match with vocabulary. + :param imgDescriptor: Computed output image descriptor. :param 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. diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 2474dd5940..d189b7e8ed 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -1502,12 +1502,15 @@ class CV_EXPORTS BOWImgDescriptorExtractor public: BOWImgDescriptorExtractor( const Ptr& dextractor, const Ptr& dmatcher ); + BOWImgDescriptorExtractor( const Ptr& dmatcher ); virtual ~BOWImgDescriptorExtractor(); void setVocabulary( const Mat& vocabulary ); const Mat& getVocabulary() const; void compute( const Mat& image, std::vector& keypoints, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ); + void compute( const Mat& keypointDescriptors, Mat& imgDescriptor, + std::vector >* pointIdxsOfClusters=0 ); // compute() is not constant because DescriptorMatcher::match is not constant int descriptorSize() const; @@ -1519,41 +1522,6 @@ protected: Ptr dmatcher; }; -/* - * Class to match image descriptors using bag of visual words. - */ -class CV_EXPORTS BOWImgDescriptorMatcher -{ -public: - BOWImgDescriptorMatcher( const Ptr& _dmatcher ); - virtual ~BOWImgDescriptorMatcher(); - - /* - * Compute the matching of the current descriptor according to the vocabulary. - * - * vocDescriptor the descriptors to match - * pointIdxsOfClusters vector of matching - */ - void compute( const Mat & descriptors, Mat& vocDescriptor, std::vector< std::vector< int > > * pointIdxsOfClusters = 0 ); - - /* - * Set the vocabulary - */ - void setVocabulary( const Mat& vocabulary ); - const Mat& getVocabulary() const; - - int descriptorSize() const; - int descriptorType() const; - -protected: - Mat vocabulary; - Ptr dmatcher; - -private: - int _type; -}; - - } /* namespace cv */ #endif diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 5ef8b5c4bb..11f8c4ba37 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -121,6 +121,10 @@ BOWImgDescriptorExtractor::BOWImgDescriptorExtractor( const Ptr& _dmatcher ) : + dmatcher(_dmatcher) +{} + BOWImgDescriptorExtractor::~BOWImgDescriptorExtractor() {} @@ -144,38 +148,11 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector if( keypoints.empty() ) return; - int clusterCount = descriptorSize(); // = vocabulary.rows - // Compute descriptors for the image. Mat descriptors; dextractor->compute( image, keypoints, descriptors ); - // Match keypoint descriptors to cluster center (to vocabulary) - std::vector matches; - dmatcher->match( descriptors, matches ); - - // Compute image descriptor - if( pointIdxsOfClusters ) - { - pointIdxsOfClusters->clear(); - pointIdxsOfClusters->resize(clusterCount); - } - - imgDescriptor = Mat( 1, clusterCount, descriptorType(), Scalar::all(0.0) ); - float *dptr = (float*)imgDescriptor.data; - for( size_t i = 0; i < matches.size(); i++ ) - { - int queryIdx = matches[i].queryIdx; - int trainIdx = matches[i].trainIdx; // cluster index - CV_Assert( queryIdx == (int)i ); - - dptr[trainIdx] = dptr[trainIdx] + 1.f; - if( pointIdxsOfClusters ) - (*pointIdxsOfClusters)[trainIdx].push_back( queryIdx ); - } - - // Normalize image descriptor. - imgDescriptor /= descriptors.rows; + compute( descriptors, imgDescriptor, pointIdxsOfClusters ); // Add the descriptors of image keypoints if (_descriptors) { @@ -193,44 +170,16 @@ int BOWImgDescriptorExtractor::descriptorType() const return CV_32FC1; } -BOWImgDescriptorMatcher::BOWImgDescriptorMatcher( const Ptr& _dmatcher ) : - dmatcher(_dmatcher), - _type( -1 ) -{} - -BOWImgDescriptorMatcher::~BOWImgDescriptorMatcher() -{} - -void BOWImgDescriptorMatcher::setVocabulary( const Mat& _vocabulary ) -{ - dmatcher->clear(); - CV_Assert( _vocabulary.type() == CV_32F ); - vocabulary = _vocabulary; - dmatcher->add( std::vector(1, vocabulary) ); -} - -const Mat& BOWImgDescriptorMatcher::getVocabulary() const +void BOWImgDescriptorExtractor::compute( const Mat& descriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) { - return vocabulary; -} + CV_Assert( vocabulary.empty() != false ); -void BOWImgDescriptorMatcher::compute( const Mat & descriptors, Mat& vocDescriptor, std::vector > * pointIdxsOfClusters ) -{ - vocDescriptor.release(); - int clusterCount = descriptorSize(); // = vocabulary.rows - _type = descriptors.type(); - - Mat _descriptors; - if( _type != CV_32F ) - descriptors.convertTo( _descriptors, CV_32F ); - else - descriptors.copyTo( _descriptors ); // Match keypoint descriptors to cluster center (to vocabulary) std::vector matches; - dmatcher->match( _descriptors, matches ); - + dmatcher->match( descriptors, matches ); + // Compute image descriptor if( pointIdxsOfClusters ) { @@ -238,8 +187,8 @@ void BOWImgDescriptorMatcher::compute( const Mat & descriptors, Mat& vocDescript pointIdxsOfClusters->resize(clusterCount); } - vocDescriptor = Mat::zeros( 1, clusterCount, descriptorType() ); - float *dptr = (float*)vocDescriptor.data; + imgDescriptor = Mat( 1, clusterCount, descriptorType(), Scalar::all(0.0) ); + float *dptr = (float*)imgDescriptor.data; for( size_t i = 0; i < matches.size(); i++ ) { int queryIdx = matches[i].queryIdx; @@ -252,17 +201,7 @@ void BOWImgDescriptorMatcher::compute( const Mat & descriptors, Mat& vocDescript } // Normalize image descriptor. - vocDescriptor /= descriptors.rows; -} - -int BOWImgDescriptorMatcher::descriptorSize() const -{ - return vocabulary.empty() ? 0 : vocabulary.rows; -} - -int BOWImgDescriptorMatcher::descriptorType() const -{ - return _type; + imgDescriptor /= descriptors.rows; } } From 0c4da123e9ec924cd70f5ec6751040a38f1c24b3 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Sun, 24 Nov 2013 14:33:41 +0100 Subject: [PATCH 03/11] Remove duplicate functions. --- modules/features2d/src/bagofwords.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index c0b4b26096..11f8c4ba37 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -204,14 +204,4 @@ void BOWImgDescriptorExtractor::compute( const Mat& descriptors, Mat& imgDescrip imgDescriptor /= descriptors.rows; } -int BOWImgDescriptorExtractor::descriptorSize() const -{ - return vocabulary.empty() ? 0 : vocabulary.rows; -} - -int BOWImgDescriptorExtractor::descriptorType() const -{ - return CV_32FC1; -} - } From bf84d476fc0587f3021b5b5ca638b5160d10d44b Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Sun, 24 Nov 2013 15:38:48 +0100 Subject: [PATCH 04/11] Fix useless space... --- modules/features2d/src/bagofwords.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 11f8c4ba37..8416ebd93f 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -153,10 +153,10 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector dextractor->compute( image, keypoints, descriptors ); compute( descriptors, imgDescriptor, pointIdxsOfClusters ); - + // Add the descriptors of image keypoints if (_descriptors) { - *_descriptors = descriptors.clone(); + *_descriptors = descriptors.clone(); } } From 9dc713eaba7c3bb290a24153def2699e9d8a71af Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Sun, 24 Nov 2013 15:45:05 +0100 Subject: [PATCH 05/11] Fix name of parameter to have proper documentation. --- modules/features2d/src/bagofwords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 8416ebd93f..5eb1dd585a 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -170,7 +170,7 @@ int BOWImgDescriptorExtractor::descriptorType() const return CV_32FC1; } -void BOWImgDescriptorExtractor::compute( const Mat& descriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) +void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) { CV_Assert( vocabulary.empty() != false ); From e8b86c86631c50de5457c7e61a918e9a525c58f6 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Sun, 24 Nov 2013 17:14:23 +0100 Subject: [PATCH 06/11] Fix name of one parameter to fit the documentation. --- modules/features2d/src/bagofwords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 5eb1dd585a..21301050ca 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -178,7 +178,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& im // Match keypoint descriptors to cluster center (to vocabulary) std::vector matches; - dmatcher->match( descriptors, matches ); + dmatcher->match( keypointDescriptors, matches ); // Compute image descriptor if( pointIdxsOfClusters ) From c90fe65f22508271e0723860739afdeec1ed5e73 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Sun, 24 Nov 2013 17:16:45 +0100 Subject: [PATCH 07/11] Fix compilation issue related to previous commit. --- modules/features2d/src/bagofwords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index 21301050ca..a98b9723cc 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -201,7 +201,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& im } // Normalize image descriptor. - imgDescriptor /= descriptors.rows; + imgDescriptor /= keypointDescriptors.rows; } } From 4f74e2509ba8bc0baccfbc1e3eefebcd013fd0a8 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Tue, 26 Nov 2013 22:50:26 +0100 Subject: [PATCH 08/11] Fix the documentation names. --- modules/features2d/doc/object_categorization.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/features2d/doc/object_categorization.rst b/modules/features2d/doc/object_categorization.rst index 55fcdee3c3..480efe2513 100644 --- a/modules/features2d/doc/object_categorization.rst +++ b/modules/features2d/doc/object_categorization.rst @@ -181,13 +181,13 @@ BOWImgDescriptorExtractor::compute Computes an image descriptor using the set visual vocabulary. .. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& image, vector& keypoints, Mat& imgDescriptor, vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ) -.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& descriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) +.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) :param image: Image, for which the descriptor is computed. :param keypoints: Keypoints detected in the input image. - :param descriptors: Computed descriptors to match with vocabulary. + :param keypointDescriptors: Computed descriptors to match with vocabulary. :param imgDescriptor: Computed output image descriptor. From 99c8b8c016950c33f184b8f1753de23f075cf457 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Wed, 27 Nov 2013 11:06:52 +0100 Subject: [PATCH 09/11] Fix parameter name to fit documentation. --- modules/features2d/src/bagofwords.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index a98b9723cc..e04bedb644 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -141,7 +141,7 @@ const Mat& BOWImgDescriptorExtractor::getVocabulary() const } void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector& keypoints, Mat& imgDescriptor, - std::vector >* pointIdxsOfClusters, Mat* _descriptors ) + std::vector >* pointIdxsOfClusters, Mat* descriptors ) { imgDescriptor.release(); @@ -155,8 +155,8 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector compute( descriptors, imgDescriptor, pointIdxsOfClusters ); // Add the descriptors of image keypoints - if (_descriptors) { - *_descriptors = descriptors.clone(); + if (descriptors) { + *descriptors = descriptors.clone(); } } From b413bcbba4df4c619ce2bceab7bc1709f4f4eac7 Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Wed, 27 Nov 2013 11:36:34 +0100 Subject: [PATCH 10/11] Fix shadow parameter. --- modules/features2d/src/bagofwords.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index e04bedb644..6d181ca69d 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -149,14 +149,14 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector return; // Compute descriptors for the image. - Mat descriptors; - dextractor->compute( image, keypoints, descriptors ); + Mat _descriptors; + dextractor->compute( image, keypoints, _descriptors ); - compute( descriptors, imgDescriptor, pointIdxsOfClusters ); + compute( _descriptors, imgDescriptor, pointIdxsOfClusters ); // Add the descriptors of image keypoints if (descriptors) { - *descriptors = descriptors.clone(); + *descriptors = _descriptors.clone(); } } From fb9c59dd8d68cd310c6d81952c55626b7f87a07f Mon Sep 17 00:00:00 2001 From: Mathieu Barnachon Date: Wed, 27 Nov 2013 18:14:37 +0100 Subject: [PATCH 11/11] Fix default argument. --- modules/features2d/doc/object_categorization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/features2d/doc/object_categorization.rst b/modules/features2d/doc/object_categorization.rst index 480efe2513..6f5a923d5a 100644 --- a/modules/features2d/doc/object_categorization.rst +++ b/modules/features2d/doc/object_categorization.rst @@ -181,7 +181,7 @@ BOWImgDescriptorExtractor::compute Computes an image descriptor using the set visual vocabulary. .. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& image, vector& keypoints, Mat& imgDescriptor, vector >* pointIdxsOfClusters=0, Mat* descriptors=0 ) -.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters ) +.. ocv:function:: void BOWImgDescriptorExtractor::compute( const Mat& keypointDescriptors, Mat& imgDescriptor, std::vector >* pointIdxsOfClusters=0 ) :param image: Image, for which the descriptor is computed.