拟合高斯曲线在C某直方图峰值++ [英] Fitting a gauss curve to a certain histogram peak in c++
问题描述
我有两个关于拟合高斯曲线直方图峰的问题。 我的第一个问题是一个很基本的一种:
I have two questions concerning fitting a gauss curve to histogram peaks. My first question is a very basic one:
- 如何适应高斯曲线为整个直方图?这是否只意味着我必须找出并计算出直方图的平均值(μ)和差(ϭ),并把它们放到公式为高斯曲线?
请问下面的例子是正确的?: 假设(只是作为例子),我有一个图象与5颜色值的直方图。 在X轴有这5种颜色值,并在Y轴有每个值的频率。 即:
Would the following example be right?: Assume (just as an example) I have a histogram of an image with 5 colour values. On the X-Axes there are these 5 color values and on the Y-Axes there are the frequencies of each of these values. i.e.:
值1:1时间
值2:4次
值3:7次
值4:3次
值5:2次
现在的平均值(μ)将是3(μ= 3)。
Now the mean value(µ) would be 3(µ = 3).
和的偏差(ϭ)。将0.9(ϭ= 0.9)。 表现公式:
And the deviation(ϭ) would be 0.9 (ϭ = 0.9). formular:
Now I use these values in the formular of the density function to calculate my gauss curve?
这是否正确?不幸的是,我对数学的背景有点不安全。
Is that correct? Unfortunately I am a little unsecure about the math background.
- 在我的第二个问题是一个小更棘手: 这一次,我有几个峰直方图,但我只想要符合高斯曲线的最高峰。 所以,我经过直方图的所有箱用简单的循环和在x轴找到一个强度值(其中包含图像的强度)与 最频率(在y轴上示出)。这将是最高峰。但我怎么找出偏差?特别是,因为我不 知道哪个强度值的我应该在我的计算。 据我所知道的转折点高斯曲线在于在μ+ϭ和μ-ϭ。莫非是帮助解决问题。
- My second question is a little more tricky: This time, I have a histogram with several peaks, but I only want to fit the gauss curve to the highest peak. So, I go through all the bins of the histogram with a simple for loop and find one intensity value on the x-axis(which contains the intensities of the image) with the most frequencies(shown on the y-axes). This would be the highest peak. But how do I find out the deviation? Especially, since I dont know which of the intensity values I should include in my calculations. As far as I know the turning point of the gauss curve lies at µ+ϭ and µ-ϭ. Could that help to solve the problem.
我很抱歉,这个问题是一个小的数学,但我没有找到一个更好的地方要问它。我也看过一些类似的主题,但unfortunatley他们最终没有回答我的问题。
I am sorry that this question is a little mathematical, but I did not find a better place to ask it. I also read some similar topics, but unfortunatley they did not finally answer my question.
感谢您的帮助!
问候马克·
推荐答案
您的方法来估算一个高斯的参数是正确的,我想。
Your approach to estimating the parameters of a single gaussian is correct, I think.
有关多高斯,你可能想查找混合模型或者更具体地说混合物的高斯。在那短短的几个注意事项:
For multiple gaussians, you might want to look up mixture models or more specifically mixtures of gaussians. Just a few notes on that:
- (你可能已经知道)最强的高斯在搭配并不一定是一个具有最高峰
- 如果您有两个高斯不同的平均金额,直方图中的峰值将不匹配的平均值
- 在离散直方图使用一个单峰的高度可能不是一个好主意:实际的峰值可能在这两个直方图块之间。 [澄清:在这种情况下,这两个垃圾箱的数量可以比为所集中在一个仓高峰显著降低同样,对于大多数类型的数据,你的柱状图将包含一个很大的噪音。至少使用平均滤波器在直方图一些。
这篇关于拟合高斯曲线在C某直方图峰值++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!