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

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

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 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: How To Use Log Transformation on Images

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

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

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

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

Ideal highpass filter does exactly the opposite of ideal lowpass filter. It only passes high frequencies and removes low frequencies. So if you imagine how lowpass yielded a circle of frequencies in the middle, highpass filters do the exact opposite – a black hole in the middle.

In case you’re just tunning in, I’m talking about filtering in the frequency domain. So first thing we need to do is convert image into frequency domain using Fourier transform. Then we filter it and use inverse Fourier transform to turn it back into spatial domain.

When we’re filtering images in frequency domain there is a chance that some unwanted artifacts will appear on the image once we transform it back into spatial domain. We call this kind of effect ringing and it looks like colored blobs on the image.

Ringing appears because of abrupt attenuation of low frequencies beyond the set cut off frequency. We need to set a cut off frequency, which is basically a radius of the “black hole” in the middle of the frequency map.

You can visualize Fourier transform of an image by normalizing the magnitudes of the frequency map and bring their range down between 0 and 255. Once we get those values down to displayable range, we also need to use logarithmic transform on them.

The purpose of logarithmic transformation is to make values visible. Largest frequency is in the center of the map. Prior to logarithmic transformation, we wouldn’t be able to see much of anything else besides the center.

I’ve written a function that filters frequency maps across all color channels. For it to work, we also need to give it 3 frequency maps in a form of 3 dimensional jagged array of complex numbers. And of course we need to give it the cut off frequency – the radius of the circle in the middle.

```
public static Complex[][][] Ideal_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));
if (d <= distance)
{
filtered[c][u][v] = new Complex(0, 0);
}
else
{
filtered[c][u][v] = frequencies[c][u][v];
}
}
}
}
```` return filtered; `

`}`

It’s almost the same as the function for ideal lowpass filter. The only difference between the two is that we swapped which values we keep.

This tutorial is just one in a series where we talked about filtering in the frequency domain. The majority of the work the program does is conversion of the image from spatial domain to frequency domain and back.

You can download the entire project and try it out yourself. Maybe try playing with the values and see how it effects the filtered image as well.

## Comments