user366312
user366312

Reputation: 16988

Correlation coefficient of metrices (or, 2d arrays)

I need to compute the correlation coefficient between two digital images so that I can compare those two images to test their similarities.

I can convert the images either to two matrices of complex numbers (the complex representation of the images are Fourier Transformed so that I can work in frequency domain) or to two matrices of real numbers. So, those are my options to get started with.

How can I calculate the correlation coefficient of two matrices (or 2d arrays)?

This routine can calculate correlation coefficient of two vectors (or 1d arrays). But, I need to calculate the correlation of two matrices (or, 2d arrays).

.

Upvotes: 0

Views: 1022

Answers (1)

Frank Puffer
Frank Puffer

Reputation: 8215

It works the same way for a 2d array. You could just copy your 2d arrays (M rows, N columns) into 1d array of size MxN and use the algorithm you already have.

The order doesn't matter at all, you could do rows first or something else. The only thing that is important is to use the same order for both arrays so that corresponding pixels are compared.

Upvotes: 1

Related Questions