Errors in Xobjdetect

asked 2015-03-18 08:37:10 -0600

Jay Schamus gravatar image

Just wanted to let people know that I've found a couple of errors in this contrib module.

1) In acffeature.cpp the function "void computeChannels(InputArray image, vector<mat>& channels)" has an error where it looks like they recently switched from using atan2() to cartToPolar(). The code as written handles angles from -180 to 180 degrees, but cartToPolar() outputs angles 0 to 360 degrees. The code needs to be changed to:

if( angle == 360 )
    angle = 0;
else if( angle >= 180 )
    angle -= 180;

2) Also in acffeature.cpp, the "void ACFFeatureEvaluatorImpl::setChannels(InputArrayOfArrays channels)" function will often overrun the right or bottom channel Mat. The code needs to be changed to:

for( int cell_row = row; cell_row < row + 4; ++cell_row )
     for( int cell_col = col; cell_col < col + 4; ++cell_col )
 { 
     if( cell_col < channel.cols && cell_row < channel.rows )
          sum += (int)channel.at<float>(cell_row, cell_col);
  }

 if( col / 4 < acf_channel.cols && row / 4 < acf_channel.rows )
    acf_channel(row / 4, col / 4) = sum;

After making these changes the code now seems to be stable.

edit retag flag offensive close merge delete

Comments

Could you file the bugs and fixes here: http://code.opencv.org/projects/openc... ?

FooBar gravatar imageFooBar ( 2015-03-18 08:42:47 -0600 )edit
berak gravatar imageberak ( 2015-03-18 08:53:23 -0600 )edit

I'm not registered in the DevZone, so someone will have to do that for me.

Jay Schamus gravatar imageJay Schamus ( 2015-03-18 09:51:41 -0600 )edit

just sign on with any email.

berak gravatar imageberak ( 2015-03-18 09:52:29 -0600 )edit