Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in SURF sum_rect() #58

Closed
Mimino666 opened this issue Apr 4, 2015 · 1 comment
Closed

Bug in SURF sum_rect() #58

Mimino666 opened this issue Apr 4, 2015 · 1 comment

Comments

@Mimino666
Copy link

Shouldn't the lines 42 and 43 in file https://github.com/luispedro/mahotas/blob/master/mahotas/features/_surf.cpp be:

y1 = std::min<int>(y1, integral.dim(0)-1);
x1 = std::min<int>(x1, integral.dim(1)-1);

?

@luispedro
Copy link
Owner

I think you're right that those lines are wrong, though my feeling is that it should be

y1 = std::min<int>(y1 - 1, integral.dim(0)-1);
x1 = std::min<int>(x1 - 1, integral.dim(1)-1);

It needs to be y1-1 because the outward facing interface is that we are computing array[y0:y1, x0:x1], so it should be integral[y1,x1] - integral[y0,x0]. The bounds check is useless, though.

I'll check this more carefully and commit the fix.

Thanks Luis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants