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

Gaussian highpass filter processes images in frequency domain. It attenuates low frequencies without creating ringing artifacts.

Filter by Category

- C# Tutorial(41)
- C# Image Processing(26)
- Image Processing(16)
- Image Restoration and Reconstruction(15)
- Frequency Domain Filtering(8)
- Image Noise(6)
- Mean Filters(4)
- Order-Statistic Filters(4)
- Landing Pages(1)
- Social Games(1)
- Bandreject Filters(1)
- Bandpass filters(1)
- Notch Filters(1)
- Adaptive Filters(1)

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

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

###
How To Use Ideal Highpass Filter – C# Guide

###
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

Gaussian highpass filter processes images in frequency domain. It attenuates low frequencies without creating ringing artifacts.

C# Tutorial

Butterworth highpass filter is used to filter images in frequency domain. We can control how smooth transition beyond cut off frequency.

C# Tutorial

Ideal highpass filter is used to filter images in the frequency domain. It attenuates low frequencies and keeps high frequencies.

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...

How To Use Gaussian Highpass Filter –...

Gaussian highpass filter is one of the highpass filters that has a lowpass counterpart. Highpass filters pass through only high frequencies and attenuates low ones.

Before we begin with filtering in the frequency domain, we should mention how to turn image into frequencies first. To transform image from spatial domain to frequency domain we need to use Fourier transform and in case you’re not familiar how the transform works, I recommend reading my post about it.

Formula for Gaussian highpass filter is very similar to formula fo Gaussian lowpass filter. Of course, no surprise there, the difference between the two is that we need to subtract the Gaussian lowpass filter value from 1 and we get the value for its highpass counter part.

Let’s get through each part of the formula, so we can better understand what each part represents. First of all, *H* is a function of *u* and *v*, which represent the coordinates of the filter value.

Just to be clear, the filter is the same size as the frequency map, and consequently the image, we’re processing.

*D _{0}* represents variable for cut off frequency, which is essentially the radius of the black hole our filter creates in the middle of our frequency map.

And finaly, *D(u, v)* value represents the distance of each frequency from the center of our frequency map at any given position. And it’s calculated by the following formula.

The *M* and *N* are width and height of our frequency map or image. These two are the same in our case since the fast Fourier transform algorithm takes only square images.

Following function takes a 3 dimensional jagged array of frequency values, which are in a form of complex numbers, which holds values from 3 Fourier transforms, one for each color channel. It also calculates all three frequency maps with the same cut off frequency.

```
public static Complex[][][] Gaussian_Highpass_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] *= 1 - (float)(Math.Pow(Math.E, -Math.Pow(d, 2) / (2 * Math.Pow(distance, 2))));
}
}
}
```` return filtered;`

` }`

This filter is known to give a very smooth transition between the high and low frequency on the border where we set our cut off frequency.

You can download the entire project for free and play with the values yourself. I hope you found this tutorial helpful. Have a good one.

## Comments