Hey, when building the local 3x3 sum over an intensity image I came across the question whether it'd be not much less performant to use imfilter with a ones(3,3) kernel than to do it in a map or broadcast since edgehandling is way more convenient for imfilter. In order to speed things up, I called factorkernel ahead of filtering and stumbled over:
I know that the sign doesn't matter here since 1*1=(-1)*(-1) though I'm curious if there is a faster way if these are all positive (maybe because *1 can be optimized) etc.
What would be the best solution to my problem?
mapwindow(x->sum(x),...)map(areasum.(Ref(layer),x),CartesianIndices(layer))imfilter(layer, ImageFiltering.factorkernel(centered(ones(3,3))))imfilter(layer, centered.((ones(3), ones(3))))
Hey, when building the local 3x3 sum over an intensity image I came across the question whether it'd be not much less performant to use
imfilter
with aones(3,3)
kernel than to do it in a map or broadcast since edgehandling is way more convenient forimfilter
. In order to speed things up, I called factorkernel ahead of filtering and stumbled over:I know that the sign doesn't matter here since
1*1=(-1)*(-1)
though I'm curious if there is a faster way if these are all positive (maybe because*1
can be optimized) etc. What would be the best solution to my problem?mapwindow(x->sum(x),...)
map(areasum.(Ref(layer),x),CartesianIndices(layer))
imfilter(layer, ImageFiltering.factorkernel(centered(ones(3,3))))
imfilter(layer, centered.((ones(3), ones(3))))