Functions > Image Processing > Convolution and Filters > Wiener Filtering
  
Wiener Filtering
wiener2d(M, win_h, win_w)—Performs 2D adaptive Wiener filtering on M using a local window win_w pixels wide by win_h pixels high.
Wiener filtering was one of the first methods developed to reduce additive random noise in images. It works on the assumption that additive noise is a stationary random process, independent of pixel location; the algorithm minimizes the square error between the original and reconstructed images. Wiener filtering is a low-pass filter, but instead of having a single cutoff frequency, it is a space-varying filter designed to use a low cutoff in low-detail regions and a high cutoff to retain detail in regions with edges or other high-variance features. The window size determines the overall frequency cutoff: larger windows correspond to lower cutoff frequencies, and therefore more blurring and noise reduction.
There are several possible implementations for Wiener filtering. The one used in this PTC Mathcad function is the pixel-by-pixel 2D adaptive Wiener filtering proposed by Lee in 1980 (see Two-Dimensional Signal and Image Processing, by Jae S. Lim, pages 536-40), where a space-varying filter is used, and the additive noise is assumed to be white and zero-mean.
In this algorithm, a pixel y in the filtered image is derived from a pixel x in the noisy input image by the following transformation:
where μx and vx are the mean and variance of x in a neighborhood around the pixel (the neighborhood size is given by the win_h and win_w arguments to the function), and vn is the variance of the additive noise, estimated from the input image. Each pixel in the output is the sum of the local mean from a neighborhood of the input pixel and a local contrast term (x - μx) that is scaled so that in high-detail regions, where noise variance (vn) is much smaller than image variance (vx), the scaling factor is very close to 1 and the output pixel y is very close to the input pixel x with little filtering, but in low-detail regions, where the image variance is lower, the output pixel tends to be more like the local mean (that is, it is low-pass filtered).
Boundaries of the image are treated as extending with zero grayscale values, which may make output pixels near the image boundaries invalid (up to the size of the neighborhood window). Also, the neighborhood window should not be larger than the input image.
Arguments
M is an image matrix.
win_h, win_w are integers.