图像处理之直方图均衡MATLAB代码实现

MATLAB画灰度图像直方图的代码

I=imread('cameraman.tif');
[M N]=size(I);%求出图片大小
y=zeros(1,256)
x=0:255;
for t=0:255
    for i=1:M
        for j=1:N
            if I(i,j)==t
                y(1,t+1)=y(1,t+1)+1;
            end
        end
    end
end
%画图
plot(x,y)

猜你喜欢

转载自blog.csdn.net/qq_24163555/article/details/83833210