• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Please, help me to describe the high-pass math

Community Beginner ,
Jul 16, 2010 Jul 16, 2010

Copy link to clipboard

Copied

I want to request an estimate for a simple plugin, but I don't know how to explain the math involved to a developer who is not so graphically curious as I am.

I pushed the limits of my brain trying to reproduce the core of an idea for a photoshop filter, which happened to be ALMOST the same than the high-pass filter.

Mine just happens to work better if the high-pass is based on "Median" instead of "Gaussian Blur". That alone made my filter request explanation to be reduced in one whole page. (there was 10 layers with different blending modes and grouping to get it! hehe)

Now, do you know the Math behind the High-Pass? either SDK language or regular Math.


Can you show me how it would be calculated with Median instead?

Also, if you know how to do it, feel free to estimate the cost for me

I'm trying to kind of reproduce the manual unsharp mask technique, but creating the layers for the user.

If that filte works with smart objects, that'd be it, because there are the mask and the opacity already. If it won't work with smart objects, it needs to create the median-ed layer below and a mask.

Thanks!

TOPICS
SDK

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Mentor ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

This is a recipe for manually sharpening that was probably copied from a magazine and then I've touched it up some. The recipe in question is almost certainly from Professional Photoshop 5th Edition by Dan Margulis. I've corrected some obvious errors in the transcription, and might have introduced my own. You can substitute median for gaussian blur and might have some luck. Look for "USM with blur only" or "sharpen with blur" for more info.

Obviously the steps 8 and 16 could be replaced with any curves or levels adjustment.

1. Open the image that needs sharpening.

2. Make a duplicate copy of this image and call it "For Darkening".

3. Add two duplicate layers to the "For Darkening" image, save it and then save again as a file called "For Lightening".

4. Apply a Gaussian Blur of x pixels to the middle layer of "For Lightening".

5. Change the blend mode of the middle layer to Darken.

6. Change the blend mode of the top layer to Difference.

7. Flatten the image (Layer > Flatten Image).

8. Add two duplicate layers (press CTRL and J twice) and set the top two to screen.

9. Flatten the image and save it.

10. Return to the image called "For Darkening".

11. Apply a Gaussian Blur to the middle layer.

12. Set the blend mode of the middle layer to Lighten.

13. Change the blend mode of the top layer to Difference.

14. Flatten the image.

15. Invert the image (Filter > Adjustments > Invert).

16. Add two duplicate layers and set the blend mode of each to Multiply.

17. Flatten the image and then save. Copy the image to the clipboard (Select > All then Edit > Copy).

18. Paste the "For Darkening" image on top of the original copy of the image.

19. Set the blend mode to multiply.

20. Copy the "For Lightening" image to the clipboard and paste it on top of these two layers.

21. Set the layer blend mode to Screen.

22. If necessary, adjust the opacity of each layer.

23. Flatten the image and save.

Ed: found it here:

http://www.ledet.com/margulis/Makeready/MA69-Life_on_the_Edge.pdf

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 22, 2010 Jul 22, 2010

Copy link to clipboard

Copied

A high-pass filter is really the difference between the source image and a low-pass filter (like a Gaussian).

For example, if image A is the original and B is the low-pass (radius=W) of it, then B-A is the high pass data at every pixel.

If I then create a new image C where C(x,y) = A(x,y) + weight * [B(x,y)-A(x,y)], I've re-invented the high-pass filter.

It would be simple (but quite slow) to impliment the same thing with a median to generate B instead of a Gaussian.  Median filters are much, much slower than a nice, separable filter like a Gaussian.

There are other choices, too.  Basically anything that removes details (like a Despeckle!) could be used to generate image B.  You could use Surface Blur and get the high pass on the Bilateral filter.  Should do a great job of isolating edge/detail data.

I wouldn't use it on the Reduce Noise function, though.

Poor man's highpass:

1) duplicate your layer as "Image B"

2) process "Image B" with whatever you like: Gaussian Blur, Median, Surface Blur, etc.

3) invert "Image B"

4) change the opacity to something less than 50%. -- at 50% you isolate the material that was removed.

5) you might want to put an Adjustment Layer (like levels) on top of this, and I guarantee that your saturation is all screwed up.

Now you can see what the highpass on the function used to create "Image B" is like.  Large radii medians aren't nice for details.  Small ones are good, but Adobe's implementation is square, which also gives funky artifacts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 22, 2010 Jul 22, 2010

Copy link to clipboard

Copied

Oh, that's great!

I always knew the mix of an image and its negative would give a gray tone at some point, but never related that to the sharpening process!!

Thank you very much!

Now that you answered this question, I have a new one.

I think I'll try out Filter Monger or some of those accepting math, so how do i express the Median operation in the math?

I see in your math a "radius" but seems assumed it's a gaussian blur.

Anyway, your answer was very scientific!, thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 15, 2016 Oct 15, 2016

Copy link to clipboard

Copied

LATEST

Hello,

You can recreate High Pass using Photoshop as Following (Assuming Gray Scale Image):

  1. Duplicate layer and Apply Gaussin Blur with radius 'r'.
    Call the layer GB.
  2. Duplicate Original and put it on top.
    Use "Apply Image" on it.
    Select the GB Layer and set mode to "Subtract".
    Set Offset to 128.
    Apply and call the layer HP Manual.
  3. Duplicate Original on top,
    Apply High Pass Filter with radius 'r'.
    Set mode to "Difference" you'll see all black layer.

Namely, Photoshop's High Pass is: HP = 128 + (Original - GB).

Enjoy...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines