Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Question on the PSF, OTF and FFT. Thanks!

Subject: Question on the PSF, OTF and FFT. Thanks!

From: Antony

Date: 28 Jul, 2010 09:35:04

Message: 1 of 3

Hi, all. I check some websites and find that the Fourier Transform of a PSF is OTF. The FFT of PSF can be obtained by psf2otf, but I find that direct application of FFT to PSF will return a different value.

   For example, Assuming PSF is [1 2 4; 4 6 5; 2 8 1], we will have the following output from MATLAB:
------------------------
>> a=[1 2 4; 4 6 5; 2 8 1]
a =
     1 2 4
     4 6 5
     2 8 1

>> b=psf2otf(a)
b =
  33.0000 7.5000 - 2.5981i 7.5000 + 2.5981i
   6.0000 - 3.4641i 1.5000 - 6.0622i -4.5000 - 6.0622i
   6.0000 + 3.4641i -4.5000 + 6.0622i 1.5000 + 6.0622i

>> c=fft(a) % I use fft() directly to compare it with psf2otf
c =
   7.0000 16.0000 10.0000
  -2.0000 - 1.7321i -5.0000 + 1.7321i 1.0000 - 3.4641i
  -2.0000 + 1.7321i -5.0000 - 1.7321i 1.0000 + 3.4641i
------------------
As we see, b is not equal to c. So my questions are: 1) why they are not equal? and 1) how to make them equal?

Thanks a lot!

Antony

Subject: Question on the PSF, OTF and FFT. Thanks!

From: Wayne King

Date: 28 Jul, 2010 10:02:04

Message: 2 of 3

"Antony " <mutang.bing@gmail.com> wrote in message <i2otk8$mtd$1@fred.mathworks.com>...
> Hi, all. I check some websites and find that the Fourier Transform of a PSF is OTF. The FFT of PSF can be obtained by psf2otf, but I find that direct application of FFT to PSF will return a different value.
>
> For example, Assuming PSF is [1 2 4; 4 6 5; 2 8 1], we will have the following output from MATLAB:
> ------------------------
> >> a=[1 2 4; 4 6 5; 2 8 1]
> a =
> 1 2 4
> 4 6 5
> 2 8 1
>
> >> b=psf2otf(a)
> b =
> 33.0000 7.5000 - 2.5981i 7.5000 + 2.5981i
> 6.0000 - 3.4641i 1.5000 - 6.0622i -4.5000 - 6.0622i
> 6.0000 + 3.4641i -4.5000 + 6.0622i 1.5000 + 6.0622i
>
> >> c=fft(a) % I use fft() directly to compare it with psf2otf
> c =
> 7.0000 16.0000 10.0000
> -2.0000 - 1.7321i -5.0000 + 1.7321i 1.0000 - 3.4641i
> -2.0000 + 1.7321i -5.0000 - 1.7321i 1.0000 + 3.4641i
> ------------------
> As we see, b is not equal to c. So my questions are: 1) why they are not equal? and 1) how to make them equal?
>
> Thanks a lot!
>
> Antony

Hi Antony, You want to shift the center of the point-spread function until the center is at element (1,1) and then take the two-dimensional Fourier transform of that.

a = [1 2 4; 4 6 5; 2 8 1];
a1 = circshift(a,-floor(size(a)/2));
b = fft2(a1);
% compare b to otf
otf = psf2otf(a);

Hope that helps,
Wayne

Subject: Question on the PSF, OTF and FFT. Thanks!

From: Antony

Date: 29 Jul, 2010 03:04:04

Message: 3 of 3

"Wayne King" <wmkingty@gmail.com> wrote in message <i2ov6s$4pc$1@fred.mathworks.com>...
> "Antony " <mutang.bing@gmail.com> wrote in message <i2otk8$mtd$1@fred.mathworks.com>...
> > Hi, all. I check some websites and find that the Fourier Transform of a PSF is OTF. The FFT of PSF can be obtained by psf2otf, but I find that direct application of FFT to PSF will return a different value.
...

>
> Hi Antony, You want to shift the center of the point-spread function until the center is at element (1,1) and then take the two-dimensional Fourier transform of that.
>
> a = [1 2 4; 4 6 5; 2 8 1];
> a1 = circshift(a,-floor(size(a)/2));
> b = fft2(a1);
> % compare b to otf
> otf = psf2otf(a);
>
> Hope that helps,
> Wayne

Dear Wayne, thanks a lot for your kind help! I understand the principle to some degree now. The magnitue computed by psf2otf is the same as computed by fft2 but the phase is different, but the phases of them are different. The circshift method you points out may obtain the same phase.

  Thanks again!

Antony

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us