Log in

View Full Version : Filter request


AVIL
24th October 2006, 08:32
Hi,

I often work whith multiple captures. Sometimes with tree copies, other times with two or even with four copies. I've found very useful mg262's average filter. It accepts as parameters an undetermined number of clips and a weight for each. See:

http://forum.doom9.org/showthread.php?t=100626

To obtain the median of three clip I use kassandro's filter clense. But I don't know how to obtain the median of four or more clips.

It will be very valuable a filter (SortedAverage could be named) that accept same inputs as averagefilter (n clips and n weights) but, for each correspondient pixel, before apply weighting do a crecient sort of pixel values. So, a median filter for four clips will be as simple as :

SortedAverage(clip1,0,clip2,0.5,clip3,0.5,clip4,0).

Thanks

jmac698
26th October 2006, 02:16
I may have an answer. There was a post last year about averaging 3 copies of a capture from VHS for a less noisy picture. The command used was convolution3d().
http://hellninjacommando.com/con3d/

you need to do a temporal filtering and adjust weights. In general, do a search for "avisynth temporal filter" or "avisynth temporal denoising", as these filters do some type of calculation related to what you want.

Mug Funky
26th October 2006, 09:09
for odd numbers of clips you can do this:

interleave(cap1,cap2,cap3,cap4,cap5)
medianblurt(0,0,2) # search the forum for this one. i can't remember if tritical or leak wrote it.
selectevery(5,2) # remember it counts from 0...

Didée
26th October 2006, 10:50
medianblurt(0,0,2) # search the forum for this one. i can't remember if tritical or leak wrote it.
Neither nor, it's by tsp. :)

EDIT: Oh, and the call has to be "MedianBlurT(0,0,0,2)" ... three planes' spatial radius, then the temporal radius.

To obtain the median of three clip I use kassandro's filter clense. But I don't know how to obtain the median of four or more clips.
When using clense() for a radius=1 median, remember to use clense(reduceflicker=false), or you might not get what you really want.

Then, it's not quite clear what a median filter should do with an even number of arguments. For example, the median of 4 values like (3,2,6,5) should be ... what?

AVIL
26th October 2006, 20:04
@jmac698

It's not exactily temporal averaging what I look for (perhaps we can tell it multiclip averaging). But for a posterior stage of denoising, I'll try your recommendation.

@Mug Funky

I'll try your method (and I'll try to understand it).

@Didée

Thanks for the advice. The parameter reduceflicker was unknown for me.

IMHO a median of an even number of quantities is the average of the two central values (I see it as if a virtual odd central number where calculated averaging two adjacents ones)

Didée
27th October 2006, 21:37
IMHO a median of an even number of quantities is the average of the two central values (I see it as if a virtual odd central number where calculated averaging two adjacents ones)
Nothing wrong with that, makes perfect sense for a practical filter. However, that would be a median-"alike" filter. A median filter has to return exactly one of the input arguments, otherwise it is not median. ;)

Would like to have something like that, too, for denoising scripts. E.g. when averaging over a temporal radius of 2 or 3, exclude the 2 (or 3 or 4) most extreme values of the bunch, and average the remaining. Kind of RemoveGrain's major modes 1 to 4, but in the temporal domain. Not sure how beneficial it would actually be ... I woud "preview" it with a scripted version, but that's not as easy as it might look: it's very difficult to script.

AVIL
28th October 2006, 13:00
@Didée

I search a method to combine differents captures of a video with the goal of minimizing noise.
If that noise were gaussian, simply averaging them we will obtain the best approximation.
This is the the theorical application of minimum squares calculus.
But, in practise simply averaging blurries the image too much.
A better approach (as you states in your post) is discard the pixels that are too much different.
But, different from what? I think that differents of the median value.
So, I need a median (or "median alike") filter to obtain this reference pixel.

A practical denoise application with three captures of same video is easy:

x1, x2 and x3 are the clips.


median=interleave(x1,x2,x3).clense().selectevery(3,1)
filtered=corrector(median,median,x1,x2,x3,x1,x2,x3,th=5)

krieger2005
28th October 2006, 13:02
Search for the "toot"-Filter. I think it was made just for such things. But it accept only 3 captures.

EDIT: I just have done it for you :) : http://forum.doom9.org/showthread.php?t=78338