Hi,(adsbygoogle = window.adsbygoogle || []).push({});

When two matrices don't have the same size, it's difficult to find a measure expressing the amount of similarity. For same-size matrices, the correlation is often used. One possibility for unlike-size matrices is the use of the Peak to correlation energy, defined as:

[itex]

P=\frac{\rho(s_{peak} ; X, Y)^2}{c\sum_{s} (\rho(s; X, Y))^2},

[/itex]

where rho is the normalized cross correlation and s denotes the shift (over x and y), which runs over all possible indexes. Finally, c is a constant (not of interest atm), and s_peak denotes the maximum value (i.e. the vector by which the template was shifted).

This can easily be calculated in Matlab, but for large matrices (template and image > 10^6 elements) this becomes very slow.

I read in a paper that this can be rewritten as dot products, as the normalization of the normalized cross product cancels out:

[itex]

P=\frac{ ((X-\bar{X})\cdot (Y(s_{peak})-\bar{Y}))^2 }{c\sum((X-\bar{X})\cdot (Y(s)-\bar{Y}))^2}

[/itex]

But I don't understand this, as X and Y may be different sizes, so that the dot product cannot be calculated.

So am I stuck with the (slow) normalized cross-correlation, or are there maybe different performance measures that I could use to express the similarity of unlike-size matrices?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Similarity measure of unlike-size matrices

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**