Fourier Transform of 2d

2 次查看(过去 30 天)
Melissa
Melissa 2011-7-13
Good Morning All,
I am trying to find the coefficients of the fourier transform of a closed 2d shape (namely a small distorted circle). I have been given the coordinates of the shape so in essence the boundary and want to apply the centroid distance shape descriptor. Namely that
s(k)=[(x(t)-xc)^2+(y(t)-yc)^2]^1/2
and the coefficients for the transform is: c(u)=1/N sum(s(k)exp(-2uk*pi/N)) for discrete
Now in order to get x(t) and y(t) I would plot the points and then use interpft. How would I apply this in the matlab FFT2 function? Also if I made any mistakes in my thought process please advise me.
One more thing: should I convert the cartesian points to polar coordinates before applying any of this or leave them.
here is sample data of what I am trying to do but I am receiving error and want to use x(t) not just xt.
X=[100.0000 167.3203 359.0253 410.6382 585.7535 716.6290 712.9424 476.9977 364.5553 185.7535 100.9608 86.2143];
Y=[150.0000 59.9470 107.8733 242.4355 100.5000 235.0622 441.5138 423.0806 529.9931 533.6797 364.0945 170.5461];
t = 10;
Xt = interpft(X,numel(X)*t); %I think this uses fourier basis Yt = interpft(Y,numel(Y)*t);
xc=(1/12)*sum(Xt); yc=(1/12)*sum(Yt);%centroid center but I want X(t)
st=[(Xt-xc)^2+(Yt-yc)^2]^1/2 %centroid distance formula but again I need X(t)
ft=fft2(st) %should give the coefficients?
  1 个评论
Andrew Newell
Andrew Newell 2011-7-17
Please see http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question for how to format your question.

请先登录,再进行评论。

采纳的回答

Andrew Newell
Andrew Newell 2011-7-17
Unless there is an essential property of the centroid distance shape descriptor that you haven't mentioned, you could approach this in a much simpler way. First, center this shape about the centroid:
xc = sum(X)/numel(X);
yc = sum(Y)/numel(Y);
X = X-xc; Y = Y-yc;
Now, if you convert to polar coordinates, your t can be identified with the polar angle and your s with the radius ...
t = atan2(Y,X);
s = X.^2 + Y.^2;
To apply interpft to this, you'd need to first use interp1 to resample s at regularly spaced phi.

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by