小编hin*_*han的帖子

如何在Matlab中将图像从笛卡尔坐标变为极坐标?

我试图将图像的像素从xy坐标转换为极坐标,我有问题,因为我想自己编写函数.这是我到目前为止所做的代码:

function [ newImage ] = PolarCartRot
% read and show the image
image= imread('1.jpg');
%%imshow(image);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%change to polar coordinate
[x y z]= size(image);
r = sqrt(x*x+y*y);
theta = atan2(y,x);
for i =0:r
    for j= 0:theta
newpixel = [i; j];
newImage(newpixel(1), newpixel(2),:) = image(i,j,:);
    end
end
figure;
imshow (newImage);
Run Code Online (Sandbox Code Playgroud)

matlab image-processing polar-coordinates

2
推荐指数
1
解决办法
2万
查看次数