Merge pull request #1993 from StevenPuttemans:feature_2862

pull/1996/merge
Roman Donchenko 11 years ago committed by OpenCV Buildbot
commit 0cf7607338
  1. 6
      modules/features2d/doc/object_categorization.rst
  2. 2
      modules/features2d/include/opencv2/features2d.hpp
  3. 2
      modules/features2d/src/bagofwords.cpp
  4. 12
      samples/cpp/bagofwords_classification.cpp

@ -27,7 +27,7 @@ Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. ::
void add( const Mat& descriptors ); void add( const Mat& descriptors );
const vector<Mat>& getDescriptors() const; const vector<Mat>& getDescriptors() const;
int descripotorsCount() const; int descriptorsCount() const;
virtual void clear(); 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. Returns the count of all descriptors stored in the training set.
.. ocv:function:: int BOWTrainer::descripotorsCount() const .. ocv:function:: int BOWTrainer::descriptorsCount() const

@ -1453,7 +1453,7 @@ public:
void add( const Mat& descriptors ); void add( const Mat& descriptors );
const std::vector<Mat>& getDescriptors() const; const std::vector<Mat>& getDescriptors() const;
int descripotorsCount() const; int descriptorsCount() const;
virtual void clear(); virtual void clear();

@ -72,7 +72,7 @@ const std::vector<Mat>& BOWTrainer::getDescriptors() const
return descriptors; return descriptors;
} }
int BOWTrainer::descripotorsCount() const int BOWTrainer::descriptorsCount() const
{ {
return descriptors.empty() ? 0 : size; return descriptors.empty() ? 0 : size;
} }

@ -2146,12 +2146,12 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
while( images.size() > 0 ) while( images.size() > 0 )
{ {
if( bowTrainer.descripotorsCount() > maxDescCount ) if( bowTrainer.descriptorsCount() > maxDescCount )
{ {
#ifdef DEBUG_DESC_PROGRESS #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 = " << "; descriptor size in bytes = " << descByteSize << "; all used memory = "
<< bowTrainer.descripotorsCount()*descByteSize << endl; << bowTrainer.descriptorsCount()*descByteSize << endl;
#endif #endif
break; break;
} }
@ -2182,7 +2182,7 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
for( int i = 0; i < descCount; i++ ) for( int i = 0; i < descCount; i++ )
{ {
if( usedMask[i] && bowTrainer.descripotorsCount() < maxDescCount ) if( usedMask[i] && bowTrainer.descriptorsCount() < maxDescCount )
bowTrainer.add( imageDescriptors.row(i) ); bowTrainer.add( imageDescriptors.row(i) );
} }
} }
@ -2190,7 +2190,7 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
#ifdef DEBUG_DESC_PROGRESS #ifdef DEBUG_DESC_PROGRESS
cout << images.size() << " images left, " << images[randImgIdx].id << " processed - " cout << images.size() << " images left, " << images[randImgIdx].id << " processed - "
<</* descs_extracted << "/" << image_descriptors.rows << " extracted - " << */ <</* descs_extracted << "/" << image_descriptors.rows << " extracted - " << */
cvRound((static_cast<double>(bowTrainer.descripotorsCount())/static_cast<double>(maxDescCount))*100.0) cvRound((static_cast<double>(bowTrainer.descriptorsCount())/static_cast<double>(maxDescCount))*100.0)
<< " % memory used" << ( imageDescriptors.empty() ? " -> no descriptors extracted, skipping" : "") << endl; << " % memory used" << ( imageDescriptors.empty() ? " -> no descriptors extracted, skipping" : "") << endl;
#endif #endif
@ -2198,7 +2198,7 @@ static Mat trainVocabulary( const string& filename, VocData& vocData, const Voca
images.erase( images.begin() + randImgIdx ); 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; cout << "Training vocabulary..." << endl;
vocabulary = bowTrainer.cluster(); vocabulary = bowTrainer.cluster();

Loading…
Cancel
Save