# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# wiener2

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

## Syntax

`J = wiener2(I,[m n],noise)[J,noise] = wiener2(I,[m n])`

## Description

`wiener2` lowpass-filters a grayscale image that 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.

`J = wiener2(I,[m n],noise)` filters the image `I` using pixelwise adaptive Wiener filtering, using neighborhoods of size `m`-by-`n` to estimate the local image mean and standard deviation. If you omit the `[m n]` argument, `m` and `n` default to 3. The additive noise (Gaussian white noise) power is assumed to be `noise`.

`[J,noise] = wiener2(I,[m n])` also estimates the additive noise power before doing the filtering. `wiener2` returns this estimate in `noise`.

## Class Support

The input image `I` is a two-dimensional image of class `uint8`, `uint16`, `int16`, `single`, or `double`. The output image `J` is of the same size and class as `I`.

## Examples

For an example, see Remove Noise By Adaptive Filtering.

collapse all

### Algorithms

`wiener2` estimates the local mean and variance around each pixel.

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

and

`${\sigma }^{2}=\frac{1}{NM}\sum _{{n}_{1},{n}_{2}\in \eta }{a}^{2}\left({n}_{1},{n}_{2}\right)-{\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\left({n}_{1},{n}_{2}\right)=\mu +\frac{{\sigma }^{2}-{\nu }^{2}}{{\sigma }^{2}}\left(a\left({n}_{1},{n}_{2}\right)-\mu \right),$`

where ν2 is the noise variance. If the noise variance is not given, `wiener2` uses the average of all the local estimated variances.

## References

[1] Lim, Jae S., Two-Dimensional Signal and Image Processing, Englewood Cliffs, NJ, Prentice Hall, 1990, p. 548, equations 9.26, 9.27, and 9.29.