MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: 2-D Fourier Transform?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113770] Re: 2-D Fourier Transform?
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Thu, 11 Nov 2010 06:10:59 -0500 (EST)
  • References: <ibdvnp$8tk$1@smc.vnet.net>
  • Reply-to: nma at 12000.org

On 11/10/2010 3:30 AM, hadi motamedi wrote:
> Dear All
> Can you please let me know how can I obtain 2-D Fourier transform of a
> 2-D signal say an saved image ?
> Thank you
>


There might be a shorter way in the digital image
processing functions in version 7 as many new
ones where added.

But this is one way to do this. If you find
any errors pls let me know:

------ 2D spectrum of image ------------------------------
img=Import["ExampleData/lena.tif"];
ImageDimensions[img] (*look at image*)

ImageChannels[img]  (*see how many channels*)

data=ImageData[img];  (*get data*)
{nRow,nCol,nChannel}=Dimensions[data]

Map[Image[data[[All,All,#]]]&,Range[1,nChannel]](*look at each channel*)

d=data[[All,All,2]]; (*get channel 2*)
Image[d,ImageSize->400]

(*center Image first*)
indx=Flatten[Outer[List,Range[1,nRow],Range[1,nCol]],1];
Map[(d[[  #[[1]],#[[2]] ]]=(-1)^(#[[1]]+#[[2]])*d[[#[[1]],#[[2]] ]])&,indx];

(*make FFT and look at spectrum and phase*)
fw= Fourier[d,FourierParameters->{1,1}];

fudgeFactor=100; (*adjust for better viewing as needed*)

ArrayPlot[Abs@(fudgeFactor * Log[1+fw]),PlotLabel->"Magnitude spectrum",ImageSize->400]
ArrayPlot[Arg[fw],PlotLabel->"Phase spectrum",ImageSize->400]
-----------------------------------------

see my howto note #95
http://12000.org/my_notes/mma_matlab_control/KERNEL/e95/mma/index.htm

--Nasser


  • Prev by Date: Re: Numerical simulation
  • Next by Date: Re: 2-D Fourier Transform?
  • Previous by thread: Re: 2-D Fourier Transform?
  • Next by thread: Re: 2-D Fourier Transform?