#
DeNoise

Author V. C. Mohan
Date Sep 14, 2005 / modified Nov 10, 2006
EMail: mohanvc

DeNoise plugin for Avisynth 2.5 version, is free and the author does not give any guarentee for its operation. It may be downloaded and used at the users risk.

This is an adaptive local noise reduction filter. It uses global variance of the noise, local mean and local variance in a moving grid of specified size. It tries to preserve edges as closely as possible. The global variance value can be specified or it can be computed from a window. The global variance can have one value for the entire clip or can vary frame to frame linearly or computed from a window with its coordinates linearly moving with frame numbers .

This plugin works in YUY2, YV12, RGB32 and RGB24 color spaces. In case of YUY2 or YV12 formats limiting process to luma ( Y) only exists. Option to use Y plane variance for U and V planes exists, however, (as the variance values in a table below shows them to be dissimilar) it may not be good idea to do so

The window for computing global variance should be located in an area with least image grey level variations, so that noise statistic is correctly estimated. Note that this window coordinates must be specified as default values are not provided

The process tries to retain the sharpness of the image, though some blurring may be unavoidable. The process may be repeated number of times to get desired result. However results depend on window selected.

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
Number of pixels along x axis in moving grid | xgrid | integer | 3 to 9 | 5
Number of pixels along y axis in moving grid | ygrid | integer | 3 to 9 | xgrid
Is Global variance to be computed? | getvar | boolean | true for yes, false for is specified | true
Is variance valid for all clip or only frame | clip | boolean | true for yes, false for frame | true
window left x at start frame for computing global variance | lx | integer | within clip, less than rx | none. Must be specified
window top y at start frame for computing global variance | ty | integer | within clip, less than by | none. Must be specified
window right x at start frame for computing global variance | rx | integer | within clip, more than lx | none. Must be specified
window bottom y at start frame for computing global variance | by | integer | within clip, more than ty | none. Must be specified
window left x at end frame for computing global variance | elx | integer | within clip, less than erx | lx
window top y at end frame for computing global variance | ety | integer | within clip, less than eby | ty
window right x at end frame for computing global variance | erx | integer | within clip, more than elx | rx
window bottom y at end frame for computing global variance | eby | integer | within clip, more than ety | by
Variance specified at start frame | var | int | >0 | 100
Variance at end frame | evar | int | >0 | var
Whether U and V of YUY2 and YV12 formats to be denoised | uv | boolean | true for uv process, false for not process | true
Whether variance of Y to be used for u and v also | usey | boolean | true yes, false no | false
Whether variance values are to be displayed as an error message | show | boolean | true yes, false no | false

Usage examples
Denoise()
DeNoise(a,35,55,clip=false,lx=220,rx=245,ty=322,by=402)
DENOISE(d,getvar=false,var=120,evar=160,xgrid=5,ygrid=7)
On top input, center is Output and at bottom noise removed example

following script used to get the images below:

    denoise(img1, lx = 350, rx = 390, ty=460,by=560,uv = true, usey = false)

On left is input, middle is with 2 iterations, right is with 4 iterations
Left 6 iterations, middle 8 iterations, right 10 iterations
The variance values within the specified window after each iteration of the above example is given in the table below.

iter no | rgb red | rgb green | rgb blue | yuy2 y | yuy2 u | yuy2 v | yv12 y | yv12 u | yv12 v
0 | 116 | 76 | 174 | 61 | 8 | 22 | 61 | 8 | 22
1 | 42 | 20 | 98 | 16 | 6 | 19 | 16 | 6 | 19
2 | 31 | 14 | 91 | 12 | 5 | 18 | 12 | 4 | 18
3 | 28 | 11 | 89 | 9 | 5 | 17 | 9 | 4 | 17
4 | 25 | 9 | 88 | 9 | 4 | 17 | 9 | 4 | 17
5 | 24 | 9 | 88 | 8 | 4 | 17 | 8 | 3 | 16
6 | 22 | 8 | 88 | 8 | 4 | 17 | 8 | 4 | 16
7 | 21 | 8 | 88 | 7 | 3 | 17 | 7 | 3 | 15
8 | 20 | 7 | 88 | 7 | 4 | 17 | 7 | 3 | 15
9 | 19 | 8 | 89 | 7 | 3 | 18 | 7 | 3 | 16
10 | 19 | 8 | 89 | 7 | 3 | 18 | 7 | 3 | 16

To my index page | ................................ | To Avisynth