# Is the Sobel filter a high pass filter, and if not, what is the difference between them?

I am an artist with an interest in signal processing. I realize that maybe this question very basic, but the web banner on the frontpage says "anyone can ask", so I assume that means beginners too.

I have been trying to wrap my head around the terminology related to unsharp masks, high pass filters, the Sobel filter, etc.

According to my understanding unsharp masks use a high pass filter. The high pass filter helps define areas of transition in pixel value. This also has the effect finding edges. The pixels which are next to pixels brighter than them get darker, and the pixels which are next to pixels which are darker than them get brighter.

A friend of mine mentioned the Sobel operator was used for edge detection. I understand the basic idea of the Sobel operator as being the image treated as a grid. A matrix is the math term I see used often. According to him, the Sobel operator finds edges by applying a darkening or lightening effect based on the pixels around it. This sounds very similar to the unsharp mask's use of a high pass filter.

When I look online I don't see Sobel techniques referred to as high pass. I see pages like this that explictly list out Sobel separate from high pass filters.

But then I find published research papers which describe sobel edge detection filters as being a kind of high pass filter.

To me, my friend's description of the Sobel method sounds a lot like the descriptions I find of the high pass filter. My friend says they are different and I'm not sure I understand how?

# EDIT:

I think I need to clarify my question, since it's sort of a multipart question:

My questions are:

1) Is the unsharp mask using a high pass filter? Not IS it a high pass filter, but if it uses one.

2) Is the Sobel filter a high pass filter?

3) If it is, then what's the technical difference between the definition of the Sobel as a high pass filter and the high pass filter used in a digital unsharp mask?

I understand that digital unsharp masks are not high pass filters, but they do use them according to the signal processing pages I found.

• One should be cautious with a "research" paper that says "The nonlinear Sobel filter is a highpass filter". Sobel filters, at least the basic ones, are linear. And non-linear filters cannot be said highpass filters in general – Laurent Duval Jan 29 '19 at 9:37
• There seems to be some disagreement between your point and the other person who has posted an answer. I don't know who to trust on this. – David A. French Jan 29 '19 at 22:26
• @Fat32 and I share a strong common background. Could you elaborate on the disagreement? – Laurent Duval Jan 29 '19 at 22:35
• There is no disagreement between @LaurentDuval and me here, at least I don't disagree to his comment. I could not get your true intention in the question, which became a little more clear after your edit, hence let me reflect that in my answer. – Fat32 Jan 29 '19 at 22:54
• @LaurentDuval I really have difficulty in understanding what the OP is after, actually? If forced to chose between highpass or lowpass for the Sobel, which one would you pick? But I agree that, let free, I would not define Sobel as a highpass (brickwall !) filter. It's an edge detection algorithm (nonlinear) that relies on derivative approximations and thresholding. Derivative filters are high pass character and that was all I wanted to say... But they are not highpass filters used to sharpen an image nevertheless. – Fat32 Feb 3 '19 at 0:12

They are both highpass type filters, but used with very different intentions.

One should immediately observe the fundamental difference that the output of unsharp masking filter is an enhanced image to be viewed by humans, whereas the output of the Sobel (edge detector) filter is not an image to be viewed by humans, but rather a description of the edges to be further analysed by a machine vision system.

Digital imitation of an unsharp masking effect does not necessarily explicitly use a highpass filter in its implementation, yet effectively the operation that it performs is similar to the operation that a highpass filter performs, therefore it's equally valid to call itself as a highpass filter too.

More specifically, unsharp masking operates by subtracting a lowpass filtered version of the image from itself. Stated in impulse responses;

$$g[n_1,n_2]$$ being the output image and $$f[n_1,n_2]$$ being the input:

$$g[n_1,n_2] = a \cdot f(n_1,n_2) - b \cdot f_L(n_1,n_2)$$

where $$a > b$$ are two constants and $$f_L[n_1,n_2]$$ is the low pass filterd image,

$$f_L(n_1, n_2) = f(n_1,n_2) \star h_{LPF}[n_1,n_2]$$

where $$h_{LPF}[n_1,n_2]$$ is a lowpass filter and $$\star$$ denotes convolution.

Reordering the equation and noting that $$f[n_1,n_2] = f_L[n_1,n_2] + f_H[n_1,n_2]$$ we can see that

$$g[n_1,n_2] = (a-b) f_L[n_1,n_2] + a f_H[n_1,n_2]$$

or more specifically

$$g[n_1,n_2] = f[n_1,n_2] \star ( \delta[n_1,n_2] - a h_L[n_1,n_2])$$ $$g[n_1,n_2] = f[n_1,n_2] \star h_{eH}[n_1,n_2]$$

The last variable $$h_{eH}[n_1,n_2]$$ is the effective highpass filter that the unsharp mask algorithm is performing. So as you can see, it effectively includes a highass filter.

Unsharp masking is a picture enhancement technique borrowed from analog film processing era, which is used to improve the apparent sharpness of an image to be viewed. Since it increases the sharpness, it's effectively a high pass filter, but not very strong. It enhances edges, by making them stronger, too, and this is how it achieves improved, percepted, sharpness effect.

Sobel filter is actually an edge detection method and as such it's a nonlinear operator. However, its internal operation involves (basically) two directional impulse responses along horizontal and vertical directions that apporixmate the gradient of the image by using two LTI high pass filters. As, such it's using high pass filters internally, but its output image is obtained by further nonlinear processing (to keep edge pixels and throw out the rest) whose frequency response character does not exist, conventionally.

Sobel filter is, effectively, a very strong highpass filter used for machine vision purposes; specifically for edge detection. Since it's a strong highpass filter, it will eliminate all the low frequency content and its output will be black background and white lines denoting the edges, in addition to noisy dots and contours. It's never used to improve the sharpness of an image.

Sobel detector is fundamentally a derivate filter; note that derivative filters are always of highpass character, whereas integration filters are of lowpass character. They (the Sobel filters) compute the approximate derivative (or Gradient in 2D application) of a function at around the pixel points. This derivative is an indicator of a possible edge.

• Hi, thanks, yes I know that Unsharp masking is a picture enhancement technique, and I know that Sobel is not explictly used for sharpening but is instead used in the context of machine vision processing. My questions are: 1) Is the unsharp mask using a high pass filter? Not IS it a high pass filter, but if it uses one. 2) is Sobel a high pass filter? 3) If it is, then what's the technical difference between the defintion of the Sobel as a high pass filter and the high pass filter used in a digital unsharp mask? – David A. French Jan 29 '19 at 22:30
• ok. Do you know what an impulse response is ? – Fat32 Jan 29 '19 at 22:36

As images are 2D, image filters are 2D as well. This two-dimensional aspect entails that they can theoretically exploit all directions allowed in a 2D world. This is however limited in practice due to the discretization of the image grid in pixels, and the size of the filter. For a $$3 \times 3$$ grid as for the Sobel filter, you can easily see an horinzontal and a vertical direction, $$+45$$ and $$-45$$ degree orientations, but not much more.

An edge is a quite complicated concept. In the simplest model, it denotes a transition, seen on pixel values, between two (or more) regions, each of them being more or less homogeneous. So, we often say that pixels along the edge (domain 1) should possess a certain visual continuity. And the same along the edge, on either sides (domains 2 and 3). So the intensity values should be similar enough, of have close properties, separately in some of the three domains.

Then, run across the edge, one expects the values or the properties of pixel values to vary somehow. To detect an edge, one can exploit these two different behaviors jointly. To perform even better, filters should be able to deal with image imperfections (noise), and the fact that real edges are not perfectly aligned in the pixel grid.

So, among the quantity of filters, two behaviors are often combined: a smoother, that improves similarities in a domain, and an enhancer, that increases dissimilarities. You can for instance smooth in one given direction with a 1D filter, and enhance in another direction with another 1D filter, both 1D filters are combined into a genuine 2D filter that smoothes along, and enhances across. By switching directions, you can built another filter that selects another edge direction.

Sobel filters belong to that class. A 1D derivative (enhancer) in horizontal or vertical direction, a 1D weighted average (smoother) in vertical or horizontal direction. Since they are linear, we can easily speak about frequencies, but high frequencies can be horizontal, vertical, diagonal. Linear smoothers tend to preserve low frequencies, linear enhancers tend to preserve high frequencies. So Sobel are somehow hybrid filters: low in each direction, high in the other.

Unsharp masks often do not use predetermined directions. They smooth (blur) a patch globally, in 2D, and the result is combined with the original image, like subtracted. This way, it reduces the variations on smooth parts, and by constrast, enhance sharp parts. The 2D smoother can be non-linear (like a median), as well as the combination (like a division). So we should not talk about frequency. But, as 2D smooth parts are diminished, in a non-precise sense, unsharp masks tends to preserve the mid to high frequencies of an image.

To wrap it up:

1. Is the unsharp mask using a high pass filter? Not IS it a high pass filter, but if it uses one. No, not directly in general, as it uses a smoother "withdrawn from the image". But some instances of unmask filters may used one

2. Is the Sobel filter a high pass filter? It is more an directional hybrid

3. If it is, then what's the technical difference between the definition of the Sobel as a high pass filter and the high pass filter used in a digital unsharp mask? I hope the above text answers that