Mean Filtering in CSharp (C#)

Brief Description
Mean filtering is a simple, intuitive and easy to implement method of smoothing images, i.e. reducing the amount of intensity variation between one pixel and the next. It is often used to reduce noise in images. Mean Filter is the most common of all the filtering techniques.
How It Works
The idea of mean filtering is simply to replace each pixel value in an image with the mean (`average') value of its neighbors, including itself. This has the effect of eliminating pixel values which are unrepresentative of their surroundings. Mean filtering is usually thought of as a convolution filter. Like other convolutions it is based around a kernel, which represents the shape and size of the neighborhood to be sampled when calculating the mean. Often a 3×3 square kernel is used, as shown in Figure 1, although larger kernels (e.g. 5×5 squares) can be used for more severe smoothing. (Note that a small kernel can be applied more than once in order to produce a similar but not identical effect as a single pass with a large kernel.)
Computing the straightforward convolution of an image with this kernel carries out the mean filtering process.
Common Variants
Variations on the mean smoothing filter discussed here include Threshold Averaging wherein smoothing is applied subject to the condition that the center pixel value is changed only if the difference between its original value and the average value is greater than a preset threshold. This has the effect that noise is smoothed with a less dramatic loss in image detail.
 
Other convolution filters that do not calculate the mean of a neighborhood are also often used for smoothing. One of the most common of these is the Gaussian smoothing filter.
Basic Working:
The effect of a mean Filter on the Image:
The result after convolution is as:
Sample Project
The GUI of the whole Project is as:
The project is a part of the series of the image processing articles written just for the prosperity and help for the students searching for Image Processing free stuff.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Basic Image Processing in Csharp

The C# provides a good support for processing on the image, and the purpose of this article...

Implementation Of Branch And Bound Algorithm

What is Branch and Bound Algorithm? These notes follow the discussion of branch and...

Implementation of Calculating the RTS Invariant Moments Of Area

Why Using Moments of Area? It is seen that the usage of moments of area highly...

Conversion of a Color Image to a Grayscale Image

What is a Color Image? It is possible to construct (almost) all visible colors by...

GrayLevel Image Contras Stretching in C#

Overview Contrast stretching (often called normalization) is a simple image...