18

I'm trying to wrap my head around this filter. Like some other filters, I find that I don't understand how it works, both visually and in terms of the algorithm. I'm hoping that by learning the latter, the former would also somehow click in.

28

High pass is the opposite of gaussian blur

If you take an image and blur it you only keep the "low frequencies". High pass makes the opposite, it only lets the "high frequencies" pass, or what most people call "the details". Any image can be deconstructed into these two components.

deconstructed image

Have you used unsharp mask to sharpen an image? That filter is actually equivalent to taking an image and adding a high pass filtered copy to it. You can confirm this in Photoshop by applying the high pass filter on a duplicated layer and change the blend mode to overlay.

enter image description here

  • 5
    You might want to add that the image is gray because its offset to avoid negative values. And overlay is basically add anything above 128 and subtract values below. So unsharpmask is basically boost high frequencies filter. I am adding an answer to this effect but would prefer to delete it in favor of your answer. Also there is still a 3rd usecase which is frequency separation. – joojaa Apr 20 '17 at 11:15
  • 2
    Minor quibble: 1st sentence: "Filters out" means "eliminates," so a low-pass filter (blur) does not "filter out the low frequencies." High-pass filter (allows high frequencies to pass through it);low-pass filter (allows low frequencies to pass through it). A low-pass filter is also called a "high-cut filter" since it eliminates high frequencies. And so it goes for a high-pass being a low-cut. – Yorik Apr 20 '17 at 16:01
  • joojaa- good comment. Yorik - thank you, fixed it. – filip Apr 20 '17 at 17:23
  • 1
    Holy crap. Take an image into a Photoshop file. Duplicate the layer with the image in it. Blur (value 10) on layer 1. High pass filter (value 10) on layer 2. Set layer 2 to 50% opacity. Add a contrast layer, set it to legacy and +50 contrast. Compare that to the original image. Mind blown. That perfectly explains what it all does. – Dirk v B Apr 21 '17 at 5:40
  • @DirkvB I tried what you said and it worked. Could you explain the reasoning behind 50% opacity and +50 contrast? Also to note, this method closely recreates the original image, but it is not identical (just run a difference blend between original and this one to see what I mean). – Doug Richardson Sep 24 '17 at 22:34
7

A high pass filter is a fitter that removes low frequency information form a singnal. Now there are many ways to implement a high pass filter, but photoshops high pass filter most likely is the result by subtracting the blurred image from the original (as mentioned by @filip). Simply all of image minus the low frequency is just the high frequency.

Now if you subtract a blur from a image you will end up with pixels that are negative. This is not possible for photoshop. So what is instead done is the result is offset by 127 (or 0.5 if you want to floating point values) so gray actually means no value change. The overlay and linear light mode are designed to operate in reverse of images encoded this way (bit depending on what you need piece wise multiplication/addition or addition/subtraction).

Now what would you use this for? Well it can get used to isolate edges, and the primary use case is to use it as a sharpening tool. In fact unsharp mask does this in one step. Sometimes, however, unsharp mask does not give you enough control of the results. So you might use the high pass filter to split out the intermediate stage and manipulate it to control where you want the sharpening to happen and where not.

This brings us to frequency separation workflows, see it might be that your image is slightly unevenly light or quite often the skin is somewhat uneven. But you don't exactly want to destroy the texture of the image. So now you split your image into low and high components. You can then paint the low components to a moire uniform color, while retaining the texture layer on top. Or you can do the reverse eliminate flaws in the high frequency map while retaining the overall look and feel. For accuracy reasons you'd most likely not use both blur an high pass, instead you'd subtract manually, but this is still the same method just blurs and rounding of results differ.

Example

Image 1: Frequency separation makes it easy to fix old shoes, admittedly i should have done a bit more work. Original image from here.

Now there is a LOT of magic that you can do with this filter. But unfortunately many of these magic workflows may require you to think like a signal processing guru. For example high pass filtering may work as a basis for a noise reduction algorithm or as a rectifying layer for image lightness masked haze removal etc.

5

None of the answers so far have touched on the maths behind the filter. Here's a detailed writeup from which I quote:

Frequency filters process an image in the frequency domain. The image is Fourier transformed, multiplied with the filter function and then re-transformed into the spatial domain. Attenuating high frequencies results in a smoother image in the spatial domain, attenuating low frequencies enhances the edges.

At this point we should note that a high-pass filter passes high frequencies and attenuates (i.e. reduces) low frequencies.

As a result of attenuating (or blocking) the low frequencies, areas of constant intensity in the input image are zero in the output of the highpass filter. Areas of a strong intensity gradient, containing the high frequencies, have positive and negative intensity values in the filter output. In order to display the image on the screen, an offset is added to the output in the spatial domain and the image intensities are scaled. This results in a middle grayvalue for low frequency areas and dark and light values for the edges.

(This quote is from about halfway through, and precedes an example image that should be quite helpful).

The article I've linked is well worth a read, and has some quite clear examples (click on the images). It's too long to summarise and relies on the figures included in it.

  • and just for the layman's sake: attenuate means "reduce the force, value or impact" – Yorik Apr 20 '17 at 16:04
  • @Yorik that didn't occur to me. It's a word I use daily in my work. Edited – Chris H Apr 20 '17 at 19:18
  • 3
    @ChrisH Fourier transform is one way to implement a high pass filter (not the only on though) but i am pretty sure form past experimentation that Photoshop does not do a a Fourier directly but rather subtracts a blur instead. However, It might be that newer photoshops actually use Fourier for the blur (pre CS, CC versions did not apparently do this) since it offers a shortcut for computing the blur.... But FFT has its share of problems and might be that PS is actually just splatting a convolution kernel without this optimization in the loop. So i fact filip did explain how the filter is done. – joojaa Apr 20 '17 at 19:30
  • @joojaa subtracting a blur is what unsharp mask does though, and both options exist so I have my doubts. If I had photoshop I'd try to test (though as the shape of the filter in the Fourier domain is unknown if would be hard to prove decisively what's used). Anything I could test in the gimp wouldn't help much. – Chris H Apr 20 '17 at 20:06
  • 1
    @ChrisH and Fourier transforms on discrete data are also prone to noise. – OrangeDog Apr 21 '17 at 15:42
0

High Pass is a sharpening filter. You could say it's a mix of "detect edges" and "sharpening". Sharpening detect sudden changes between pixels brightness or color and then change them. So bright parts are brighter and dark one are darker.

But the High Pass task is to notice just the edges. The radius setting tells the filter how many pixels around detected edge should be included in the filtered image (layer).

Now, this filter is not designed to be used on itself (that's why, I think, it's in different catalog), you should use the filtered image with the base one, using blend modes or similar, to pop up the edges on picture. That's why the "not included" part of picture are neutral gray. So they won't affects colors when in blend mode.

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.