Guassian Smoothing in Csharp
CoderSource.net
Guassian Smoothing in Csharp - Article by asif
Level: MediumType: Article
Rating: 4Page: 1 of 1

Date: 6/23/2005 12:00:00 AM

Environment: .Net, windows

Gaussian Smoothing in CSharp

Brief Description

The Gaussian smoothing operator is a 2-D convolution operator that is used to `blur' images and remove detail and noise.

In this sense it is similar to the mean filter, but it uses a different kernel that represents the shape of a Gaussian (`bell-shaped') hump. This kernel has some special properties which are detailed below.

How It Works

The Gaussian distribution in 1-D has the form:

Eqn:eqngaus1

where Eqn:eqnsigma is the standard deviation of the distribution. We have also assumed that the distribution has a mean of zero (i.e. it is centered on the line x=0). The distribution is illustrated in following diagram.

In 2-D, an isotropic (i.e. circularly symmetric) Gaussian has the form:

Eqn:eqngaus2

This distribution is shown in Figure 2.


Figure 2 2-D Gaussian distribution with mean (0,0) and Eqn:eqnsigma=1

The idea of Gaussian smoothing is to use this 2-D distribution as a `point-spread' function, and this is achieved by convolution. Since the image is stored as a collection of discrete pixels we need to produce a discrete approximation to the Gaussian function before we can perform the convolution. In theory, the Gaussian distribution is non-zero everywhere, which would require an infinitely large convolution kernel, but in practice it is effectively zero more than about three standard deviations from the mean, and so we can truncate the kernel at this point. Figure 3 shows a suitable integer-valued convolution kernel that approximates a Gaussian with a Eqn:eqnsigma of 1.0.

Figure 3 Discrete approximation to Gaussian function with Eqn:eqnsigma=1.0

Once a suitable kernel has been calculated, then the Gaussian smoothing can be performed using standard convolution methods. The convolution can in fact be performed fairly quickly since the equation for the 2-D isotropic Gaussian shown above is separable into x and y components. Thus the 2-D convolution can be performed by first convolving with a 1-D Gaussian in the x direction, and then convolving with another 1-D Gaussian in the y direction. (The Gaussian is in fact the only completely circularly symmetric operator which can be decomposed in such a way.) Figure 4 shows the 1-D x component kernel that would be used to produce the full kernel shown in Figure 3 (after scaling by 273, rounding and truncating one row of pixels around the boundary because they mostly have the value 0. This reduces the 7x7 matrix to the 5x5 shown above.). The y component is exactly the same but is oriented vertically.

Figure 4 One of the pair of 1-D convolution kernels used to calculate the full kernel shown in Figure 3 more quickly.

A further way to compute a Gaussian smoothing with a large standard deviation is to convolve an image several times with a smaller Gaussian. While this is computationally complex, it can have applicability if the processing is carried out using a hardware pipeline.

The Gaussian filter not only has utility in engineering applications. It is also attracting attention from computational biologists because it has been attributed with some amount of biological plausibility, e.g. some cells in the visual pathways of the brain often have an approximately Gaussian response.

Basic Working:

The effect of a Gaussian Smoothing 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.

References:

E. Davies Machine Vision: Theory, Algorithms and Practicalities, Academic Press, 1990, pp 42 - 44.

R. Gonzalez and R. Woods Digital Image Processing, Addison-Wesley Publishing Company, 1992, p 191.

R. Haralick and L. Shapiro Computer and Robot Vision, Addison-Wesley Publishing Company, 1992, Vol. 1, Chap. 7.

B. Horn Robot Vision, MIT Press, 1986, Chap. 8.

D. Vernon Machine Vision, Prentice-Hall, 1991, pp 59 - 61, 214.

 


Attachments

Project Files Gaussian Smoothing

1

You Can Rate this Article, if you are Logged In      
 

More Links from CoderSource.net:

 
Refer to a Friend:

Your Details:

Name:     e-mail:

Friend Details:

Name:    e-mail:    


MENU
Home
MFC 
C++
.Net
WIN32
Programming
Forum
My Articles
Add to Google
Add to My Yahoo!
Welcome to Codersource.Net Login | Register | Faq  

SEARCH
Google
 

NOTES:


Thanks for visiting our CoderSource.net. This site will be improved with more articles. Interested visitors can also submit their articles through the Submit Article link.Your article will also be published after due consideration by the editor. 

© Copyright 2003. All rights on content reserved by CoderSource.net. Contact    About Us