简体   繁体   English

在matlab中计算直方图的期望和方差

[英]Calculate Expectation and Variance of Histogram in matlab

I want to compute the standard deviation and expected value of the given histogram.我想计算给定直方图的标准偏差和期望值。

Which matlab function will help me to do that?哪个 matlab 函数可以帮助我做到这一点?

My code:我的代码:

I = imread('download.bmp');
imshow(I);title('Input Image');

imhist(I(:));title('Histogram of input image');

Not quite sure, whether I am getting your question properly.不太确定,我是否正确回答了您的问题。 By expected value of the histogram, do you mean the mean intensity value of the image, so basically which intensity you are most likely to draw if you draw a random pixel?通过直方图的期望值,您是指图像的平均强度值,所以如果您绘制随机像素,基本上您最有可能绘制哪种强度?

This you could simply get by doing这你可以简单地通过做

m_wholeImage = mean(I(:));
s_wholeImage = std(double(I(:)));

s_wholeImage then gives you the standard deviation of all pixel values. s_wholeImage然后为您提供所有像素值的标准偏差。

I would suggest this reference :我会建议这个参考:

Gonzalez., R., Eddins., S. and Woods, R. (2009). Gonzalez., R., Eddins., S. 和 Woods, R. (2009)。 Digital image processing using MATLAB.使用 MATLAB 进行数字图像处理。 2nd ed.第二版。 Gatesmark Publishing, pp.644-654.盖茨马克出版社,第 644-654 页。

It mentions code for quantifying texture in an image, and that involves finding mean and standard deviation of the image histogram.它提到了量化图像中纹理的代码,这涉及找到图像直方图的均值和标准差。

I found the code online :我在网上找到了代码:

http://fourier.eng.hmc.edu/e161/dipum/statxture.m http://fourier.eng.hmc.edu/e161/dipum/statxture.m

http://fourier.eng.hmc.edu/e161/dipum/statmoments.m http://fourier.eng.hmc.edu/e161/dipum/statmoments.m

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM