0
$\begingroup$

I am quite confused whether the following numerical differences i find are just severe round off errors made by matlab, or something i am doing wrong. The following happened when trying to see what a low pass filter looks like in the spatial domain.

By mathematics, the inverse fourier transform of a real symmetric image ($I(x,y) = I(-x,-y)$, where $I$ gives the value of the image at the given pixel) should again be real-valued.

However, when starting out with a low pass filter I defined as a disc of ones centered around the origin, surrounded by zeroes, the matlab command ifft2(ifftshift(I)) gave an image with pretty nontrivial complex component.

When explicitly telling Matlab to utilize the symmetry, the command ifft2(ifftshift(I),'symmetric') did indeed give a matrix with only real entries. However, the numerical difference between the two commands was pretty big compared to what i expected: Letting $I$ be our symmetric image in the frequency domain, i entered the following commands:

J = ifft2( ifftshift(I) );

K = ifft2( ifftshift(I), 'symmetric' );

mean(mean(abs(real(J) - K)))

ans =

3.2851e-04

mean(mean(abs(K)))

ans =

7.4830e-04

as you see, the difference between the real part of J and K is not that big per se, but it is big compared to the mean values of K. So it is quite nontrivial.

Questions: 1. Why do these complex components show up in J? Are they really round off errors made by Matlab? 2. Where does this numerical difference come from when i use this 'symmetric' command? Again just round of errors? 3. In practice, when dealing with symmetric real matrices (or more generally conjugate symmetric matrices), is it advisable to use the 'symmetric' command?

Thanks a lot!

$\endgroup$
  • $\begingroup$ Why do you expect ifft2( ifftshift(I) ); to give anything sensible? You might be better off defining I the right way first... using fftshift on the image before inverting the FFT is fraught with peril. $\endgroup$ – Peter K. Mar 19 '14 at 16:01
  • $\begingroup$ @PeterK. thanks for the comment! I was under the complete assumption that this was the right thing to do. What would be the right way to define I? $\endgroup$ – Joachim Mar 19 '14 at 16:08
  • $\begingroup$ In any case ifftshift(I) should still be symmetric, so its inverse fourier transform should still be real, right? $\endgroup$ – Joachim Mar 19 '14 at 16:11
  • $\begingroup$ Is the xy dimension of I even or odd? $\endgroup$ – hotpaw2 Mar 19 '14 at 17:27
  • $\begingroup$ @hotpaw2, sorry i am not sure what the exact meaning of xy dimension is, but i believe i used a 100 by 100 pixel image. So even, i guess. $\endgroup$ – Joachim Mar 19 '14 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.