Solved – Normalized cross correlation vs Euclidean distance in template matching

cross correlationdistanceimage processingpattern recognition

What is the difference between normalized cross-correlation and Euclidean distance in pattern recognition? — especially if we want to do recognition with template matching.

I understand about Euclidean distance. It's like calculate $\sqrt{\sum(x_2-x_1)^2+..+(x_n-x_{n-1}))}$

And the small distance in Euclidean distance is recognised as the new label of the test image. But how about normalized cross correlation??

How to calculate it, what does is it represent, what are the drawbacks and the advantage of using that method? Which method is the best???

Best Answer

For two vectors $v_i$ and $v_j$ with length $n$,

1, when the two vectors are normalized to zero mean and unit length ($v \leftarrow \frac{v-\bar{v}}{||v-\bar{v}||_2}$), their Pearson correlation coefficient $r(=corr(v_i, v_j))$ relates to their Euclidean distance $d(=||v_i-v_j||_2)$ by $r=1-d^2/2$, or equally $r=v_i^Tv_j$. Reference: http://t.cn/RL5JcKt.

2, when the two vectors are normalized to zero mean and unit standard deviation (or unit variance) ($v \leftarrow \frac{v-\bar{v}}{std(v-\bar{v})}$), then $r=1-d^2/(2*(n-1))$, or equally $r=v_i^Tv_j/(n-1)$.

Related Question