Log in

View Full Version : Using mt_edge for pre-filtering? possible?


Terranigma
2nd January 2008, 14:42
Hello, I was wonderin' if it'd be possible to use mt_edge for edge cleaning (not for dehaloing :rolleyes:), and if so, will minblur play a part in this process? Asking because I think perhaps minblurx will be more efficient than the standard minblur, but maybe i'm wrong (like usual -P.) mt_edge seems to need helper functions, as the default just makes a mask of the areas to be affected (in what looks like, uv.)
Basically what i'm asking for, is mt_edge's edged areas to be included in my filter chain, without the uv mask.

Didée
2nd January 2008, 15:17
Edge detectors on their own are not that awfully useful for edge cleaning. The cruical point is the "what" and "how" to do, not the "where".

The most "obvious" concept for edge cleaning probably is bilateral filtering. Try TBilateral, with some sort of minblur/x for the "ppClip" analysis clip.

In any case, you'll find that if you try to remove artefacts around edges, you will necessarily lose weak detail that happens to be located around prominent edges, too.


perhaps minblurx will be more efficient than the standard minblur
minblurX was just a quick hack, lazy of fully parametrizing the minblur function.
And it's the other way round: the X version is more defensive than the old one, and they differ only if r=2. For r=1 and r=3 they're fully identical.

Terranigma
2nd January 2008, 15:33
The most "obvious" concept for edge cleaning probably is bilateral filtering. Try TBilateral, with some sort of minblur/x for the "ppClip" analysis clip.

In any case, you'll find that if you try to remove artefacts around edges, you will necessarily lose weak detail that happens to be located around prominent edges, too.


Oh I already noticed this with that script you whipped up for dehaloing; it can also cause some aliasing too (on uneven edges), but I thought that was only the downside of that script in particular, not edge-cleaning in whole. Well thanks for clearing that up. :)

Didée
2nd January 2008, 20:11
I'd think of a filter like basically this:

SmartBlur( radius, sensitivity )

1. Calculate the span [max-min] in the window of [radius] around [current pixel]

2. Apply blurring. To blur the current pixel, take into account only pixels that differ from [current pixel] by no more than [max-min]*[sensitivity]

In plain english: Blur each pixel by averaging it with those pixels which difference to the current pixel is not more than, say, 20% of the local min/max gradient.

Possible extensions:
- kind of blurring / radius2 for blurring window
- split sensitivity into sens_low & sens_high to avoid harsh boundaries between "filtered" and "not filtered"

That's kind of a "full-fledged version" of what HQDering is doing (or trying to do).
Strictly speaking, this kind of filtering can not be "scripted". It has to be implemented in a plugin. With scripted implementations, only overly slow and very rough piecewise approximations are possible.