From e4b41d38f12effe118c7e30a1a94d56150cabd55 Mon Sep 17 00:00:00 2001 From: StevenPuttemans Date: Mon, 16 Dec 2013 10:47:24 +0100 Subject: [PATCH] Fixed descripotorsCount to descriptorsCount See feature 2862 --- modules/features2d/doc/object_categorization.rst | 6 +++--- modules/features2d/include/opencv2/features2d.hpp | 2 +- modules/features2d/src/bagofwords.cpp | 2 +- samples/cpp/bagofwords_classification.cpp | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/features2d/doc/object_categorization.rst b/modules/features2d/doc/object_categorization.rst index 644634fd06..8269195196 100644 --- a/modules/features2d/doc/object_categorization.rst +++ b/modules/features2d/doc/object_categorization.rst @@ -27,7 +27,7 @@ Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :: void add( const Mat& descriptors ); const vector& getDescriptors() const; - int descripotorsCount() const; + int descriptorsCount() const; virtual void clear(); @@ -56,11 +56,11 @@ Returns a training set of descriptors. -BOWTrainer::descripotorsCount +BOWTrainer::descriptorsCount --------------------------------- Returns the count of all descriptors stored in the training set. -.. ocv:function:: int BOWTrainer::descripotorsCount() const +.. ocv:function:: int BOWTrainer::descriptorsCount() const diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 9cbae22168..6764af118c 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -1453,7 +1453,7 @@ public: void add( const Mat& descriptors ); const std::vector& getDescriptors() const; - int descripotorsCount() const; + int descriptorsCount() const; virtual void clear(); diff --git a/modules/features2d/src/bagofwords.cpp b/modules/features2d/src/bagofwords.cpp index a257f6cbe4..a3cfb60a90 100644 --- a/modules/features2d/src/bagofwords.cpp +++ b/modules/features2d/src/bagofwords.cpp @@ -72,7 +72,7 @@ const std::vector& BOWTrainer::getDescriptors() const return descriptors; } -int BOWTrainer::descripotorsCount() const +int BOWTrainer::descriptorsCount() const { return descriptors.empty() ? 0 : size; } diff --git a/samples/cpp/bagofwords_classification.cpp b/samples/cpp/bagofwords_classification.cpp index 20ff1dcfbb..c9d289e816 100644 --- a/samples/cpp/bagofwords_classification.cpp +++ b/samples/cpp/bagofwords_classification.cpp @@ -2146,12 +2146,12 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca while( images.size() > 0 ) { - if( bowTrainer.descripotorsCount() > maxDescCount ) + if( bowTrainer.descriptorsCount() > maxDescCount ) { #ifdef DEBUG_DESC_PROGRESS - cout << "Breaking due to full memory ( descriptors count = " << bowTrainer.descripotorsCount() + cout << "Breaking due to full memory ( descriptors count = " << bowTrainer.descriptorsCount() << "; descriptor size in bytes = " << descByteSize << "; all used memory = " - << bowTrainer.descripotorsCount()*descByteSize << endl; + << bowTrainer.descriptorsCount()*descByteSize << endl; #endif break; } @@ -2182,7 +2182,7 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca for( int i = 0; i < descCount; i++ ) { - if( usedMask[i] && bowTrainer.descripotorsCount() < maxDescCount ) + if( usedMask[i] && bowTrainer.descriptorsCount() < maxDescCount ) bowTrainer.add( imageDescriptors.row(i) ); } } @@ -2190,7 +2190,7 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca #ifdef DEBUG_DESC_PROGRESS cout << images.size() << " images left, " << images[randImgIdx].id << " processed - " <(bowTrainer.descripotorsCount())/static_cast(maxDescCount))*100.0) + cvRound((static_cast(bowTrainer.descriptorsCount())/static_cast(maxDescCount))*100.0) << " % memory used" << ( imageDescriptors.empty() ? " -> no descriptors extracted, skipping" : "") << endl; #endif @@ -2198,7 +2198,7 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca images.erase( images.begin() + randImgIdx ); } - cout << "Maximum allowed descriptor count: " << maxDescCount << ", Actual descriptor count: " << bowTrainer.descripotorsCount() << endl; + cout << "Maximum allowed descriptor count: " << maxDescCount << ", Actual descriptor count: " << bowTrainer.descriptorsCount() << endl; cout << "Training vocabulary..." << endl; vocabulary = bowTrainer.cluster();