52 end |
53 end |
53 |
54 |
54 return res |
55 return res |
55 end |
56 end |
56 |
57 |
|
58 ###################################################### |
|
59 # Distributions. Just to avoid the long load times of |
|
60 # ImageFiltering and heavy dependencies on FFTW etc. |
|
61 ###################################################### |
|
62 |
|
63 function gaussian(σ, n) |
|
64 @assert(all(isodd.(n))) |
|
65 a=convert.(Integer, @. (n-1)/2) |
|
66 g=OffsetArray{Float64}(undef, [-m:m for m in a]...); |
|
67 for i in CartesianIndices(g) |
|
68 g[i]=exp(-sum(Tuple(i).^2 ./ (2 .* σ.^2))) |
|
69 end |
|
70 g./=sum(g) |
|
71 end |
|
72 |
57 end # Module |
73 end # Module |
58 |
74 |