Log in

View Full Version : selective gaussian blur?


jkwarras
8th November 2004, 15:11
Hi,

I've discovered the other day the 'Selective gaussian blur' (http://www.gimp.org/tutorials/Selective_Gaussian_Blur/) filter in GIMP, the best denoiser for photo I've ever seen. It preserves more details than other methods I've used until now. It's quite slow, but it really worth it.

I would like to see somethign like that for video, specially for DV footage. Does someone knows (or can point me in the right direction) if something similar is available in avisynth?

Thanks.

Didée
8th November 2004, 17:03
Don't know how this filter for Gimp is actually working ... but have a look at "TBilateral", a bilateral (range/domain) filter that tritical coded from a whitepaper. It's a bit tricky to find the right thresholds (understanding the working principle does help ;) ), but can achieve very good results when set up correctly.

Also don't forget about "VagueDenoise". Not a gaussian, but one of the best spatials we have.

jkwarras
8th November 2004, 18:38
Thanks for the info. I'll check those filters :)

Originally posted by Didée
Don't know how this filter for Gimp is actually working ...
Quoting the author of the tutorial:
The basic idea behind selective Gaussian blur is that areas in the photo with contrast below a certain threshold gets blurred.

The next thing is to experiment with different combinations of the settings ("blur radius" and "maximum delta") in the selective Gaussian blur filter.

In short, maximum delta should be just high enough for the filter to kick in on the noise and blur radius should be just high enough to remove it (actually blend it with neighboring areas).

Mug Funky
9th November 2004, 04:45
same sort of thing as "smart blur" in photoshop, but implemented waaay better (i only used this feature once on my friend's linux box, as i haven't got the latest gimp in win32. but it certainly looks worth it - it's catching up with photoshop at an encouraging rate).

you can whack this together with masks and YV12convolution (or a simple bilinear downsize + bicubic(width,height,1,0) upsize).

jkwarras
9th November 2004, 11:39
Originally posted by Mug Funky
same sort of thing as "smart blur" in photoshop,
Yes, it's considered as 'similar'.

you can whack this together with masks and YV12convolution (or a simple bilinear downsize + bicubic(width,height,1,0) upsize). [/B]
Any example/tip how to whack it? ;) I'm not very good in making advanced scripts, I just work with standard (avisynth) plugins and play with parameters for ages until I reach the desired results.

Edit: I've just found this gaussian blur fonction of you Mug Funky in .here (http://forum.doom9.org/showthread.php?s=&threadid=85019). I think it's more a gaussian blur than a selective gaussian blur. I'll take a look at it :)

I'm looking for a good way of cleaning DV stuff (YUY2). I'll take a look at filters that didée and you sgguested me, thanks a lot.

Didée
10th November 2004, 12:12
Originally posted by jkwarras
Any example/tip how to whack it?
Sure.


For easiness & speed, it's not really a gaussian blur, but a simple approximation through bicubic resizing.
Also, it's not really "selective", but a "limited" blurring.

But in the end, it should come close to the wanted behaviour - and probably could be done better by using VagueDenoiser instead ;)

However, for the record:

function m4(float z) {return int(round(z/4.0))*4}

function LGauss( clip clp, int "radius", int "limit", int "fade", bool "soft")
{
ox=clp.width
oy=clp.height
radius=default(radius,4)
limit=default(limit,2)
limit=limit<1?1:limit
fade=default(fade,2)
fade=fade<1?1:fade
soft=default(soft,true)
rad=sqrt(float(radius))
rad=ox/rad<16.0?ox/16.0:rad
rad=oy/rad<16.0?oy/16.0:rad
LL=string(limit)
FF=string(fade)
sm=clp.bicubicresize(m4(ox/rad),m4(oy/rad)).bicubicresize(ox,oy,1.0,.0)
cm=soft?clp.bicubicresize(m4(ox*.85),m4(oy*.85)).bicubicresize(ox,oy):clp
msk=YV12lutxy(sm,cm,yexpr="255 "+LL+" * x y - abs "+FF+" * /")
return maskedmerge(clp,sm,msk,Y=3,U=1,V=1)
}

radius [int]: the radius of the (simulated) gaussian blur. Default = 4

limit [int]: how much a pixel may be changed maximally. (It's not really true when using soft=true - in that case the actual pixel changing may be a little more). Default=2

fade [int]: (usually: "rolloff") The bigger it is set, the less changing will be done to pixels where the (not limited) change would be big. Default = 2

soft [bool]: uses internaly a slightly blurred version of the input clip for value comparison, instead of the original input clip. Results in more overall smoothing, but catches noise better. For usage when dealing with stronger noise or grain. Default = true


Full function call with default values:
LGauss(radius=4, limit=2, fade=2, soft=true)

jkwarras
10th November 2004, 16:04
Originally posted by Didée
Sure.


For easiness & speed, it's not really a gaussian blur, but a simple approximation through bicubic resizing.
Also, it's not really "selective", but a "limited" blurring.
Wow! :D

Thanks you. I'll try ASAP.