# Normalized cross-correlation in detail

I'm trying to implement a normalized cross-correlation algorithm but I don't get what in fact is this measure. What confuses is the wikipedia definition:

$\frac{1}{n} \sum \frac{(f(x,y)- \overline{f})(t(x,y)- \overline{t}) }{\sigma_{f}\sigma_{t}}$

Which result is an scalar (AFAIK)

But then adds other way to measure it:

$\left \langle \frac{F}{\left \| F \right \|},\frac{T}{\left \| T \right \|} \right \rangle$

Where $F$ and $T$ are normalized vectors and $\left \langle . , . \right \rangle$ is the inner product. But the output will be a vector, isn't? Isn't supposed to give me a scalar as well? Am I getting something wrong?

The idea is to implement this formula and use it with matrices with same dimensions.

Thank you

• I thought the inner product was a scalar by definition. – Niki Estner Dec 3 '13 at 13:06

## 2 Answers

An individual inner product does produce a scalar, but often when a cross correlation is calculated multiple individual cross correlations (i.e. dot products) are calculated at different time offsets. These individual scalar results form a vector that is indexed by the relative time offset.

• F/||F|| will output a matrix right? And matrix multiplication result is also a matrix, isn't it? – Jorge Zapata Dec 4 '13 at 16:46

The inner product or dot product or scalar product will not output a vector, it will output a scalar which is (with exception of the $1/n$ in front of the sum) the same as the first equation that you gave. See here for details