金牌会员
- 积分
- 1389
- 威望
- 677
- 贡献
- 392
- 兑换币
- 425
- 注册时间
- 2015-7-31
- 在线时间
- 160 小时
- 毕业学校
- 还没毕业
|
GRAY1=imread('2.png');
GRAY=rgb2gray(GRAY1);
X1=imresize(GRAY,[row col]);
X_Ori=int16(imresize(GRAY,[row col]));
CAV=255;
for i=1:row%y
for j=1:col%x
if X_Ori(i,j)<CAV;
CAV=X_Ori(i,j);
end
end
end
CAV=100+CAV;
for i=1:row%y
for j=1:col%x
if X_Ori(i,j)<CAV;
X_Ori(i,j)=0;
else X_Ori(i,j)=255;
end
end
end
a=2;b=3.5;c=-512;d=-0;e=0.09;f=-0;g=12.0;h=-277.18;
for i=1:row%y
for j=1:col%x
j2=(a*j+b*i+c)/(d*j+e*i+1);
i2=(f*j+g*i+h)/(d*j+e*i+1);
intj2=fix(j2);
if intj2<=0||intj2>col2
continue;
end
if intj2>col2
intj2=col2
end
inti2=fix(i2);
if inti2<=0||inti2>row2
continue;
end
if inti2>row2
inti2=row2;
end
X_Tran(inti2,intj2)=X_Bor(i,j);
end
end
subplot(2,2,1);
imshow(uint8(X_Ori));
subplot(2,2,2);
imshow(uint8(X_Tran));
核心算法
|
|