Wed, 18 Dec 2019 20:56:36 +0200
Add gaussian distr to avoid hevy ImageFiltering dependencies.
src/ImFilter.jl | file | annotate | diff | comparison | revisions |
--- 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