This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


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.


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


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.


collapse all

This example shows how to use the wiener2 function to apply a Wiener filter (a type of linear filter) to an image adaptively. The Wiener filter tailors itself to the local image variance. Where the variance is large, wiener2 performs little smoothing. Where the variance is small, wiener2 performs more smoothing.

This approach often produces better results than linear filtering. The adaptive filter is more selective than a comparable linear filter, preserving edges and other high-frequency parts of an image. In addition, there are no design tasks; the wiener2 function handles all preliminary computations and implements the filter for an input image. wiener2, however, does require more computation time than linear filtering.

wiener2 works best when the noise is constant-power ("white") additive noise, such as Gaussian noise. The example below applies wiener2 to an image of Saturn with added Gaussian noise.

Read the image into the workspace.

RGB = imread('saturn.png');

Convert the image from truecolor to grayscale.

I = rgb2gray(RGB);

Add Gaussian noise to the image

J = imnoise(I,'gaussian',0,0.025);

Display the noisy image. Because the image is quite large, display only a portion of the image.

title('Portion of the Image with Added Gaussian Noise');

Remove the noise using the wiener2 function.

K = wiener2(J,[5 5]);

Display the processed image. Because the image is quite large, display only a portion of the image.

title('Portion of the Image with Noise Removed by Wiener Filter');


wiener2 estimates the local mean and variance around each pixel.




where η is the N-by-M local neighborhood of each pixel in the image A. wiener2 then creates a pixelwise Wiener filter using these estimates,


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.26, 9.27, and 9.29.

See Also


Introduced before R2006a

Was this topic helpful?