-
平方差匹配。method=CV_TM_SQDIFF
这类方法利用平方差来进行匹配,最好匹配为 0,匹配越差,匹配值越大。
R(x,y)=∑x,,y,(T(x,,y,)−I(x+x,,y+y,))2
-
归一化平方差匹配。method = CV_TM_SQDIFF_NORMED
R(x,y)=∑x,,y,T(x,,y,)2∗∑x,,y,I(x+x,,y+y,)2∑x,,y,(T(x,,y,)−I(x+x,,y+y,))2
和平方差差不多,只是加以标准化,但是准确度提高了,牺牲了计算量
-
相关匹配 method = CV_TMCCORR
这类方法采用模板和图 像间的乘法操作,所以较大的数表示匹配程度较高,0 标识最坏的匹配结果。
R(x,y)=∑x,,y,(T(x,,y,)∗I(x+x,,y+y,))
-
归一化相关匹配 method = CV_TM_CCORR_NORMED
R(x,y)=∑x,,y,T(x,,y,)2∗∑x,,y,I(x+x,,y+y,)2∑x,,y,(T(x,,y,)∗I(x+x,,y+y,))
-
相关系数匹配 method = CV_TM_CCOEFF
这类方法将模板对其均值的相对值与图像对其均值的相关值进行匹配,1 表示完美匹配,-1 表示糟糕的匹配,0 表示没有任何相关性。
R(x,y)=∑x,,y,(T,(x,,y,)∗I,(x+x,,y+y,))
其中
T,(x,,y,)=T(x,,y,)−(w∗h)∗∑x,,,y,,I(x+x,,,y+y,,)1
I,(x+x,,y+y,)=I(x+x,,y+y,)−(w∗h)∗∑x,,,y,,T(x,,,y,,)1
-
归一化相关系数匹配 method = CV_TM_CCOEFF_NORMED
R(x,y)=∑x,,y,T(x,,y,)2∗∑x,,y,I(x+x,,y+y,)2∑x,,y,(T(x,,y,)∗I(x+x,,y+y,))