Fft of Matrix type doesnt work?

I am trying to do a 2D FFT of an image:

using AbstractFFT
img=[sin(2*pi*x*10/256) for x in 1:256, y in 1:256];
fft(img)

but this gives:

julia> fft(img)
ERROR: MethodError: no method matching plan_fft(::Matrix{ComplexF64}, ::UnitRange{Int64})
Closest candidates are:
  plan_fft(::AbstractArray{var"#s6", N} where {var"#s6"<:Real, N}, ::Any; kws...) at /Users/burke/.julia/packages/AbstractFFTs/JebmH/src/definitions.jl:199
  plan_fft(::AbstractArray{var"#s15", N} where {var"#s15"<:(Complex{var"#s16"} where var"#s16"<:Union{Integer, Rational}), N}, ::Any; kws...) at /Users/burke/.julia/packages/AbstractFFTs/JebmH/src/definitions.jl:201
  plan_fft(::AbstractArray; kws...) at /Users/burke/.julia/packages/AbstractFFTs/JebmH/src/definitions.jl:52
Stacktrace:
 [1] fft(x::Matrix{ComplexF64}, region::UnitRange{Int64})
   @ AbstractFFTs ~/.julia/packages/AbstractFFTs/JebmH/src/definitions.jl:51
 [2] fft(x::Matrix{Float64}, region::UnitRange{Int64}) (repeats 2 times)
   @ AbstractFFTs ~/.julia/packages/AbstractFFTs/JebmH/src/definitions.jl:198
 [3] top-level scope
   @ REPL[27]:1

what am i missing?

Why using AbstractFFT and not just FFTW?
See this post for further leads.

The intro of the package:

This package is mainly not intended to be used directly. Instead, developers of packages that implement FFTs (such as FFTW.jl or FastTransforms.jl) extend the types/functions defined in AbstractFFTs. This allows multiple FFT packages to co-exist with the same underlying fft(x) and plan_fft(x) interface.

Like @rafael.guerra said, you could use FFTW.

 using FFTW
img=[sin(2*pi*x*10/256) for x in 1:256, y in 1:256]
fft(img)
2 Likes