【发布时间】:2015-03-13 00:14:14
【问题描述】:
我在将 [R,theta] 格式的图像转换为 [x,y] 时遇到问题
我正在尝试使用 interp2。
[nZ,nX] = size(im);
theta = ((0:(nX-1)))*0.0071; %0.0071 is known angular separation of columns
rr = (0:(nZ-1))*0.0039; %0.0039 is resolution of rows
然后我会这样做:
%% Create grids and convert polar coordinates to rectangular
[THETA,RR] = meshgrid(theta,rr);
[XX,YY] = pol2cart(THETA,RR);
最后:
im_out=interp2(theta,rr,im,XX,YY,'linear');
im_out(isnan(im_out)) = 0;
但图片不正确!
这是输入图像(图 1)(带有 R,theta 几何):
我想在笛卡尔网格上重建它(使用 interp2),所以它看起来像这样(图 2):
Polar 图像(图 1)中的所有数据都应映射到笛卡尔图像的红色区域(图 2)。
【问题讨论】:
-
你能展示你想要的图片和你得到的那个吗?
-
这是输入图像(带有 R,theta 几何):dropbox.com/s/g5vllc0puftqm9k/input.png?dl=0 我想在笛卡尔网格上重建它(使用 interp2),所以它看起来像这样:dropbox.com/s/yvmprufb5zc3e1a/required_output.png?dl=0
-
你知道极坐标采样的中心在笛卡尔坐标的什么位置吗?显然不是左上角。
-
Polar 图像(图 1)中的所有数据应映射到笛卡尔图像的红色扇区(图 2)。使用 interp2 后,NAN 应设置为 0(即笛卡尔图像的蓝色区域(忽略红色区域的噪声))。 Polar 图像中的 (0,0) 应映射到笛卡尔图像中红色扇区的左上角。感谢您的帮助!
-
极坐标图像中的(0,0)映射到笛卡尔图像中的(274,50)。
标签: image matlab image-processing polar-coordinates