### How To Use Gaussian Lowpass Filter – C# Guide

We’ve talked about ideal lowpass filter and Butterworth lowpass filter already. And now, we shall get to know the last type of lowpass filters, which is Gaussian lowpass...

Filter by Category

- C# Tutorial(85)
- C# Image Processing(69)
- Morphological Processes(20)
- Image Processing(16)
- Image Restoration and Reconstruction(16)
- Image Segmentation(13)
- C# Data Structures And Algorithms(11)
- Color Image Processing(8)
- Frequency Domain Filtering(8)
- Image Noise(6)
- Grayscale Morphology(5)
- Thresholding(4)
- Order-Statistic Filters(4)
- Mean Filters(4)
- Sorting Algorithms(4)
- Morphological Reconstruction(3)
- Edge Detection(3)
- Simple Lists(2)
- RGB to HSI Color Model(2)
- Adaptive Filters(2)
- Tone and Color Corrections(2)
- Linked Lists(2)
- Stacks(1)
- Queues(1)
- Point Detection(1)
- Line Detection(1)
- C# Arrays(1)
- Region Segmentation Using Superpixels(1)
- Region Segmentation With K Means Clustering(1)
- Region Splitting And Merging(1)
- Sorted Lists(1)
- Region Growing Segmentation(1)
- Digital Image Watermarking(1)
- Using Color In Image Segmentation(1)
- Social Games(1)
- Bandreject Filters(1)
- Bandpass filters(1)
- Notch Filters(1)
- Landing Pages(1)
- Intensity Slicing and Color Coding(1)
- Color Slicing(1)
- Histogram Processing Color Images(1)
- Color Image Smoothing And Sharpening(1)
- C# Basics(1)

Back to Latest Articles
###
How To Use Gaussian Lowpass Filter – C# Guide

###
How To Use Butterworth Lowpass Filter – C# Guide

###
How To Use Ideal Lowpass Filter With FFT – C# Guide

###
How To Use Fourier Transform On Images – C# Guide

###
Histogram Equalization And Magic Behind It

###
Intensity Level Slicing With C# – Explore Image Processing

###
C# Tutorial: Contrast Stretching with Normalization

###
C# Tutorial: How To Use Log Transformation on Images

###
C# Tutorial: How To Flip an Image Horizontally

###
C# Tutorial: How To Scale Images Without Deforming Them

C# Tutorial

We’ve talked about ideal lowpass filter and Butterworth lowpass filter already. And now, we shall get to know the last type of lowpass filters, which is Gaussian lowpass...

C# Image Processing

Butterworth lowpass filter is used to modify images in the frequency domain.

C# Image Processing

Ideal lowpass filter is a filter used to modify frequency values in the frequency domain, and for transforming an image into a frequency domain, we have to use Fourier transform....

C# Image Processing

Fourier transform is an equation that turns normal pixel values into complex numbers. But to know what these complex numbers mean, we should give a little more context to them by...

C# Tutorial

C# tutorial on how to achieve histogram equalization on an image.

C# Tutorial

In this tutorial we will be talking about intensity level slicing in image processing. What is Intensity Level Slicing It’s a process that highlights pixels in an arbitrary...

C# Tutorial

This post is a short revision of Contrast Stretch post we already worked on in the past. Where we talked about histogram equalization, which is a little more complex method than...

C# Tutorial

What is Log Transformation Anyway? Log transformation in image processing is a part of gray level transformations. It works by transforming each pixel individually. It is usually...

C# Tutorial

Where Do We Start? There are numerous ways you can flip an image horizontally. It’s pretty basic functionality in image processing. I wanted to challenge myself and not just...

C# Tutorial

Let’s Get Started A very basic problem that we face in image processing is how to scale images without making them look deformed when we want to make it of an arbitrary...

How To Use Gaussian Lowpass Filter –...

We’ve talked about ideal lowpass filter and Butterworth lowpass filter already. And now, we shall get to know the last type of lowpass filters, which is Gaussian lowpass filter.

I imagine you’re already familiar with the workings of Fourier transform pair and filtering in the frequency domain. And in case you just heard about it now and want to know more, please check out other posts on this topic. I’ll try my best to keep things short and concise.

Lowpass filters in general modify frequency map by removing high frequencies and passing through only low frequencies. High frequencies carry information of sharp transition between colors in spatial domain like edges or noise.

By removing high frequencies we essentially blur the image. And I already made a post how to create Gaussian blur on images by convoluting Gaussian filter in the spatial domain.

Gaussian lowpass filter differs from other lowpass filters in smooth transition beyond cut off frequency. This cut off frequency acts as a circular border around the center of the frequency map beyond which higher frequencies begin to fade to 0.

We can control how blurred the output image will be by setting the radius of the circle. The smaller the circle of passed frequencies in the middle will be, blurier the image will get.

To calculate filter values we use the following formula:

Where D(u,v) is calculated as:

M and N are the same size in the function as follows. That’s because Fast Fourier transform accepts only square images with 2^{n} being the size of each dimension.

```
public static Complex[][][] Gaussian_Lowpass_Filter(Complex[][][] frequencies, double distance)
{
int channels = 3;
Complex[][][] filtered = frequencies;
for (int c = 0; c < channels; c++)
{
for (int u = 0; u < Size; u++)
{
for (int v = 0; v < Size; v++)
{
double d = Math.Sqrt(Math.Pow(u - Size / 2, 2) + Math.Pow(v - Size / 2, 2));
filtered[c][u][v] *= (float)(Math.Pow(Math.E, -Math.Pow(d, 2) / (2 * Math.Pow(distance, 2))));
}
}
}
```` return filtered;`

` }`

When we use ideal and Butterworth lowpass filters we can get some unwanted artifacts (color blobs) on our image. We call it ringing and it appears because the fading border around the circle of passed frequencies is too thin.

With Ideal lowpass filter there is no fading beyond cut off frequency much like cutting cookie doe shapes.

Butterworth lowpass filter is more controlable because we can set its order to set the width of the fading border around the circle. The higher the order is, thinner the border gets. Usually if we use orders of 3 and above, we can experience ringing.

Gaussian lowpass filter doesn’t have such problem because the fading border is always thick enough. If we’re processing images where artifacts are super unwanted, like images for medical purposes, this is the filter to go with. But if you want to have control over the filter and its thickness of the fading border, Butterworth lowpass filter would be the right choise.

Hopefully this guide was undestandable and helpful. You can also download the entire project. Play with the settings yourself and see how it works line by line.

Have a good one and hope to see you in the next one.