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