Photoshop High Pass filter, what does it do actually?

Discussion in 'Digital Darkroom' started by olli_salonen, Jan 6, 2004.

  1. As I'm not using PhotoShop, but GIMP (in Linux) I would like to know
    what does PhotoShop's High Pass filter do. Is there a way to replicate
    the effect with a convolution matrix?

    For example, if I choose a radius of 10 in PhotoShop, what would be
    the equivalent convolution matrix? Is 3x3 or 5x5 matrix sufficent?

    What I am after, is high pass sharpening in GIMP of course...

    Thanks,
    Olli Salonen
     
  2. Ok, I found a partial answer through experiments. Photoshops high pass filter uses the following convolution matrix (or at least very similar):

    -1 0 0 0 -1
    0 -1 0 -1 0
    0 0 8 0 0
    0 -1 0 -1 0
    -1 0 0 0 -1

    This is of course for a high pass filter with radius 2. There seems to be a little more noise in the image, when convolution matrix is used, so my reasoning is probably not perfect or PS uses some kind of noise reduction.
    But THE problem is: how on earth can I use a 21x21 convolution matrix?! Could this be avoided with some math?
     
  3. I high pass filter essentially extracts high frequency detail while a blur (low pass) filter removes high frequency detail. Hence some high pass filtering methods can be created by subtracting a blurred version of an image from the original and adding an offset (127) to center the result in the interval [0,255].

    For saving CPU time I would suggest exploring separable blurs like the Gaussian blur so that you can do two passes with a 1-D kernel rather than a single pass with a 2-D kernel. This moves your computation into O(n) time rather than O(n^2) time where n is your radius.

    Explore what you can create and remember that most 2-D kernels are not separable.

    I should note that this is roughly the first half of how you calculate the Unsharp Mask filter. Albeit, I have only looked closely enough at Photoshops implementation to know that their underlying blur is not the Gaussian Blur as they have a much stronger edge response.

    my $0.02,

    Sean
     
  4. yep the matrix is -1 on the diagonales and n in the middle(where n is the radius), as of non int radius, it's just a different weight for the n+1 coefficient.

    now as to make it faster i doubt you can, but it's still just n+1 addition/substractions per pixel, that's not much compared to a full matrix
     
  5. oh yeah i forgot, you can also make a blur of radius 21, and then substract it to the image
    that should make about the same
     

Share This Page