I wrote the code for deblurring an image using the heat equation. I transformed the matlab code to Julia code. But it’s not working and I don’t really understand the error message. I get an error message:
ERROR: LoadError: MethodError: no method matching ccolor(::Type{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}}}, ::Type{Array{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}},1}})
Closest candidates are:
ccolor{Cdest<:ColorTypes.Colorant{T,N},Csrc<:ColorTypes.Colorant{T,N}}(::Type{Cdest<:ColorTypes.Colorant}, ::Type{Csrc<:ColorTypes.Colorant}) at /Users/hi88/.julia/v0.5/ColorTypes/src/traits.jl:237
ccolor{Cdest<:ColorTypes.Color{T,1},T<:Number}(::Type{Cdest<:ColorTypes.Color{T,1}}, ::Type{T<:Number}) at /Users/hi88/.julia/v0.5/ColorTypes/src/traits.jl:238
in convert(::Type{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}}}, ::Array{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}},1}) at /Users/hi88/.julia/v0.5/ColorTypes/src/conversions.jl:7
in macro expansion at ./multidimensional.jl:350 [inlined]
in macro expansion at ./cartesian.jl:64 [inlined]
in macro expansion at ./multidimensional.jl:348 [inlined]
in _unsafe_getindex! at ./multidimensional.jl:340 [inlined]
in macro expansion at ./multidimensional.jl:298 [inlined]
in _unsafe_getindex(::Base.LinearFast, ::Array{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}},2}, ::Colon, ::Array{Any,1}) at ./multidimensional.jl:291
in getindex(::Array{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}},2}, ::Colon, ::Array{Any,1}) at ./abstractarray.jl:752
in macro expansion; at /Users/hi88/Desktop/julia/heat.jl:14 [inlined]
in anonymous at ./<missing>:?
in include_from_node1(::String) at ./loading.jl:488
in include_from_node1(::String) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
while loading /Users/hi88/Desktop/julia/heat.jl, in expression starting on line 13
This is my code:
#clear,clc;
using ImageView, Images, Colors, FixedPointNumbers, TestImages
img=imread("clock.tiff")
A=data(img)
u=convert(Array,A)
(m,n)=size(u)
k=1;
dt=0.2
T=10
for t in 0:dt:T
u_xx=u[:, [2:n,n]]-2*u+u[:,[1, 1:n-1]]
u_yy=u[[2:m,m],:]-2*u+u[[1,1:m-1],:]
L=u_xx+u_yy
u=u-k*dt*T
end
imshow(reinterpret(Uint8,u))
imwrite(reinterpret(Uint8,u),"deblurredimage.tiff")
end