From: Antony on 28 Jul 2010 05:35 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
From: Wayne King on 28 Jul 2010 06:02 "Antony " <mutang.bing(a)gmail.com> wrote in message <i2otk8$mtd$1(a)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
From: Antony on 28 Jul 2010 23:04 "Wayne King" <wmkingty(a)gmail.com> wrote in message <i2ov6s$4pc$1(a)fred.mathworks.com>... > "Antony " <mutang.bing(a)gmail.com> wrote in message <i2otk8$mtd$1(a)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
|
Pages: 1 Prev: how to hide figures with getframe Next: Focusing on figure interface |