2-D adaptive noise-removal filtering

**The syntax wiener2(I,[m n],[mblock nblock],noise) has been removed.
Use the wiener2(I,[m n],noise) syntax instead.**

filters the grayscale image `J`

= wiener2(`I`

,`[m n]`

,`noise`

)`I`

using a pixel-wise adaptive
low-pass Wiener filter. `[m n]`

specifies the size
(`m`

-by-`n`

) of the neighborhood used to
estimate the local image mean and standard deviation. The additive noise (Gaussian
white noise) power is assumed to be `noise`

.

The input image has been degraded by constant power additive noise.
`wiener2`

uses a pixelwise adaptive Wiener method based on
statistics estimated from a local neighborhood of each pixel.

`wiener2`

estimates the local mean and variance around each pixel.

$$\mu =\frac{1}{NM}{\displaystyle \sum _{{n}_{1},{n}_{2}\in \eta}a({n}_{1},{n}_{2})}$$

and

$${\sigma}^{2}=\frac{1}{NM}{\displaystyle \sum _{{n}_{1},{n}_{2}\in \eta}{a}^{2}({n}_{1},{n}_{2})-{\mu}^{2}},$$

where $$\eta $$ is the *N*-by-*M* local
neighborhood of each pixel in the image `A`

.
`wiener2`

then creates a pixelwise Wiener filter using these
estimates,

$$b({n}_{1},{n}_{2})=\mu +\frac{{\sigma}^{2}-{\nu}^{2}}{{\sigma}^{2}}(a({n}_{1},{n}_{2})-\mu ),$$

where ν^{2} is the noise variance. If the noise variance is
not given, `wiener2`

uses the average of all the local estimated
variances.

[1] Lim, Jae S. *Two-Dimensional Signal and Image Processing*,
Englewood Cliffs, NJ, Prentice Hall, 1990, p. 548, equations 9.44, 9.45, and
9.46.