%直方图均衡化
f=imread('0602.tif');
subplot(3,2,1),imshow(f),title('原图')
f = rgb2gray(f);
subplot(3,2,2),imhist(f),title('原图的直方图')
ylim('auto')
g=histeq(f,256);
subplot(3,2,3),imshow(g),title('直方图均衡化后的图像')
subplot(3,2,4),imhist(g),title('图像均衡化后的直方图')
hnorm=imhist(f)./numel(f);%归一化直方图
cdf=cumsum(hnorm);%归一化直方图取值的累加
x=linspace(0,1,256);%生成线性空间的向量
subplot(3,2,5),plot(x,cdf)
axis([0 1 0 1])
set(gca,'xtick',0:.2:1)%x轴坐标间隔
set(gca,'ytick',0:.2:1)%y轴坐标间隔
xlabel('Input intensity values','fontsize',9)
ylabel('Output intensity values','fontsize',9)
text(0.18,0.5,'Transformation function','fontsize',9)
直方图均衡化
最新推荐文章于 2024-07-28 21:55:54 发布