0
我使用下面的代码将极坐标图像转换为笛卡尔坐标系。如何将笛卡尔图像转换为极坐标图像
for ii=1:500;
for jj=1:500
phase(ii,jj)=((ii-250)^2/1000+(jj-250)^2/1000);
end
end
Cartesian=cos(phase);
[imrow,imcol]=size(Cartesian);
% choose the center of the image
rcent=250;
ccent=250;
rmax=sqrt((imrow-rcent)^2+(imcol-ccent)^2);
%prepare the gridspace in the transformed coordinate
[r,theta]=meshgrid(linspace(0,rmax,imrow),linspace(0,2*pi,imcol));
%corresponding locations in the original coordinate
x=r.*cos(theta)+ccent;
y=r.*sin(theta)+rcent;
%sample original fringe pattern using interpolation
Polar=interp2(Cartesian,x,y);
subplot(1,2,1); imagesc(Cartesian) ; axis square
subplot(1,2,2); imagesc(Polar) ; axis square
现在,我想笛卡尔转换成极。我非常感谢任何帮助。
问候,
J.库珀
您是否要求将Cartesian转换为Polar的公式?因为如果你知道它,将它转换为代码是最直接的事情。 – Sipty 2015-02-10 16:23:17
我不会跳到结论,并说这个matlab代码取自[这里](https://www.mathworks.com/matlabcentral/newsreader/view_thread/80793),但是你真的知道matlab吗? – dmg 2015-02-10 16:43:10
你甚至没有试过Google吗? http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations#To_polar_coordinates_from_Cartesian_coordinates – rayryeng 2015-02-10 17:24:26