1
$\begingroup$

Im new in this image processing field so please be gentle with terminology, i have a kernel of 3x3 and i want some way in order to test if its a high pass filter or not

Thanks in advance

$\endgroup$
  • 1
    $\begingroup$ How about applying the two dimensional Discrete Fourier Transform to it and then looking at the spectrum (?) $\endgroup$ – A_A Jun 8 '18 at 13:12
  • $\begingroup$ Can you please elaborate on "looking at the spectrm"? im really new at this, thanks $\endgroup$ – Laughing Man Jun 11 '18 at 8:30
0
$\begingroup$

Suppose that you have the filter's impulse response in some $h$ which is of dimensions $N_h^2$. Here is an example for $N_h = 5$, a very simple smoothing mask:

$$h = \begin{matrix} 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1\end{matrix}$$

A smoothing mask is also known as a low pass filter and its effect is to suppress the information found in the high frequencies of an image (the "details"). Therefore, the effect of a "low pass filter" is to blur the image.

While there are many different ways to produce a low pass filter, the archetypal low pass filter looks like this

Therefore, if we wanted to determine what sort of filter does $h$ represent, we would have to look at its Frequency Response. The primary tool that allows us to look at the frequency response of any given mask is the two dimensional Discrete Fourier Transform.

The magnitude spectrum of the 2D DFT for the particular $h$ that I wrote above looks like this:

enter image description here

To interpret this diagram, you have to understand that, by convention, we take the low frequencies to be associated with the locations that are close to the middle of the image and the high frequencies to be associated with the locations in the periphery of the image.

This frequency response seems to be favouring low frequencies (lobe in the middle of the image) over high frequencies, therefore it is a low pass filter.

This mask however:

$$h_2 = \begin{matrix} 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & -24 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1\end{matrix}$$

Has this frequency response:

enter image description here

Which as you can see seems to be doing the opposite, by favouring frequencies at the periphery of the image over frequencies towards the middle of the image.

For more information on how to obtain similar plots of frequency responses, please see fft2, fftshift, abs and surf.

Hope this helps.

$\endgroup$
  • $\begingroup$ @LaughingMan Glad to hear you found it helpful, you can upvote or accept the answer, from the controls on the left of the answer box, which will stop the question from circulating the board as unanswered. $\endgroup$ – A_A Jun 12 '18 at 11:07
  • $\begingroup$ I think it is not clear what you are reffering to when you say we take the low frequencies to be associated with the locations that are close to the middle of the image. A low pass filter smootsh highly textured areas containing many edge and color changes while keeping large uniform zones and smooth color gradients. Your are right that low frequences are located at the magnitude spectrum middle but not at the image middle. This paragraph is just a little bit confusing so! $\endgroup$ – Louis Lac Jun 14 '18 at 14:59
1
$\begingroup$
  1. Proper way: do a Fourier transform and look at the magnitude of the result
  2. Quick and dirty: take the sum of all all elements. If it's zero or small compared to the absolute sum, it has some high pass-ness to it.
$\endgroup$
  • $\begingroup$ One might also be able to deduce it by converting the filter to continues time, using the tustin method for example, and look at its poles and zeros. $\endgroup$ – fibonatic Jun 9 '18 at 11:06
  • $\begingroup$ Can you please elaborate on "look at the magnitude of the result" part? thanks :D $\endgroup$ – Laughing Man Jun 11 '18 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.