CV中直方图比较方法

为了比较两个直方图 ( H 1 和 H 2 ) (H_{1}和H_{2}) (H1H2),首先必须选择度量 ( d ( H 1 H 2 ) ) (d(H_{1}H_{2})) (d(H1H2)),以表示两个直方图匹配的程度。

OpenCV利用函数compareHist来执行比较。它还提供4个不同的度量来计算匹配:

1、皮尔逊相关系数

Correlation ( CV_COMP_CORREL )

d ( H 1 , H 2 ) = ∑ I ( H 1 ( I ) − H 1 ˉ ) ( H 2 ( I ) − H 2 ˉ ) ∑ I ( H 1 ( I ) − H 1 ˉ ) 2 ∑ I ( H 2 ( I ) − H 2 ˉ ) 2 d(H_1,H_2) = \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}} d(H1,H2)=I(H1(I)H1ˉ)2I(H2(I)H2ˉ)2 I(H1(I)H1ˉ)(H2(I)H2ˉ)

其中

H k ˉ = 1 N ∑ J H k ( J ) \bar{H_k} = \frac{1}{N} \sum _J H_k(J) Hkˉ=N1JHk(J)

N是直方图区间总数。

真值 [1.00]

取值区间 [0.00,1.00]

2、卡方距离

Chi-Square ( CV_COMP_CHISQR )

d ( H 1 , H 2 ) = ∑ I ( H 1 ( I ) − H 2 ( I ) ) 2 H 1 ( I ) d(H_1,H_2) = \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)} d(H1,H2)=IH1(I)(H1(I)H2(I))2

真值 [0.00]

取值区间 [0.00,+∞]

3、交叉距离

Intersection ( method=CV_COMP_INTERSECT )

d ( H 1 , H 2 ) = ∑ I min ⁡ ( H 1 ( I ) , H 2 ( I ) ) d(H_1,H_2) = \sum _I \min (H_1(I), H_2(I)) d(H1,H2)=Imin(H1(I),H2(I))

真值 [24.39]

取值区间 [0.00,1.00]

4、巴氏距离

Bhattacharyya distance ( CV_COMP_BHATTACHARYYA )

d ( H 1 , H 2 ) = 1 − 1 H 1 ˉ H 2 ˉ N 2 ∑ I H 1 ( I ) ⋅ H 2 ( I ) d(H_1,H_2) = \sqrt{1 - \frac{1}{\sqrt{\bar{H_1} \bar{H_2} N^2}} \sum_I \sqrt{H_1(I) \cdot H_2(I)}} d(H1,H2)=1H1ˉH2ˉN2 1IH1(I)H2(I)

真值 [0.00]

取值区间 [0.00,1.00]

[1]https://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/histogram_comparison/histogram_comparison.html

你可能感兴趣的:(PCL)