-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
HOG returns incorrect features if pixels_per_cell is odd #3541
HOG returns incorrect features if pixels_per_cell is odd #3541
Conversation
By the way I wanna add test code. |
Thanks for noticing this bug. The change seems to be correct. For adding tests, maybe you could use a very small image (like |
Hello @t-ae! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on January 17, 2019 at 01:59 Hours UTC |
The bug is that last row/column are skipped while scanning pixels.
The output feature will be non-zero if last row/column are not skipped. Now it's ready to be merged. |
Great, I love this new test. Can you just remove all keyword arguments which have default values (orientations, etc.) and are therefore not needed, in order to keep a small codebase even in tests? @scikit-image/core this one is almost ready! |
Removed them :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks correct and is covered by a new test. Thanks @t-ae
The CI failure seems unrelated
Description
skimage.feature.hog
was ignoring last row/column of cell ifpixels_per_cell
is odd number.Suppose
pixels_per_cell == (3, 3)
In here
cell_rows == pixels_per_cell[0]
.scikit-image/skimage/feature/_hoghistogram.pyx
Lines 120 to 127 in 9c4632f
cell_rows
is 3 but[range_row_start, range_rows_stop)
contains only 2 integers, so last row will be ignored.I fixed
range_rows_stop
(andrange_columns_stop
) calculation.Checklist
[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
[For detailed information on these and other aspects see scikit-image contribution guidelines]
References
[If this is a bug-fix or enhancement, it closes issue # ]
[If this is a new feature, it implements the following paper: ]
For reviewers
(Don't remove the checklist below.)
later.
__init__.py
.doc/release/release_dev.rst
.@meeseeksdev backport to v0.14.x