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

Array a containing one zero element and a.any() in function hough_line_peaks in file skimage/transform/hough_transform.py #4129

Closed
uzgithub opened this issue Aug 30, 2019 · 3 comments · Fixed by #6271

Comments

@uzgithub
Copy link

Description

The function hough_line_peaks in the file skimage/transform/hough_transform.py contains the following logic in line 64f

if a.any():
return (h, angles[a], dists[d])
else:
return (h, np.array([]), np.array([]))

In the edge case of a being an array with just one element, and that element being equal to 0, according to the logic given above, an empty array is returned because of the use of a.any(), instead of angles[0].

Version information

3.6.3 (default, May 31 2019, 13:05:43)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Linux-3.10.0-957.27.2.el7.x86_64-x86_64-with-centos-7.6.1810-Core
scikit-image version: 0.15.0
numpy version: 1.17.1

@hmaarrfk
Copy link
Member

It seems like your reproducing example is almost complete.

Could you please provide all the code start to finish? that will be half way to adding the test we need to the library to ensure this bug doesn't happen again!

@hmaarrfk
Copy link
Member

Also, if you would like to help address this issue, we will gladly review your PR! Contributions are welcome!

@grlee77
Copy link
Contributor

grlee77 commented Feb 28, 2022

a concrete example of this issue was more recently given in #6187 (comment)

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

Successfully merging a pull request may close this issue.

4 participants