-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiments.jl
47 lines (32 loc) · 1.57 KB
/
experiments.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import Pkg
Pkg.activate("./SrLHE")
using Images
using SrLHE
#####################
# Global parameters #
#####################
N = 200
K = 16 # orientations
β = K/sqrt(2*N^2); # needed for the unit coherency in spatial and orientation dimensions
M = 1.
sR_lhe(img, λ, σμ, α, Δt, Δτ, τ; args...) = SrLHE.sR_lhe(img, β, σμ, τ, λ, M, θs = K, α = α, Δt = Δt, Δτ = Δτ; args...) |> x->clamp01nan.(x)
sR_wc(img, λ, σμ, α, Δt, Δτ, τ; args...) = SrLHE.sR_wc(img, β, σμ, τ, λ, M, θs = K, α = α, Δt = Δt, Δτ = Δτ; args...) |> x->clamp01nan.(x)
##################
# Gratings tests #
##################
mkpath("results")
img = Float64.(load("test_images/gratings.png"))
save("results/gratings_wc.png", sR_wc(img, 0.01, 6.5, 20, 0.1, 0.01, 5.))
save("results/gratings_lhe.png", sR_lhe(img, 2., 1., 8, 0.15, 0.01, 5., normalized = false))
# Dependence w.r.t. τ
save("results/gratings_τ=0.1_lhe.png", sR_lhe(img, 2., 1., 6, 0.15, 0.01, 0.1, normalized = false))
save("results/gratings_τ=0.5_lhe.png", sR_lhe(img, 2., 1., 6, 0.15, 0.01, 0.5, normalized = false))
save("results/gratings_τ=2.5_lhe.png", sR_lhe(img, 2., 1., 6, 0.15, 0.01, 2.5, normalized = false))
##############################
# Original Poggendorff tests #
##############################
img = Float64.(load("test_images/original_poggendorff.png"))
normalize_target1(res) = res[75:124,85:114] |> SrLHE.normalize |> x->Gray.(x)
res = sR_lhe(img, 0.5, 2.5, 8, 0.15, 0.1, 2.5, max_iter = 10)
save("results/original_lhe.png", res)
save("results/original_lhe_zoom.png", normalize_target1(res))