Skip to content

Commit 25a01dc

Browse files
cooolinxalalek
authored andcommitted
Merge pull request #1652 from fallenlord:master
Bug fixes: using mask with BinaryDescriptor (#1652) * Bug fixes: erasing an element from std::vector should not move iterator forward * Bug fixes: add a NULL checking * Remove the appoggio matrix generation, which is useless
1 parent db1d5e1 commit 25a01dc

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

modules/line_descriptor/src/binary_descriptor.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ void BinaryDescriptor::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& ke
504504
/* delete undesired KeyLines, according to input mask */
505505
if( !mask.empty() )
506506
{
507-
for ( size_t keyCounter = 0; keyCounter < keylines.size(); keyCounter++ )
507+
for ( size_t keyCounter = 0; keyCounter < keylines.size(); )
508508
{
509509
KeyLine& kl = keylines[keyCounter];
510510

@@ -517,6 +517,8 @@ void BinaryDescriptor::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& ke
517517

518518
if( mask.at < uchar > ( (int) kl.startPointY, (int) kl.startPointX ) == 0 && mask.at < uchar > ( (int) kl.endPointY, (int) kl.endPointX ) == 0 )
519519
keylines.erase( keylines.begin() + keyCounter );
520+
else
521+
keyCounter++;
520522
}
521523
}
522524

@@ -1342,17 +1344,6 @@ int BinaryDescriptor::computeLBD( ScaleLines &keyLines, bool useDetectionData )
13421344
}/* end for(short lineIDInSameLine = 0; lineIDInSameLine<sameLineSize;
13431345
lineIDInSameLine++) */
13441346

1345-
cv::Mat appoggio = cv::Mat( 1, 32, CV_32FC1 );
1346-
float* pointerToRow = appoggio.ptr<float>( 0 );
1347-
for ( int g = 0; g < 32; g++ )
1348-
{
1349-
/* get LBD data */
1350-
float* des_Vec = &keyLines[lineIDInScaleVec][0].descriptor.front();
1351-
*pointerToRow = des_Vec[g];
1352-
pointerToRow++;
1353-
1354-
}
1355-
13561347
}/* end for(short lineIDInScaleVec = 0;
13571348
lineIDInScaleVec<numOfFinalLine; lineIDInScaleVec++) */
13581349

0 commit comments

Comments
 (0)