图像线性变换

I=imread('C:\Users\lcxu2\Desktop\ERDAS操作内容\遥感编程所用图像\编程实习1.bmp');

figure

imshow(I);

figure

imhist(I);

f0=0;g0=0;

f1=50;g1=40;

f2=80;g2=80;

f3=255;g3=255;

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(I);

X=double(I);

for i=1:m

for j=1:n

f=X(i,j);

g(i,j)=0;

if(f>=0)&(f<=f1)

g(i,j)=r1*f+b1;

else if(f>=f1)&(f<=f2)

g(i,j)=r2*f+b2;

g(i,j)=r3*f+b3;

end

end

end

end

J=mat2gray(g);

figure

imshow(J)

figure

imhist(J)

你可能感兴趣的:(图像)