You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
use_quantiles description in canny is incorrect #4282
The description of use_quantiles is "If True then treat low_threshold and high_threshold as quantiles of the edge magnitude image, rather than absolute edge magnitude values. If True then the thresholds must be in the range [0, 1]."
However, he thresholds must be in the range [0, maximum of the image's dtype ]
Way to reproduce
fromskimageimportdatafromskimage.featureimportcannyimage=data.camera()
edge_canny=canny(image, low_threshold=50, high_threshold=150, use_quantiles=True)
# No error is produced
Cause
This happens because the thresholds are divided by maximum of the image's dtype (lines 163, 168 in _canny.py)
Probable solution
The probable solution is not to divide the thresholds if use_quantiles is True or just simpler change the description.
Activity
jni commentedon Nov 5, 2019
Yikes! Thanks for the report, @pigunther! I think you are right that we should not divide by the dtype max.
rfezzani commentedon Dec 6, 2019
To fix this issue, I propose in #4342 to add the
preserve_rangeargument and to divide the thresholds only ifpreserve_rangeis True.rfezzani commentedon Feb 7, 2020
A simpler bug fix is proposed in #4437.