Update bagofwords.cpp

This commit is contained in:
Juan Pablo Aveggio 2016-08-02 20:53:05 -03:00 committed by GitHub
parent fc742da6e3
commit ba5f9d68c4

View File

@ -91,11 +91,7 @@ Mat BOWKMeansTrainer::cluster() const
{ {
CV_Assert( !descriptors.empty() ); CV_Assert( !descriptors.empty() );
int descCount = 0; Mat mergedDescriptors( descriptorsCount(), descriptors[0].cols, descriptors[0].type() );
for( size_t i = 0; i < descriptors.size(); i++ )
descCount += descriptors[i].rows;
Mat mergedDescriptors( descCount, descriptors[0].cols, descriptors[0].type() );
for( size_t i = 0, start = 0; i < descriptors.size(); i++ ) for( size_t i = 0, start = 0; i < descriptors.size(); i++ )
{ {
Mat submut = mergedDescriptors.rowRange((int)start, (int)(start + descriptors[i].rows)); Mat submut = mergedDescriptors.rowRange((int)start, (int)(start + descriptors[i].rows));