Bug in DescriptorExtractor::removeBorderKeypoints (Bug #832)
Description
Hi!
I've noticed that in BriefDescriptorExtractor::computeImpl call RoiPredicate filters keypoints checking FLOAT values e.g.:
if (pt.x=999.9) >= 1000 (false)
But further function test_fn_ rounds FLOAT value to INT to get exact pixel position so
(img_x=(int)(999.9 + 0.5)) == 1000 (true)
So we are getting exception in sum.at<int>(y, x) call during descriptor calculation
This explanation may be incorrect (I didn't get whole picture of border calculation) BUT bug exists here, I've catched it :)
Anton
Associated revisions
fixed #832
History
Updated by Maria Dimashova about 14 years ago
This explanation is really incomplete to understand where is the bug. Could you attach the image and sample code to reproduce described bug?
Updated by Anton G about 14 years ago
Hi!
Please, build attached .cpp file to reproduce bug, image doesn't need.
I've added "- 0.5f" to upper limits to FIX this BUG:
void DescriptorExtractor::removeBorderKeypoints( vector<KeyPoint>& keypoints,
Size imageSize, int borderSize )
{
if( borderSize > 0)
{
keypoints.erase( remove_if(keypoints.begin(), keypoints.end(),
RoiPredicate((float)borderSize, (float)borderSize,
(float)(imageSize.width - borderSize) - 0.5f,
(float)(imageSize.height - borderSize) - 0.5f)),
keypoints.end() );
}
}
WBR,
Anton
Updated by Maria Dimashova almost 14 years ago
I fixed the problem in r4975.
Thanks for the bug report and the sample code.
- Status changed from Open to Done
- (deleted custom field) set to fixed
Updated by Anton G almost 14 years ago
Thanks for your attention!