FanFilter


Author V. C. Mohan
Date May 22, 2005

The functions in this plugin operate in row or column wise one dimensional spatial domain. Complementing this are the FQuiver and FFTQuiver plugins which operate in frequency domain. The two functions included in this plugin are:-
 VFan: Regular frequency noise that appears as vertical to sub vertical is filtered.
 HFan: Regular frequency noise that appears as horizontal to sub horizontal is filtered.

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 parameters for these two functions are similar. The parameter 'lambda' is wavelength of interfering noise (along the horizontal for VFan and along vertical for HFan). However in many cases noise is filtered satisfactorily even when lambda value is smaller than the wavelength.

Tolerances for noise filtering are to be specified. There is provision for specifying these for all the 3 planes of image color. While in RGB formats the filtering probably may be needed in all 3 colors, generally in Y U V images Y alone may be sufficient. However there are cases where either U or V values were required to be filtered.

Both VFAN and HFAN 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 + or - plus Tolerances. Otherwise, the value is replaced by mean value.
 "edge" Compares with left (or top) half mean and right (or lower) half mean of lambda and filters all values which are outside lmean +plus Tolerances and lmean-minus Tolerances and rmean+ plus Tolerances and rmean -minus Tolerances, by substituting nearest mean value. For filtering white streaks plus tolerance can be low and minus tolerance high. In case of black streaks plus tolerance can be high and minus tolerance low.

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 >4 and less than frame width 16
Is green or y to be filtered? gy boolean true for yes, false for no true
Is red or U to be filtered? ru boolean true for yes, false for no false
Is blue or V to be filtered? bv boolean true for yes, false for no false
plus tolerance of Y or green gyplus integer >0 to 250 5
plus tolerance of U or red ruplus integer >0 to 250 5
plus tolerance of V or blue bvplus integer >0 to 250 5
minus tolerance(edge option) of Y or green gyminus integer >0 to 250 5
minus tolerance(edge option) of U or red ruminus integer >0 to 250 5
minus tolerance(edge option) of V or blue bvminus integer >0 to 250 5
Process window left x at start frame slx integer within frame, less than rx 0
Process window top y at start frame sty integer within clip, less than by 0
Process window right x at start frame srx integer within clip, more than lx frame width-1
Process window bottom y at start frame sby integer within frame, more than ty frame height-1
Process window left x at end frame elx integer within frame, less than erx slx
Process window top y at end frame ety integer within clip, less than eby sty
Process window right x at end frame erx integer within clip, more than elx srx
Process window bottom y at end frame eby integer within frame, more than ety sby
feedback %age value feedback integer 0 to 100 0

Usage examples:-
Vfan()
VFan (last,2,40, feedback=100)
# for very low level diagonal bars
VFan (last,24,200,"pass")
# for RGB input
HFan (last,1,400,"stop", ru=true, bv=true, rplus=15, bplus=6)
# for white vertical streaks
VFan(last,0,40, gyplus=2,gyminus=100)
# for black horizontal streaks
HFan(last.0,40, gyplus=100, gyminus=2)
Some examples of FanFilter Application:
using "edge" option:

using "pass" option

To my index page down load plugin To Avisynth