在极坐标MATLAB中改变变换/映射的中心

时间:2016-01-28 20:07:53

标签: image matlab transformation coordinate

应用以下代码后,我得到从中心顶点开始的输出映射图像。如何将起点放在左下角?因此,输出图像应该从左下角(而不是现在的顶部中心)拉伸......

im = imread ('peppers.png');
im = rgb2gray(im);
[nZ,nX] = size(im); 
theta = ((0:(nX-1))-nX/2)*(0.1*(pi/180)) - pi/2;
rr = (0:(nZ-1))*0.1e-3;

%% Plot image in rectangular coordinates
figure
imagesc(theta*(180/pi), rr*1e3, im)
xlabel('theta [deg]')
ylabel('r [mm]')

%% Create grids and convert polar coordinates to rectangular
[THETA,RR] = meshgrid(theta,rr);
[XX,YY] = pol2cart(THETA,RR);

%% Plot as surface, viewed from above
figure
surf(XX*1e3,YY*1e3,im,'edgecolor','none')
view(0,90)
xlabel('x [mm]')
ylabel('y [mm]')

0 个答案:

没有答案