Results 1 to 6 of 6

Thread: Spatial Filtering - Demystified (well, slightly...)

  1. #1
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,777
    Blog Entries
    4

    Post Spatial Filtering - Demystified (well, slightly...)

    Following a request from this thread
    A big section of my atlas is finished

    where I tried to fix up some issues with some terrain noise using a spatial filter, I have been asked to explain a bit more about the process. Its not an easy process to understand but I have uploaded my old help file and clipped some app specific bits out of it.

    It seems that Gimp at least has an FFT plugin which does exactly the same thing though the screen images might be slightly different, the principle is the same.

    Maybe RobA can do some screenies of the images posted from this next link using Gimp and we can see the same process being done.

    Spatial Imaging Help

  2. #2
      RobA is offline
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,532

    Post

    Well.....

    The FFT stuff in gimp seems a bit different. Principally, when you run an FFT on an image, it uses 50% grey as the 0 point.

    For example, your image:


    has a spectrum of this:


    Whereas the result of a FFT in gimp is this:
    Name:  gimp_spectrum.png
Views: 626
Size:  169.1 KB

    The same manipulation can be done, but to zero out a portion of the specrum, instead of black, I paint with 50% grey. (Actually, I create a layer that is 50% grey and use a layer masks). For the provided image, I did the same thing as you, decomposing the image to RGB, then masking each depending on the "hotspots", replacing those areas with 50% grey in each channel. Here is the result:
    Name:  rgb-compose.png
Views: 198
Size:  84.4 KB

    This seems a pain in the butt (all that manual painting) so I tried another experiment... After decomposing, I ran a sobel edge detection on each channel, applied a 10px gaussian blur, thresholded it, followed by a 5px gaussian blur, then normalized each channel. Blending down each of these masks and recompositing gave me:
    Name:  rgb-compose2.png
Views: 179
Size:  123.6 KB

    I think it is a pretty impressive results for something that I could automate...(hmmm)

    Also, for reference, here is the FFT the procedure resulted in:
    Name:  rgb-compose2_fft.png
Views: 190
Size:  156.2 KB

    I have been able to create gimp equivalents for the first 12 of the filters you show, but have not worked out the last three... how do you prevent image blowout?

    -Rob A>

  3. #3
      RobA is offline
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,532

    Post

    Quote Originally Posted by RobA View Post
    I have been able to create gimp equivalents for the first 12 of the filters you show, but have not worked out the last three... how do you prevent image blowout?
    Think I might have have it now... I am using a 50% layer set to divide mode (i.e. x 2) on to with a mask... Here are some results on a photo I took... do these make sense, Redrobes?

    Orig:
    Spatial Filtering - Demystified (well, slightly...)-test.jpg

    HF enhance:
    Spatial Filtering - Demystified (well, slightly...)-detail-enhance-1-hf.png

    HF and MF enhance:
    Spatial Filtering - Demystified (well, slightly...)-detail-enhance-2-hf-mf.png

    HF, MF, and some LF enhance:
    Spatial Filtering - Demystified (well, slightly...)-detail-enhance-3-hf-mf-lf.png

    -Rob A>

  4. #4
      Redrobes is offline
    Software Dev/Rep Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    4,777
    Blog Entries
    4

    Post

    Yeah I think thats doing the trick. One thing I wanted to try for a while and which you might want to expand or script up is a way of creating wave outlines for a coast using the effects of deliberate ringing. Some pics show what I mean but I haven't faffed about much to distill the idea down to something usable yet.

  5. #5
      RobA is offline
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,532

    Post

    That is pretty clever! Try reflecting the image x&y to make it symmetrical before applying the fft. That way when you reverse it it wont ring around the lower RH corner.

    Also, as an update, here is that second snippet from the other thread, processed (now that I think I have this figured out) using the edge detect/blur/mask method:
    Name:  scrubbed.png
Views: 163
Size:  71.9 KB

    Not too bad, still a bit of playing with parameters required, however.

    -Rob A>

  6. #6

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •