%%% 极坐标到平面坐标
clc;
clear all;
close all;
addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm');
I=imread('4.jpg');
I=double(I);
Image=I;
Info_Size=size(Image);
row=Info_Size(1);
col=Info_Size(2);
e=col/row;
R=row/2;
a=col/2;
b=row/2;
Image_new=Image;
Center_X=(col+1)/2;
Center_Y=(row+1)/2;
for i=1:row
for j=1:col
r1=i*R/row;
r2=r1*e;
theta=j*2*pi/col;
x1=r2*cos(theta);
y1=r1*sin(theta);
x=Center_X+x1;
y=Center_Y-y1;
% % % % x=floor(x)+1;
% % % % y=floor(y)+1;
if(x>1 && x<col && y<row && y>1)
x1=floor(x);
y1=floor(y);
p=x-x1;
q=y-y1;
Image_new(i,j,:)=(1-p)*(1-q)*Image(y1,x1,:)+p*(1-q)*Image(y1,x1+1,:)...
+q*(1-p)*Image(y1+1,x1,:)+p*q*Image(y1+1,x1+1,:);
end
end
end
figure, imshow(Image_new/255);
原图
效果图