using NtToolBox using PyPlot name = "NtToolBox/src/data/lena.png" n = 256 M = load_image(name, n); imageplot(M[Int(n/2 - 25) : Int(n/2 + 25), Int(n/2 - 25) : Int(n/2 + 25)], "Zoom", [1, 2, 2]); imageplot(-M, "-M", [1,2,1]) imageplot(M[end:-1:1,1:size(M, 2)], "Flipped", [1,2,2]) sigma = 5 X = [0:n/2; -n/2:-2]' Y = [0:n/2; -n/2:-2] h = exp(-(X.^2 .+ Y.^2)/(2*(sigma)^2)) h = h/sum(h) imageplot(fftshift(h)) Mh = conv2(Array{Float64, 2}(M), h) Mh = Mh[1:255, 1:255] + Mh[257:511, 1:255] + Mh[1:255, 257:511] + Mh[257:511, 257:511]; imageplot(M, "Image", [1, 2, 1]) imageplot(Mh, "Blurred", [1, 2, 2]) (G_x, G_y) = Images.imgradients(M) imageplot(G_x, "d/ dx", [1, 2, 1]) imageplot(G_y, "d/ dy", [1, 2, 2]) Mf = plan_fft(M) Mf*M Lf = fftshift(log(abs(Mf*M) + 1e-1)) imageplot(M, "Image", [1, 2, 1]) imageplot(Lf, "Fourier transform", [1, 2, 2]) include("NtSolutions/introduction_3_image/exo1.jl") include("NtSolutions/introduction_3_image/exo2.jl")