Hi!
I am trying to get the gradient magnitude for each pixel of the image as here:
imgradients(imgF, kernelfun=KernelFactors.ando3, border="replicate")
I am getting this error:
function imgradients does not accept keyword arguments
Stacktrace:
[1] kwfunc(::Any) at ./boot.jl:237
Also is there a way to get the gradient direction similar to that in MATLAB as here.
Any help plz? Thanks!
Keyword arguments are given following a semicolon in the type signature–kernelfun
and border
are regular arguments with the default values ando3
and "replicate"
. If the documentation was accurate, calling imgradients(img)
would be equivalent to calling ingredients(img, KernelFactors.ando3, "replicate")
. However, the single-argument method seems to be missing:
julia> methods(imgradients)
# 2 methods for generic function "imgradients":
[1] imgradients(img::AbstractArray, kernelfun::Function) in ImageFiltering at /Users/alexames/.julia/packages/ImageFiltering/4wAwj/src/specialty.jl:501
[2] imgradients(img::AbstractArray, kernelfun::Function, border) in ImageFiltering at /Users/alexames/.julia/packages/ImageFiltering/4wAwj/src/specialty.jl:501
What you’re looking for is imedge
:
using FileIO
coins = Gray.(load("https://www.mathworks.com/help/images/ref/imgca1.gif"))
gy, gx, mag, ϕ = imedge(coins)
Gray.([imadjustintensity(mag) imadjustintensity(ϕ)])
Thanks a ton @stillyslalom!