将图像坐标转换为圆坐标

时间:2019-08-28 02:10:21

标签: image matlab image-processing

因此,我正在尝试将图像坐标(即普通的正方形x,y坐标)转换为圆形坐标,如下所示。

enter image description here

为此,正方形图像的中心必须是原点,在圆坐标系中该原点为0。

在Matlab中,它们具有一个名为“ cart2pol”的函数,其中:

cart2pol(x,y)

但是,x,y参数是圆坐标,因此在使用cart2pol之前,如何将普通的方形坐标系统转换为圆坐标?

1 个答案:

答案 0 :(得分:0)

我认为您应该可以使用cart2pol(x,y),它会为某些笛卡尔输入xy(和{{ 1}}(用于圆柱)。

第一张图片中的坐标:zi。您第二张图片中的坐标:jtheta

rho

N = 400; % example: 400x400 pixels % shift origin into center % Matlab uses 1 to N indexing not 0 to N-1 xo = (N)/2; % center of image yo = (N)/2; % Define some sample points in the image (coords from top-left of image) % 0 deg, 90 deg, 180 deg, 270 deg i = [350 200 50 200]; j = [200 1 200 350]; % get polar coordinates from cartesian ones (theta in radians) % -(j-yo) due to opposite direction of j to mathematical positive direction of coord.system [theta, rho] = cart2pol(i-xo, -(j-yo)); rho = rho/(N/2); % scaling for unit circle 的范围为theta,因此,如果您需要-pi to pi0 to 2pi,则仍需要进行映射。

相关问题