Announcement

Collapse
No announcement yet.

Frequency separation math

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Frequency separation math

    Hello to everyone, I'm new to this forum. I use freq. separation for a while now, and I've done quite a lot of research on the subject, but I could not find one article that thoroughly explains (for non-math buffs) how FS works. I would like to understand why it happens as it does, but I'm quite stupid for mathematics... I've read many forum posts with dropped bits of info here and there, but I can't seem to get the big picture: why do I use subtract in 8 bit and add in 16? What are the offset and scale settings? Normal waves have negative values, and I have to scale this to only positive ones (waves in images have no negative values - nothing can be darker than black), so I suppose I do just that, but I would like to know how exactly the separation and the apply image works. I've read somewhere that an 8-bit image has no exact 50% (that's ok), but the 16 bit have - how? 65,536 is an even number, as 256, so it can't have an EXACT midpoint, it just approximates better. Am I right?

    Can anyone shed some light on this for me, please? It would be a great help. I can use the method without knowing any math, but somehow I just want to understand it deeper, now I feel like having someone elses clothes on, I just use it, but it isn't mine... Thank you very much for your help.

    BTW, could anyone link an action that can separate an image into any number of splits? I remember seeing one somewhere, but I just lost track of it and couldn't find it later. Thank you.

  • #2
    Re: Frequency separation math

    It has to do with the fact that it isn't separating anythng, just making multiple copies of the same thing and applying different calculations to them. In all honesty, I have no ideas what those numbers mean within the apply image? Klev?

    But what "separation" does is:

    You make two duplicates of the inital layer, one is hte blur, and one is the inverted blur.

    Holly ****? Inverted blur?

    Well, yes, if you were to invert the blurred layer and set it to 50% opacity (hence the 2 number in the scale of the apply image, as the 1 would make it it's original luminosity, and we want 50% aka split by 2 I guess), you would get the top layer or the "high".

    So, inverted blur set to 50 percent gives you the high pass. This works by the following principle: Inversion makes the inverted picture- complete opposite. 50% of a complete opposite is a neutral-neutral gray. We want to offset that by blur. So, blur it. But, as it is inverted, it reveals the opposite of the blur.

    Making a stamp of it and blending to linear light will give you sharpening effect. And this goes for every other modification, median... and all other blurs.

    Now, as for the low layer, it's a simple blur.

    But what if we want a multiple frequencies?

    It is possible, and very annoying to work with. Just repeat the process on the top, or the bottom layer. So, another blur and another sharpen. Notice, by every additional blur, you're gaining one layer, not two, as the blur is always on one of the already existing layers, and the opposite of the blur just adds on top of the stack, or in the middle. Only rule is that the layer set to NORMAL is on the bottom of the pile.
    Last edited by skoobey; 09-14-2014, 05:58 PM.

    Comment


    • #3
      Re: Frequency separation math

      Okay, thank you for the answer.
      I knew the inverted blur, I saw it in one of Calvin Hollywoods tuts, he called it (or something very similar) haut abpudern (~face powdering).
      I'll try the multisplit method you wrote about.

      Still I would like to know more about the math. I would be grateful is someone could explain it to me.

      Comment


      • #4
        Re: Frequency separation math

        You might find your answer here: http://www.modelmayhem.com/po.php?thread_id=439098

        That's a forum thread that has been running for over 5 years and has thousands of posts. I believe the OP is the inventor of frequency separation.

        Comment


        • #5
          Re: Frequency separation math

          OK Rob, I will try to help you out. before I explain the FS with the Apply Image command, let me give you a little background on separation and two filters in PS.
          The Gaussian Blur filter locates the edges in an image and it reduces the contrast along the edge by mixing the two colors on both sides of the edge. The effect is a blurred edge for a certain number of pixels on each side of the edge and the blurring / reduced contrast is not linear, nor is the algorithm that generates the pixel values.
          A Filter>Other>High Pass in PS has the opposite effect. The colors along an edge are increased in contrast / intensified and the effect is one of sharpening.
          There is a special relationship between the two filters. Original = GB + HP. If you mathematically add together a Gauusian Blur and a High Pass, made at the same radius R, you will restore the original. You can try this in PS by taking any image, duplicate the background two times, apply a GB to the 1st copy, apply an HP filter to the top copy, change the blend mode of the top copy to Linear Light and reduce the opacity of that top layer to 50%. Form a new layer group of the GB and HP layer and toggle it on and off and the two views should look identical or almost identical to you. The reason you used Linear Light blend mode and 50% opacity is because PS does not have a stand alone blend mode called Add. However, the math is such that Linear Light at 50% opacity exactly performs the Add function mathematically. The GB and HP filters were pretty well how FS was accomplished for many years. So why do see everyone using the Apply Image command?
          The reason is that the High Pass filter in PS is not very accurate. The HP error can be 2760/32,767. Where you will notice a difference visually is in the bright highlights (whites of eyes) or dark shadows with will be flatter looking.
          The Apply Image command reduces the error in an 8 bit image to 115/32767 and in a 16 bit image to 1/32767, and visually you can not tell the difference when you toggle between the Split group and the original.
          Using the Apply Image command, you are generating the HP layer by rearranging the formula above to HP = Orig - GB. The Apply Image command uses the 2nd copy of the bg as the Orig, it uses the 1st copy with the GB as the GB. Te mode used for an 8 bit image is Subtract. The offset is a short cut convenience. The 2 means the resulting HP is divided by 2. This saves you from having to change the opacity of the HF layer to 50%. Instead you leave it at 100% because the Apply Image reduced it for you.
          Why do you use Add and 0 offset for 16 bit? Because 8 bit arithmetic is unsigned where as 16 bit is signed (a sign bit and 15 digits). You don't use a scale because it's already scaled by 1/2.
          There is an action that will perform the split on both 8 and 16 bit images allowing you to input whatever R you like. I am away from my main Desktop PC but will post a link later tonight.
          Cheers, Murray

          Comment


          • #6
            Re: Frequency separation math

            Originally posted by skoobey View Post
            It has to do with the fact that it isn't separating anythng, just making multiple copies of the same thing and applying different calculations to them. In all honesty, I have no ideas what those numbers mean within the apply image? Klev?
            MisterMonday already explained it. My explanation would have been in the form of a factorization. One of them applies a gaussian blur subtracted or added or whatever. You essentially end up with an additive inverse function to that transform. I've been reading up on gaussian blur and its associated algorithm. I know what it does, but I haven't bothered to read up as much on its derivation prior to this. Wiki had a decent reference link on the topic. Apart from that I don't really like the way photoshop applies it. If the adjustment was applied on a gamma 1.0 space, you would have some amount of color mixing along blurred edges rather than that dark reverse ringing crap. Take a look if you don't mind ruining it for yourself. It's one of those things that you can never un-see.

            As for splitting an image into multiple frequency ranges, you could start with one, then replace either the high or low with a split of that. I know there are several variations of iterative methods that do just that. It's mostly used for edge finding or sharpening though. A big issue with edge finding is the cleanup of noise and a lack of ringing, which appears when an algorithm over-corrects and inverts values along an edge.

            Lastly to answer one question from the last thread on this, the reason you have trouble painting on a low pass layer is that you can steepen the difference between pixels. I was tempted to call it a gradient, but I'm not sure the term applies well here.

            Comment


            • #7
              Re: Frequency separation math

              Thanks Murray a bunch! Really great and yet very simple to understand walk through.

              Comment


              • #8
                Re: Frequency separation math

                Originally posted by mistermonday View Post
                Why do you use Add and 0 offset for 16 bit? Because 8 bit arithmetic is unsigned where as 16 bit is signed (a sign bit and 15 digits). You don't use a scale because it's already scaled by 1/2.
                There is an action that will perform the split on both 8 and 16 bit images allowing you to input whatever R you like. I am away from my main Desktop PC but will post a link later tonight.
                Cheers, Murray
                I forgot to ask earlier, where did you find this information regarding photoshop's method of encoding? I ask because 16 bits can be signed or unsigned. They could define it however they like. Anyway assuming a sign bit, they presumably use a 2's complement encoding. That would give you a range of -(2^15) to (2^15)-1. They must reserve a bit somewhere for some other purpose if it is as you claim. I've seen others state that numbers around 32000 values as well, but I can't seem to verify them.

                Comment


                • #9
                  Re: Frequency separation math

                  Thank you very much for the explanation. I get almost all, only a few bits still remain in shadow. Please bear with me, I'm not a math user
                  Really...

                  Originally posted by mistermonday View Post
                  ...
                  The reason is that the High Pass filter in PS is not very accurate. The HP error can be 2760/32,767. Where you will notice a difference visually is in the bright highlights (whites of eyes) or dark shadows with will be flatter looking.
                  Can you tell me, how to obtain, measure the error level (2760/32,767) calculating or measuring the result? Same question for the 8bit error level (115/32767). Somewhere in a forum I've read 1/256. How you can obtain those results?

                  Originally posted by mistermonday View Post
                  ...
                  Why do you use Add and 0 offset for 16 bit? Because 8 bit arithmetic is unsigned where as 16 bit is signed (a sign bit and 15 digits). You don't use a scale because it's already scaled by 1/2.
                  That is where you lost me. Is there any hope getting this without a BA in mathemathics?

                  Thank you for the action in advance.

                  Thank you and for the others for your comments.

                  Comment


                  • #10
                    Re: Frequency separation math

                    Originally posted by nemrob View Post
                    Thank you very much for the explanation. I get almost all, only a few bits still remain in shadow. Please bear with me, I'm not a math user
                    Really...



                    Can you tell me, how to obtain, measure the error level (2760/32,767) calculating or measuring the result? Same question for the 8bit error level (115/32767). Somewhere in a forum I've read 1/256. How you can obtain those results?



                    That is where you lost me. Is there any hope getting this without a BA in mathemathics?

                    Thank you for the action in advance.

                    Thank you and for the others for your comments.
                    Rob, 115/32767 is the same as 1.23/256. You can get into minutia of the math but you don't need to waste your time to appreciate the approx error and the fact that everything Photoshop does has an underlying set of math algorithms and calculations going on.
                    As for the difference between the 8 and 16 bit splits, sorry I was not very clear. In 8 bit, you use subtract mode. The offset is 128 which means that the baseline is set to 128 which is gray and the results of the subtractions are added or subtracted (offset) from the gray point. You need to remember that in a High Pass filter, the edge colors are contrast-enhanced and everything else on the layer is set to the 50% gray point (128/256).
                    For the 16 bit image, you use the Add mode but you check the Invert box. This is the same as saying A + (-B) which is the same a subtracting. You still use a scale of 2 to divide the result by 2 which saves you the trouble of reducing the opacity of the HP layer to 50%. The offset is 0 because the 16 bit division is signed. The sign bit (1) + 15 bits (32767) Think of the base 0 being the mid point between -32767 and +32767 which in 8 bit is the 128 point.
                    Here is a link to an FS action I referenced above. You just need to start with a single layer, then start the action. It will duplicate the layers for you. A dialog box will appear allowing you to select the Radius of the blur and see the preview. Once you click ok the action will complete the separation and put place the result in a Layer Group.

                    http://www.mediafire.com/download/wn...nd_16_bit_.atn

                    Cheers, Murray
                    Last edited by mistermonday; 09-16-2014, 09:10 AM.

                    Comment


                    • #11
                      Re: Frequency separation math

                      Thank you, Murray! Step by step I'm getting closer understanding it. Now I get the 8bit offset.
                      For the 16 bit, if Add inverted is Subtract, why not using it in the first place?
                      I have to chew on the signed bits, but I'm progressing

                      Thank you for the action.

                      Comment


                      • #12
                        Re: Frequency separation math

                        Originally posted by mistermonday View Post
                        Rob, 115/32767 is the same as 1.23/256. You can get into minutia of the math but you don't need to waste your time to appreciate the approx error and the fact that everything Photoshop does has an underlying set of math algorithms and calculations going on.
                        That is true, and it's another cause of some amount of grief when you guys use this strategy.

                        Note haloing/ringing. You can see it best along the blue edge.
                        Attached Files

                        Comment


                        • #13
                          Re: Frequency separation math

                          Murray & Klev: Do you guys study this stuff? what you do? Just curious.

                          Comment


                          • #14
                            Re: Frequency separation math

                            Originally posted by Aladdin View Post
                            Murray & Klev: Do you guys study this stuff? what you do? Just curious.
                            Magic 8 ball says "yes", at least in my case. It's a combination of books and research papers. If you're interested in a specific area, I can probably suggest some preliminary reading. Photoshop will allow you to implement custom filtering, but if you wish to run formal tests, I suggest something like Octave.

                            Comment


                            • #15
                              Re: Frequency separation math

                              Hi guys, forget about the numbers. I will show you a trick to get FS layers easier - with no need to remember the Apply image settings...

                              1. make a stamp (Ctrl + Shift + Alt + E), name it Low Freqency
                              2. Invert the Low Frequency layer (Ctrl +I) and set opacity to 50%. What you see now is mid grey.
                              3. Go to filters - gaussian blur, check the Preview and select radius you need. You can actually see the High Frequency now.
                              4. Make a stamp, name it High Frequency and change blending to Linear light
                              5. Select Low Frequency layer, invert it back and set opacity to 100%

                              Done, you can start retouching.

                              Optionally, to see the skin texture better in step 3, make a temporary Curves layer with settings like: black point Input - 100, white point Input - 155. (Make this layer after step 2, delete it after step 3 ...)

                              This technique works both with 8 and 16 bit files.

                              Enjoy

                              p.s.: i am planning to make some actions/scripts for frequency separation, subscribe to the newsletter at photoshopchef.com and i will give you know ...

                              Comment

                              Related Topics

                              Collapse

                              • P_fuzz
                                this frequency separation you all speak of...
                                by P_fuzz
                                show me the way to it

                                j/k, I was wondering if there is an ultimate tutorial on this tech, so far I only found some really poor elaborated ones on youtube.

                                thanks
                                06-16-2011, 06:45 AM
                              • fraiseap
                                Extended frequency separation
                                by fraiseap
                                I have been playing around with frequency separation using a couple of methods;

                                1. Using surface blur to create a low frequency layer and using high pass to create a high frequncy layer and blending the two with linear light

                                2. Using the Model Mayhem technique of creating...
                                12-30-2010, 08:42 AM
                              • keliot
                                Frequency Separation without the Contrast Group
                                by keliot
                                Hello.

                                Is there a way to do Frequency Separation without utilizing the Contrast Blend Modes Group?

                                Due to the nature of editing I am doing using standard Frequency Separation techniques leads to unpleasant ghosting/ringing/halo type artifacts that build up with every step....
                                10-04-2016, 10:15 AM
                              • Der_W
                                Benefits of frequency separation?
                                by Der_W
                                In another thread RetouchPRO Member kav said, he could do everything that FS enables you to do in a more simple manner and with a smaller file size.

                                Since this forum is all about learning from each other, I thought why not give this a try and see how different methods compare and also try...
                                12-25-2011, 03:40 AM
                              • 8BPixelLab
                                Halo on Frequency Separation for Cutout Images
                                by 8BPixelLab
                                Hey all,

                                Newbie here, but a fairly experienced journeyman in retouching. However, this problem is new to me, and has proved perplexing thus far. I was doing a frequency separation on a portrait, but unlike previous images, I had cut this image of the girl out of her background, so she...
                                08-08-2016, 07:01 PM
                              Working...
                              X