# High pass or low pass kernel?

I am so confused about the high pass and low pass kernel. I saw some posts, and it says the sum of all coefficients is 0 is a high pass and if it is 1 is a low pass. And I think I did understand the concept of nulling out the DC part. However, when I was reading my lecture note, I saw this kernel, and it says to be a high pass, but the sum is not 0. (-1*8 + 9 = 1)

Sometimes I see that some kernels may look like this. I don't understand what the difference is and cannot tell precisely whether is a high-pass or low-pass kernel.

• "says the sum of all coefficients is 0 is a high pass and if it is 1 is a low pass" that's wrong. Whoever wrote that needs to learn the difference between "necessary" and "sufficient". Oct 8, 2022 at 8:49
• the kernels you show do let through a DC component, but they're not low-pass filters. There's simply filters that are neither. Oct 8, 2022 at 9:00

Summation techniques over filter coefficients are quick checks, not proofs. They ought to be interpreted differently. If the sum is zero, the filter is not likely low-pass, because it does not let the DC. If the sum of coefficients with alternating signs is zero, it is not likely high-pass.

For your question now. The kernel

$$K=\begin{bmatrix} 1 &1 &1\\ 1 &-9 &1\\ 1 &1 &1 \end{bmatrix}$$

indeed looks like a 8-connected discrete Laplacian/Laplace operator,

$$L=\begin{bmatrix} 1 &1 &1\\ 1 &-8 &1\\ 1 &1 &1 \end{bmatrix}$$

except for the $$-9$$ in the center. You can resort to discrete-time Fourier transforms, computations to understand its behavior. But you can also use the linearity principle. The difference between $$K$$ and $$L$$ is:

$$D=\begin{bmatrix} 0 &0 &0\\ 0 &-1 &0\\ 0 &0 &0 \end{bmatrix}$$

or the opposite of a discrete Dirac kernel. It turns the image into its opposite, somehow its "negative". Therefore $$K$$ acts on image $$I$$ as:

$$I\ast K = I\ast L + I\ast D = I\ast L-I$$

The combined result is a standard image feature detector, a discrete Laplacian $$L$$ (a low-cut filter), subtracted from a copy of the original image. Operator $$L$$ is a discrete second derivative, clearly low-cut. $$D$$ is a discrete Dirac, therefore all-pass. Hence, the result is a edge-enhancement minus the signal. This is illustrated below.

Certainly your kernel is, at the very least, high-pass-ish.

$$K = \begin{bmatrix}-1 & -1 & -1 \\ -1 & 9 & -1 \\ -1 & -1 & -1\end{bmatrix}$$ is going to be almost a high-pass filter, plus a huge amount of gain. What you should get is massively enhanced edges but with big swaths of the same color remaining untouched.

Note that in some contexts one could get away with calling this a highpass filter, but strictly speaking it's a high-frequency enhancing filter (or edge-enhancing, in the context of image processing).

(I just tried it -- it looks horrible on my test image. This is not a surprise).

I found some fine art for my test image. Here it is, plus the image run through your sorta-highpass, and the image run through the actual 3x3 highpass. All of these are just displayed as-is, without any further attempts to pretty them up: