Matlab数字图像处理,绘制直方图,imhist函数的语法 | 您所在的位置:网站首页 › 绘制直方图时纵轴和横轴均需要从零开始画吗 › Matlab数字图像处理,绘制直方图,imhist函数的语法 |
imhist函数用于图像数据的直方图
语法
[counts,binLocations] = imhist(I) 计算灰度图像 I 的直方图。imhist 函数在 counts 中返回直方图计数,在 binLocations 中返回 bin 位置。直方图中 bin 的数量由图像类型确定。 [counts,binLocations] = imhist(I,n) 指定用于计算直方图的 bin 的数量 n。 [counts,binLocations] = imhist(X,cmap) 计算具有颜色图 cmap 的索引图像 X 的直方图。对于颜色图中的每个条目,直方图中都有一个对应的 bin。 imhist(___) 显示绘制的直方图。如果输入图像是索引图像,则直方图在颜色图 cmap 的颜色条上方显示像素值分布。 [counts,binLocations] = imhist(I) [counts,binLocations] = imhist(I,n) [counts,binLocations] = imhist(X,cmap) imhist(___) a = imread('QQ图片20230513144043.jpg'); h = rgb2gray(a);%将RGB图像转换为灰度图像 h1 = h(1:10:256); horz = 1:10:256; subplot(2,2,1) imhist(h) title('灰度图像h的直方图') subplot(2,2,2) bar(horz,h1,0.5) title('灰度图像h的柱状图') subplot(2,2,3) stem(horz,h1,'fill') title('灰度图像h的点图') subplot(2,2,4) plot(imhist(a)) title('灰度图像h的折线图')绘制的直方图,柱状图,点图,折线图,如下图所示:
看到这里的小伙伴别忘了点个赞再走哦! |
CopyRight 2018-2019 实验室设备网 版权所有 |