www.pudn.com > digitalimageprocessprograms.rar > fing.m
clc;
fid=fopen('d:/img/fing_128.img','r');
f=fread(fid,[128,128],'uchar');
subplot(2,1,1);
imshow(f,[0,255]);
q=zeros(1,256);
for x=1:128
for y=1:128
q(f(x,y)+1)=q(f(x,y)+1)+1;
end
end
s=q./(128*128);
X=0:255;
subplot(2,1,2);
bar(X,s');
figure;
t=zeros(1,256);
t(1)=s(1);
for i=2:256
t(i)=t(i-1)+s(i);
end
subplot(2,1,1);
bar(X,t');
t0=floor(255*t+0.5);
subplot(2,1,2);
bar(X,t0');
figure;
t1=zeros(1,256);
for i=1:256
t1(t0(i)+1)=s(i)+t1(t0(i)+1);
end
subplot(2,1,1);
bar(X,t1');
f1=zeros(128,128)
for x=1:128
for y=1:128
f1(x,y)=t0(f(x,y)+1);
end
end
subplot(2,1,2);
imshow(f1,[0,255]);