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

1. Aug 5, 2008

### stabu

Hi,

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 ...

2. Aug 6, 2008

### mistermath

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?

3. Aug 6, 2008

### stabu

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 ...).

Cheers!

4. Aug 6, 2008

### stabu

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.