MATLAB中 histogram 和 imhist 的区别
matlab有两个生成直方图的库函数,分别是imhist和histogram,二者有何区别呢?
区别就是:
- imhist
- 官方help:imhist(I) calculates the histogram for the intensity image I and displays a plot of the histogram. The number of bins in the histogram is determined by the image type.
- 可见,imhist的NumBins值是由图像类型决定的。若图像为uint8类型,则bin的数量为256,即[0:1:255]。
histogram(早期版本为hist,现在matlab已不建议使用hist了)
- 官方help:
histogram(X) creates a histogram plot of X. The histogram function uses an automatic binning algorithm that returns bins with a uniform width, chosen to cover the range of elements in X and reveal the underlying shape of the distribution. histogram displays the bins as rectangles such that the height of each rectangle indicates the number of elements in the bin.
nbins — Number of bins
Number of bins, specified as a positive integer. If you do not specify nbins, then histogram automatically calculates how many bins to use based on the values in X.- 可见,histogram的NumBins值可以人为设定,在未指定该参数时,系统将基于图像的灰度分布自动计算NumBins的值。
- 官方help:
例程:
1 imgColor = imread('lena.jpg'); 2 imgGray = rgb2gray(imgColor); 3 4 %% imhist 5 figure('name', 'imhist'), 6 imhist(imgGray); 7 8 %% histogram 9 figure('name', 'histogram auto'), 10 % histogram函数自动计算NumBins值 11 hist2 = histogram(imgGray); 12 % Find the bin counts 13 binCounts = hist2.Values; 14 % Get bin number 15 binNum = hist2.NumBins; 16 17 %% histogram 指定NumBins值 18 % Specify number of histogram bins 19 figure('name', 'histogram256'), 20 hist256 = histogram(imgGray, 256); % 等同于 imhist(imgGray)
由运行结果也可看出,histogram(imgGray, 256)与imhist(imgGray),二者在最大bin的灰度累计值是一样的。
reference
- http://www.ilovematlab.cn/thread-13665-1-1.html
转载于:https://www.cnblogs.com/gxcdream/p/7710729.html
MATLAB中 histogram 和 imhist 的区别相关推荐
- matlab括号区别,matlab中各种括号(),[],与{}的区别与认识
matlab中各种括号(),[],与{}的区别与认识 发布时间:2018-06-04 10:37, 浏览次数:469 , 标签: matlab 原文 在matlab中,常常会遇到(),[],和{},这 ...
- Matlab中mesh和surf的区别
Matlab中mesh和surf的区别 Matlab中surf()和mesh()的区别: [X,Y] = meshgrid(-2:.2:2, -4:.4:4); Z = X .* exp(-X.^2 ...
- MATLAB中矩阵与数组的区别,点运算符的运用
转自http://blog.csdn.net/peterkang202/article/details/26623219 正如matlab(矩阵实验室)这个名字一样,matlab的数据结构只有矩阵(a ...
- MATLAB中./和/ .*和* 有什么区别
原文 matlab中./与/有什么区别 点运算是处理元素之间的运算 直接/在矩阵计算中只能处理符合矩阵运算法则的运算 矩阵计算和作图都是点运算 在对数值计算时,"./"和" ...
- matlab中各种括号(),[],与{}的区别与认识
原文 在matlab中,常常会遇到(),[],和{},这个3种符号怎么区分,怎么用,这里我来总结一下,以供参考. [] 首先.[]叫中括号,它用来存储矩阵和向量(vector在C++中也叫容器) 举 ...
- MATLAB中randint与randi的区别
randint在后期版本中会被randi代替,并且两者格式不同. 例如:M = randint(A,B,[C D]) 但在randi中的表示为:M = randi([C D],A,B) randint ...
- OpenCV中图像Mat存储格式和MATLAB中图像Mat存储格式的区别
首先,看一下图像中的宽高与笛卡尔坐标系之间的关系如下图所示,即x与width(cols)对应,y与height(rows)对应,x是按列来进行变化,y按行变化. OpenCV读入图像以Mat形式存储时 ...
- matlab中feval与eval的区别
feval 和eval 运行区别之一:feval的FN绝对不能是表达式.feval 的FN只接受 函数名.函数eval给MATLAB提供宏的能力.其中,该函数提供了将用户创建 的函数名传给其它函数能力 ...
- matlab中svd和eig的区别
svd和eig的区别 1.eig-特征值分解 1.1回顾特征值 Ax=λxAx = \lambda xAx=λx 注: ∑\sum∑ 为特征值组成的对角阵 WWW为特征向量组成的矩阵 则有: AW=W ...
- 讨论Matlab中double,im2double,mat2gray函数区别
图像类和类型间的转换 im2uint8 将输入中所有小于0的设置为0,而将输入中所有大于1的设置为255 其他的所有乘以255 im2uint16 将输入中所有小于0的设置为0,而将输入中所有大于 ...
最新文章
- Windows 命令行终端 PowerShell 美化计划
- babymips(上) 寒假逆向生涯(14/100)
- slam特征点深度 svd_SLAM初探:关于视觉SLAM的一些常识
- phpcms 指定id范围 调用_phpcms v9使用GET调用指定id文章内容、页面数据方法
- 220v正反转电机接线法_电压为220/380V电动机如何接线,380V电机如何转接成220V详解...
- linux刚重启就报资源不可用,linux系统重启网络配置
- 流浪宠物救助网站前端页面_全国爱心人士齐聚鞍山 救助流浪猫狗
- js求渐升数的第100位
- java openresty 调用_玩转 OpenResty 协程 API
- Create umbraco website-On the road of umbraco (1)
- SACC2018:教您如何实现大数据分析与精准推荐
- linux网络适配器驱动程序怎么安装,如何安装网卡驱动_如何重新安装网卡驱动
- 2020高压电工模拟考试及高压电工模拟考试系统
- 水滴IP告诉你:IP是什么?动态IP和静态IP有什么区别?
- Vue-cli的安装与基本操作
- opencv十字瞄准线 在图像上长按左键画矩形单击右键清除
- 混合现实VR Twitch视频
- error: incompatible types when assigning to type ‘const struct wiphy_wowlan_support‘
- 软件开发人员 梦想最大的阻碍:毒、赌、黄
- 用户画像—打用户行为标签