# HG changeset patch # User Tuomo Valkonen # Date 1576695396 -7200 # Node ID 4403f044581474336d8042c674c55162887a3cae # Parent a9ea98043eb9f4232e337a318aaebe18374bb755 Add gaussian distr to avoid hevy ImageFiltering dependencies. diff -r a9ea98043eb9 -r 4403f0445814 src/ImFilter.jl --- a/src/ImFilter.jl Mon Dec 16 13:37:08 2019 +0200 +++ b/src/ImFilter.jl Wed Dec 18 20:56:36 2019 +0200 @@ -13,7 +13,8 @@ # Exports ########## -export simple_imfilter +export simple_imfilter, + gaussian ############## # The routine @@ -54,5 +55,20 @@ return res end +###################################################### +# Distributions. Just to avoid the long load times of +# ImageFiltering and heavy dependencies on FFTW etc. +###################################################### + +function gaussian(σ, n) + @assert(all(isodd.(n))) + a=convert.(Integer, @. (n-1)/2) + g=OffsetArray{Float64}(undef, [-m:m for m in a]...); + for i in CartesianIndices(g) + g[i]=exp(-sum(Tuple(i).^2 ./ (2 .* σ.^2))) + end + g./=sum(g) +end + end # Module