%%%%% 5-1-1-1 线性变换的matlab源程序:
X1=imread('E:\role0\001i.bmp');
figure,imshow(X1);
f0=0;g0=0;
f1=10;g1=10
f2=180;g2=1800;
f3=255;g3=255;
figure,plot([f0,f1,f2,f3],[g0,g1,g2,g3])
axis tight,xlabel('f'),ylabel('g')
title('intensitytransformation')
%绘制变换曲线
r1=(g1-g0)/(f1-f0);
b1=g0-r1*f0;
r2=(g2-g1)/(f2-f1);
b2=g1-r2*f1;
r3=(g3-g2)/(f3-f2);
b3=g2-r3*f2;
[m,n]=size(X1);
X2=double(X1);
for i=1:m
for j=1:n
f=X2(i,j);
g(i,j)=0;
if(f>=f1)&(f<=f2)
g(i,j)=r1*f+b2;
elseif(f>=f2)&(f<=f3)
g(i,j)=r3*f+b3;
end
end
end
figure, imshow(mat2gray(g))
ch5_1_1 线性变换的matlab源程序:.m
最新推荐文章于 2023-12-26 04:15:00 发布