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

hough_line_peaks fix for corner case with optimal angle=0 #6271

Merged
merged 2 commits into from
Apr 1, 2022

Conversation

grlee77
Copy link
Contributor

@grlee77 grlee77 commented Feb 28, 2022

Description

closes #4129, #6187

An array, a with a single element equal to zero is possible and is not handled properly in hough_line_peaks. This PR fixes that and adds a test case based on the example from #6187.

Checklist

  • Docstrings for all functions
  • Gallery example in ./doc/examples (new features only)
  • Benchmark in ./benchmarks, if your changes aren't covered by an
    existing benchmark
  • Unit tests
  • Clean style in the spirit of PEP8
  • Descriptive commit messages (see below)

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.
  • There is a bot to help automate backporting a PR to an older branch. For
    example, to backport to v0.19.x after merging, add the following in a PR
    comment: @meeseeksdev backport to v0.19.x
  • To run benchmarks on a PR, add the run-benchmark label. To rerun, the label
    can be removed and then added again. The benchmark output can be checked in
    the "Actions" tab.

@grlee77 grlee77 added 🩹 type: Bug fix Fixes unexpected or incorrect behavior backport: 0.19.x labels Feb 28, 2022
@pep8speaks
Copy link

Hello @grlee77! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 65:42: W504 line break after binary operator

@@ -63,7 +62,7 @@ def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
min_ydistance=min_distance,
threshold=threshold,
num_peaks=num_peaks)
if a.any():
if a.size > 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line fixes the bug. the other modified lines are flake8/isort fixes and the new test case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@grlee77 grlee77 changed the title Hough line peaks fix hough_line_peaks fix for corner case with optimal angle=0 Feb 28, 2022
Copy link
Member

@rfezzani rfezzani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @grlee77 😉

@@ -63,7 +62,7 @@ def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
min_ydistance=min_distance,
threshold=threshold,
num_peaks=num_peaks)
if a.any():
if a.size > 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@grlee77 grlee77 merged commit f610ac0 into scikit-image:main Apr 1, 2022
@grlee77
Copy link
Contributor Author

grlee77 commented Apr 1, 2022

@meeseeksdev backport to v0.19.x

meeseeksmachine pushed a commit to meeseeksmachine/scikit-image that referenced this pull request Apr 1, 2022
grlee77 added a commit that referenced this pull request Apr 1, 2022
…1-on-v0.19.x

Backport PR #6271 on branch v0.19.x (hough_line_peaks fix for corner case with optimal angle=0)
@lagru lagru added this to the 0.19.3 milestone Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🩹 type: Bug fix Fixes unexpected or incorrect behavior
Projects
None yet
4 participants