# FanFilter

Author V. C. Mohan
last modified on 22 oct 2008

This plugin with function name FAN operate along row in one dimensional spatial domain. Complementing this are the FQuiver and FFTQuiver plugins which operate in frequency domain. The Fan function of this plugin attenuates regular frequency noise that appears as vertical to sub vertical aligned noise. In case the input has horizontal to sub horizontal interference it can be filtered by using turnleft function and later turnright builtin functions of Avisynth.

While frequency filtering is done best in frequency domain, in some cases, it is difficult to differentiate between low level noise and signal. This FanFilter which works in time domain appears to successfully filter such noise. It is however essential to select optimum parameters by experimenting, so that least amount of artifacts are introduced and excessive smoothing of image is avoided.

The parameter 'lambda' is wavelength of interfering noise along the horizontal . However in many cases noise is filtered satisfactorily even when lambda value is smaller than the wavelength.

Plus and minus tolerances for noise filtering are to be specified. RGB formats the filter works on all 3 color planes.For Y U V images Y plane processing alone may be sufficient. However there are cases where U or V values were required to be filtered. Any combination of filtering these 3 planes can be specified.

FAN examines the data over a span equal to lambda and for opt:
"pass" keeps the center point original value if it is more than mean + plus Tolerances or less than mean - plus Tolerances.Otherwise, the value is replaced by mean value.
"stop" Keeps the center point original value if it is within mean + plus or - minus tolerances. Otherwise, the value is replaced by mean value.
"edge" Compares with left half mean and right half mean of lambda and filters all values which are outside left mean +plus Tolerances and left mean-minus Tolerances and right mean+ plus Tolerance and right mean -minus Tolerances, by substituting nearest mean value. For filtering filtering white streaks specify small plus tolerance and large minus tolerance. In case of black streaks specify high plus tolerance and small minus tolerance.

A feedback feature which may work in some cases is an option. If opted feed back by a specified proportion of already filtered values is done.

Filtering can be limited to within a window position and size of which can linearly change from start to end frame. This not only saves processing time, but may not introduce artifacts in noise free areas of original image.

RGB32, RGB24, YUY2 and YV12 formats are supported.

Details of parameters
Description | Name | Type | Limits | Default
Input clip |  | clip |  | none
Starting frame number to process | sf | integer | within clip | 0
End frame number to process | ef | integer | within clip and not less than sf | last frame
option of type of filter | opt | string | "pass" "stop" "edge" | "edge"
wavelength of noise | lambda | integer | Odd number >5 (or 7 if UV also to be filtered) and less than window width/2 | 15
Y, U and V planes filtering for YUY2 and YV12 input formats | yUV | integer | 4 for y, 2 for u and 1 for v. 1 to 7 only | 4
plus tolerance | plus | integer | >0 to 250 | 5
minus tolerance | minus | integer | >0 to 250 | 5
feedback %age value | feedback | integer | 0 to 100 | 0
Process window left x at start frame | slx | integer | within frame, less than rx, even number if YUY2 or YV12 | 0
Process window top y at start frame | sty | integer | within clip, less than by, even number if YUY2 or YV12 | 0
Process window right x at start frame | srx | integer | within clip, more than lx, odd number if YUY2 or YV12 | frame width-1
Process window bottom y at start frame | sby | integer | within frame, more than ty, odd number if YUY2 or YV12 | frame height-1
Process window left x at end frame | elx | integer | within frame, less than erx, even number if YUY2 or YV12 | slx
Process window top y at end frame | ety | integer | within clip, less than eby, even number if YUY2 or YV12 | sty
Process window right x at end frame | erx | integer | within clip, more than elx, odd number if YUY2 or YV12 | srx
Process window bottom y at end frame | eby | integer | within frame, more than ety, odd number if YUY2 or YV12 | sby

    loadPlugin ("D:\TransPlugins\bin\FanFilter\Release\FanFilter.dll")
    yv = imagesource("......jpeg").converttoYV12()
    p=Fan(yv,0,1,"pass",11,yuv = 4,plus=3,minus=0)
    s=Fan(yv,0,1,"stop",5,yuv = 4,plus=10,minus=10)
    e=Fan(yv,0,1,"edge",5,yuv = 4,plus=1,minus=200)

    st1=stackhorizontal(yv, p)

using "pass" option

To my index page |  |  |  | down load plugin |  |  |  | To Avisynth