huntermjy123 2015-04-20 13:38 采纳率: 0%
浏览 7655
已结题

极坐标到直角坐标转换 matlab

图片说明
图片说明
这是两幅心血管的超声图像,第一幅是我以下面一幅图像的图心做的极坐标变换,现在的问题是如何从极坐标图像编程还原回第二幅图呢,第一幅图大小192*360,第二幅384*384,小弟做毕设,求助各位大神
下面是我极坐标变换的程序
function pim = polartrans1(im, nrad, ntheta, cx, cy, linlog, shape)
[rows, cols] = size(im);
if strcmp(shape,'valid') % Find minimum radius value
rmax = min([cx-1, cols-cx, cy-1, rows-cy]);
end
deltatheta = 2*pi/ntheta;

if strcmp(linlog,'linear')
deltarad = rmax/(nrad-1);
[theta, radius] = meshgrid([0:ntheta-1]*deltatheta, [0:nrad-1]*deltarad); %半径是按0开始的
end
xi = radius.*cos(theta) + (rows+1)/2; % Locations in image to interpolate data
yi = -radius.*sin(theta) + (cols+1)/2; % y轴方向与矩阵方向相反

[x,y] = meshgrid([1:cols],[1:rows]);
pim = interp2(x, y, double(im), xi, yi,'linear',0);

  • 写回答

3条回答 默认 最新

  • threenewbee 2015-04-20 16:21
    关注
    评论

报告相同问题?