⽤Matlab绘彩⾊图像的直⽅图直⽅图是常⽤的图表,⽤MATLAB实现如下:
Img=imread('football.jpg');
BW = Img;
R=BW(:,:,1);
[REDcounts,x] = imhist(R);
G=BW(:,:,2);
[Greencounts,y] = imhist(R);
B=BW(:,:,3);
[Bluecounts,z] = imhist(R);
figure;
subplot(131);imhist(R);title('histogram of Red');
subplot(132);imhist(G);title('histogram of Green');
subplot(133);imhist(B);title('histogram of Blue');
matlab直方图figure;
Histcounts=REDcounts+Greencounts+Bluecounts;
Histogramdata=Histcounts';
plot(Histogramdata);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。