1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: 2D image Fourier Transform Filter: Even & Odd.

  1. Aug 5, 2008 #1

    Just when I thought I'd grasped the Discrete Fourier Transform properly,something comes along and messes me up ... and my books don't seem to treat it.

    Say you have a square 2D image and you want to do an Ideal LowPass Filter. Well, in general, filters need to be odd-number-sized so that there is a clear center.

    With a center shifted Fourier Transform, as long as the image has odd-numbered columns and rows, the center point is the DC component. That's fine if the image (and its Fourier Transform - always same number-size as image) are odd-number-sized. So you can apply a filter by multiplying each component of the image's FT.

    But if the image is even-number-sized, what then? It implies you must multiply by an even-number-sized filter. In any case, your center is in fact N/2+1, when N is the dimension of your square image ... so your "center" is in fact, not in the center.

    This has me in a fuddle. Sorry if I don't explain myself properly ... you'll need to have run into this problem yourself to fully gasp it.

    Having said that, in general terms even-number-sized object do have center-identification problem ...

    Thanks in advance for suggestions and advice ...
  2. jcsd
  3. Aug 6, 2008 #2
    I don't understand most of what you said, but why can't you just add a black or white vertical and horizontal line (as needed) to the very end of your image to make it odd pixel in length?
  4. Aug 6, 2008 #3
    hi Mistermath,

    yes, I was quite circumspect, sorry. However, your suggestion is to the point, so thanks for trying to understand.

    It's doable, but it's a hack. It introduces corruption - however small, which I want to avoid. However, I'm not above trying it!

    Many thanks! Any more suggestions welcome, though it appears I have to clarify (however, I suppose I was looking for people who have done mage processing before ...).

  5. Aug 6, 2008 #4
    OK.. I seem to have made some progress ... on the question only.

    It remains to be seen if on the answer also.. but it could be.

    When I talked about filters needing to be odd-numbered (1x1,3x3,5x5,etc), well that's a spatial filter requirement. And spatial filtering is a different story.

    Filtering in the frequency domain is easier as it just means multiplying each element of your matrix by your filter matrix. Even or oddsized images, the operation doesn't change: simple element by element multiplication.

    What my question should have addressed is how the inverse FT- center-de-shifting (sorry if this is obscure - it's for image processors only) of the image occurs when even of odd. For even images, you simply apply fftshift again (matlab-speak). But for oddsized images, you cannot do this. Read matlab's help ref. iffshift function.

    It really came out and bit me, this one. It's seems hard to explain. Apologies to quizzical readers.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook