Even though gcd_boxfilter_local
streaks, [Edit See (1) at footer.] it is still more stable than the generic SAT driven box filter. I am not sure what @garagecoder is doing that makes it behave better. I.e., substituting his box filter in my guided filter doesn’t cause range disparities (impulse noise). Mine does, even though it is a simple 2D SAT driven box filter injected into afre_gui0
.
afre_box0 : check ${1=1}>=1
repeat $! l[$>]
b={$1*2+2} r {[w,h]+$b},100%,100%,0,1,0.5,0.5
cumulate xy
f "begin(const boundary=1; const R=$1; const S=-R-1;
const A=sqr(R*2+1)); (j(R,R)+j(S,S)-j(S,R)-j(R,S))/A
" r {[w,h]-$b},100%,100%,0,0,0.5,0.5
endl done
afre_gui0
with changes in smoothing: original, 1e-2
, 1e-1
, 1e0
and 1e1
. The latter two have peaks only in the whiskers.
gmic sp tiger repeat 4 +Agui0[0] 1,1e{$^>-2} done c 0,255 a z xz s z a y o tigers.png

Note that boxfilter
, blur
and my custom convolve
driven methods don’t exhibit such artifacts.
Edit (1) Correction: the command that works error free for me is gcd_satboxfilter
, the precursor of gcd_boxfilter_local
.