Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Similarity measure of unlike-size matrices

  1. Jan 7, 2010 #1

    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:

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

    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:

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

    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?
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted