DSPRelated.com
Forums

what is the unit of the Matlab 2D FFT output matrix?

Started by kiki November 16, 2004
Hi all,



I just have a question about using Matlab's FFT2 to compute the 2D DFT of an 
image...



An image is input as MxN pixels, what should be the unit of the frequency 
domain, that's to say, what should be the unit of the 2D DFT matrix returned 
by the Matlab FFT2 command? What does each grid of those MxN output matrix 
represent?



If I attach some physical units to the input image, say, each input pixel is 
in fact the sampled value of a physical image at sampling rate 96 DPI(=96 
dot or samples per inch)...  In this case, what should each grid of those 
MxN DFT output matrix represent?



I guess the FFT2 output matrix has no meaning if the MxN input image matrix 
is not associated with a physical units...



Thanks a lot...






In each dimension, it is "cycles per aperture width"...

If an image of a scene represents M=4 meters by N=3 meters of area, then any
element (m,n) of the output FFT is m cycles per 4 meters by n cycles per 3
meters.


-- 
Armin Doerry
adoerry@yahoo.com
=========================
"kiki" <lunaliu3@yahoo.com> wrote in message
news:cndtbe$9hd$1@news.Stanford.EDU...
> Hi all, > > > > I just have a question about using Matlab's FFT2 to compute the 2D DFT of
an
> image... > > > > An image is input as MxN pixels, what should be the unit of the frequency > domain, that's to say, what should be the unit of the 2D DFT matrix
returned
> by the Matlab FFT2 command? What does each grid of those MxN output matrix > represent? > > > > If I attach some physical units to the input image, say, each input pixel
is
> in fact the sampled value of a physical image at sampling rate 96 DPI(=96 > dot or samples per inch)... In this case, what should each grid of those > MxN DFT output matrix represent? > > > > I guess the FFT2 output matrix has no meaning if the MxN input image
matrix
> is not associated with a physical units... > > > > Thanks a lot... > > > > > >
"kiki" <lunaliu3@yahoo.com> wrote in message news:<cndtbe$9hd$1@news.Stanford.EDU>...
> Hi all, > > > > I just have a question about using Matlab's FFT2 to compute the 2D DFT of an > image... > > > > An image is input as MxN pixels, what should be the unit of the frequency > domain, that's to say, what should be the unit of the 2D DFT matrix returned > by the Matlab FFT2 command? What does each grid of those MxN output matrix > represent?
inches per pixel (I think) - but the grid spacing is dependent on M and N
> > > If I attach some physical units to the input image, say, each input pixel is > in fact the sampled value of a physical image at sampling rate 96 DPI(=96 > dot or samples per inch)... In this case, what should each grid of those > MxN DFT output matrix represent? >
In one direction they are units of 1/(N*96) inches per pixel (I think) and in the other 1/(M*96) inches per pixel.
> > > I guess the FFT2 output matrix has no meaning if the MxN input image matrix > is not associated with a physical units... >
Too deep for me - if you do the inverse transform to get back into some space where you are confident of the meaning of your output I don't see that you need to worry.
> > > Thanks a lot...
Best of Luck - Mike
In message <cndtbe$9hd$1@news.Stanford.EDU>, kiki <lunaliu3@yahoo.com> 
writes

>I just have a question about using Matlab's FFT2 to compute the 2D DFT of an >image...
A positive real image or a complex one?
>An image is input as MxN pixels, what should be the unit of the frequency >domain, that's to say, what should be the unit of the 2D DFT matrix returned >by the Matlab FFT2 command? What does each grid of those MxN output matrix >represent?
If you feed in an M x N real image you should get back an N x M/2 (or N/2 x M) complex conjugate array of Fourier coefficients (note the swap of N & M). Matlab may do things differently though. There are other conventions that do not exploit the implicit conjugate symmetry of the FFT of a real function.
>If I attach some physical units to the input image, say, each input pixel is >in fact the sampled value of a physical image at sampling rate 96 DPI(=96 >dot or samples per inch)... In this case, what should each grid of those >MxN DFT output matrix represent?
Number of cycles across the original image width/height.
>I guess the FFT2 output matrix has no meaning if the MxN input image matrix >is not associated with a physical units...
It shows the intensity at each coordinate in the wave number or spatial frequency domain. Regards, -- Martin Brown
mpyarwood@hotmail.com (Mike Yarwood) wrote in message news:<bf2a46eb.0411170059.54366ee2@posting.google.com>...
> "kiki" <lunaliu3@yahoo.com> wrote in message news:<cndtbe$9hd$1@news.Stanford.EDU>... > > Hi all, > > > > > > > > I just have a question about using Matlab's FFT2 to compute the 2D DFT of an > > image... > > > > > > > > An image is input as MxN pixels, what should be the unit of the frequency > > domain, that's to say, what should be the unit of the 2D DFT matrix returned > > by the Matlab FFT2 command? What does each grid of those MxN output matrix > > represent? > inches per pixel (I think) - but the grid spacing is dependent on M > and N > > > > > > If I attach some physical units to the input image, say, each input pixel is > > in fact the sampled value of a physical image at sampling rate 96 DPI(=96 > > dot or samples per inch)... In this case, what should each grid of those > > MxN DFT output matrix represent? > > > In one direction they are units of 1/(N*96) inches per pixel (I > think) and in the other 1/(M*96) inches per pixel. > > > > > > I guess the FFT2 output matrix has no meaning if the MxN input image matrix > > is not associated with a physical units... > > > Too deep for me - if you do the inverse transform to get back into > some space where you are confident of the meaning of your output I > don't see that you need to worry. > > > > > > Thanks a lot... > > Best of Luck - Mike
Aaah! Inches per pixel - I must be going barmy. Take no notice of me kiki - Arman's quite right! You can see it more or less immediately by : ft=zeros(27,41); ft(2,40)=1;,ft(2,2)=-1;,ft(26,40)=1;,ft(40,40)=-1; plot3d(1:27,1:41,abs(ifft(ft))); playing around with the values at the corners lets you put in 1/2 cycles or DC levels and it's all very pretty. Best of luck - Mike