Open JobJob opened 4 years ago
Thanks for reporting this. You are right, line 411 should be forwarding the threshold argument.
@zygmuntszpak Given that ImageEdgeDetection already implements Canny
, what's the current status of this issue? My guess is that we only need to properly deprecate the old canny
in src/edge.jl
in favor of ImageEdgeDetection
, and then this issue gets solved?
thinning algorithms have also been implemented in ImageEdgeDetection.jl and they also need to be properly deprecated here in Images.jl I think
To fix the error you're encountering with the canny function, you need to convert the image to grayscale before applying the Canny edge detection algorithm. Here are steps-
Convert the RGB image to grayscale. Apply the Canny edge detection algorithm to the grayscale image.
using Images using ImageFiltering img = rand(RGB{N0f8}, 100, 100) gray_img = Gray.(img)
canny_img = canny(gray_img, (Percentile(80), Percentile(20)))
Gives a
Seems this code just needs to forward the
threshold
argument: https://github.com/JuliaImages/Images.jl/blob/3951d87ab2ccb06b7b854b42908504e9fa0e7dd9/src/edge.jl#L410-L411i.e.
canny(convert(Array{Gray}, img), threshold, args...)
though a warning suggests that maybe it should becanny(Gray.(img), threshold, args...)