Results 1 to 6 of 6

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

  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,193
    Blog Entries
    8

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

    Following a request from this thread
    http://www.cartographersguild.com/showthread.php?t=2473

    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

    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: 699
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: 325
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: 309
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: 622
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

    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:
    Click image for larger version. 

Name:	test.jpg 
Views:	85 
Size:	272.9 KB 
ID:	5266

    HF enhance:
    Click image for larger version. 

Name:	detail enhance 1 HF.png 
Views:	107 
Size:	1.77 MB 
ID:	5267

    HF and MF enhance:
    Click image for larger version. 

Name:	detail enhance 2 HF and MF.png 
Views:	102 
Size:	1.77 MB 
ID:	5268

    HF, MF, and some LF enhance:
    Click image for larger version. 

Name:	detail enhance 3 HF MF and LF.png 
Views:	133 
Size:	1.67 MB 
ID:	5269

    -Rob A>

  4. #4
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,193
    Blog Entries
    8

    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

    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: 281
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
  •