11 Replies Latest reply: Mar 3, 2011 11:30 AM by jcr6 RSS

    Signal processing tools: spectrum analyzer, equalizer available?

    avpromedia Community Member

      Are there any plug-ins or scripts to perform spectrum analyzing (shows the distribution of frequencies), and an equalizer (multiple band pass filter)?

       

      Why is there a high-pass filter, but no low pass filter?

       

      (using cs4)

        • 1. Re: Signal processing tools: spectrum analyzer, equalizer available?
          Chris Cox Adobe Employee

          Any blur filter is a low pass filter.  But the compliment to HighPass would be Gaussian Blur.

           

          I think Reindeer Graphics has a decent set of FFT plugins.   http://reindeergraphics.com/

          • 2. Re: Signal processing tools: spectrum analyzer, equalizer available?
            Noel Carboni Community Member

            I have, for astronomy purposes, the need to make an image that removes detail and leaves a background illumination level.

             

            What I did was create an action that runs the High Pass filter then subtracts the result from the image to achieve the "low pass" effect.  I use this action repeatedly with different High Pass radii.

             

            Blur is kind of the same thing, but not quite because it tends to smear the background colors together and move them around.

             

            -Noel

            • 3. Re: Signal processing tools: spectrum analyzer, equalizer available?
              Chris Cox Adobe Employee

              Low Pass == Blur

              High Pass == 0.5 + original - blur

               

              Your version = original - (0.5 + original - blur) = blur - 0.5.

               

              (easy to verify in 32 bit mode, since it won't clip floating point values)

              • 4. Re: Signal processing tools: spectrum analyzer, equalizer available?
                Noel Carboni Community Member

                Math abstraction notwithstanding, the results are not the same.  For one thing I get problems with using blur around the edges of an image.

                 

                But even beyond the edge issues...

                 

                In the case of my example - preparing for a luminance flattening operation - the blur combines the data from all the background sky glow with that from the stars, and so the result contains pixel values derived from both.  A high pass operation then subtraction leaves me with the background sky glow alone and only eliminates the stars (light spots) and dead pixels (dark spots).  If I choose to combine so as to allow only darkening then I keep the dark spots and eliminate only the stars.

                 

                Am I missing something here?  Are you saying the sky glow somehow influences the result from the high pass filter operation as well, so that the resultant sky glow after subtraction is affected?

                 

                I guess what you're saying is that High Pass is based on blur under the covers then?

                 

                -Noel

                • 5. Re: Signal processing tools: spectrum analyzer, equalizer available?
                  Chris Cox Adobe Employee

                  Yes, HighPass is based on Gaussian Blur, using the math I gave.

                   

                  And I think the -0.5 is just pinning some of your values to black in 8 or 16 bit.

                  • 6. Re: Signal processing tools: spectrum analyzer, equalizer available?
                    Noel Carboni Community Member

                    I'll work up an example of the difference when I can.  No time left today.

                     

                    -Noel

                    • 7. Re: Signal processing tools: spectrum analyzer, equalizer available?
                      jcr6 Community Member

                      George DeWolfe and I wrote an Equalizer (you can download the script for it from GeorgeDeWolfe.com -- it's part of a package called "PercepTool 2", demo works for 30 days).

                       

                      Now, this uses Gaussians to separate frequencies giving a very slow rolloff, and the steps for the bands are rather coarse to keep the numbers of bands down to a dull roar -- the largest radius is > 2000.

                       

                      What Neol is trying to do is to get the background brightness, SANS STARS, and the Gaussian will include the power from the stars in the overall background.  The answer is to use a modified Minimum function (modified to prevent grabbing the darkest noise points) and using THAT to subtract.  One of the problems with Photoshop is that the ranking operations (Min, Max, Median) all have square neighborhoods, so a funky square artifact is generally left behind.

                       

                      If I were to take the Minimum to get a suitable background for subtraction with an astronomy image, I'd preprocess the image to remove dark-going noise, probably with a median (no median in 32-bit mode!!), and then take the minimum, and then apply a large-ish Gaussian blur to reduce the blocky appearance.  It might be necessary to apply a Maximum function after the Gaussian (of the same radius as the minimum) to prevent halos from appearing:

                       

                      1) duplicate the image

                      2) Median (small radius) or some other impulse noise reduction function (rolling ball, etc): YMMV

                      3) Minumim (Radius = K)

                      4) Gaussian Blur (Radius == 2K ?)  This reduces some of the obvious posterization you'd get from #3

                      5) Maximum (Radius = K) -- steps 3 and 5 together perform a morphological grayscale opening, but should leave the boundaries approximately the same

                      6) now you can invert this and/or subtract it from the original.

                       

                      (No invert in 32-bit mode, either, but there are ways if you're creative.)

                       

                      -Chris Russ

                      • 8. Re: Signal processing tools: spectrum analyzer, equalizer available?
                        jcr6 Community Member

                        Chris,

                         

                        I assume that the 32-bit High Pass in CS5 (there isn't one in CS4) is based upon 0.5 as a value, not 50% brightness...

                         

                        In CS4/32-bit mode I've been forced to use Channel Mixer to invert a Gaussian and then use the Normal blend mode to subtract it out.  (Doesn't work in grayscale.)

                        • 9. Re: Signal processing tools: spectrum analyzer, equalizer available?
                          Chris Cox Adobe Employee

                          (no median in 32-bit mode!!),

                          Do you have an efficient median calculation for 32 bit floating point numbers?  I don't, yet.

                           

                          Invert only makes sense when you have a unit range (0..1), and 32 bit is HDR:  so invert would only make sense on masks.

                          • 10. Re: Signal processing tools: spectrum analyzer, equalizer available?
                            Chris Cox Adobe Employee

                            I assume that the 32-bit High Pass in CS5 (there isn't one in CS4) is based upon 0.5 as a value, not 50% brightness...

                            Correct.  There are techniques using High Pass and blend modes that really needed the 0.5 "midpoint" value.

                            And highpass isn't a visual filter to start with, so 0.5 made the most sense.  (yes, I actually spent some time thinking about the right value to use)

                            • 11. Re: Signal processing tools: spectrum analyzer, equalizer available?
                              jcr6 Community Member

                              re: Median.  No, I don't have a very efficient floating point median function.  Ended up with a sort - popping values in and out of a maintained sorted list, basically sitting on a merge sort: The current (pruned) sorted list, the ones to remove, the sorted list to add.  But I also do it with a round neighborhood, not a square one because you get some ugly artifacts with the square one.  There is another method with a radix sort, but I'm not sure how that would work with floating point numbers.  Parallelism comes down to doing this on different rows in different threads.  And of course SIMD is not your friend for sorting.  I'm sure you could figure out a tile approach.  You know my opinion on image processing and tiles.

                               

                              re: Invert.  High pass filters, and even sharpening filters don't actually exist in nature.  It is a center-surround inhibition process (and therefore should be perceptual) because it takes place either in the retina or the very early vision centers in the visual cortex.  That said, I have found ways to use Channel Mixer for color inversion and some other tricks for grayscale inversion to perform high pass operations on other functions than a Gaussian.  But a high pass on a small round median is pretty nice.  For that matter, a high pass on a morphological grayscale opening or closing is pretty nice, too.  Since both Levels and High Pass have arbitrarily ended up with midpoint values, perhaps it is time to include Invert within photoshop/32-bit mode.