Statistical comparison of two 2d matrices, corr2 or xcorr or other?
27 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everybody,
I'm trying to compare 2d matrices (just 2 at a time) of identical sizes to see if they are similar, what I mean by similar is that high and low values appear in similar areas in each matrix (i.e. they share a similar distribution but not necessarily similar values, although I'm open to an approach which would require similar values too).
Currently I'm using corr2 but this seems the results of this don't always seem to be the most obvious; matrices which I think are very similar don't get very high correlations but matrices which are only vaguely similar get high(ish) correlation values. I think part of the problem is that my matrices contain a lot of zero values, so it only takes some low numbers in the right places to create in implied correlation.
I was wondering if anybody knows of or could recommend an alternative approach. I was wondering about xcorr, from the description it seems to do what I want, but in practice I can't really understand it, I'm not sure why it returns a matrix the same size as the inputs or what the values contained are.
Ideally I would like a test which takes two matrices of identical size and ouputs a single value signifying their similarity.
Thanks in advance for any help,
Rod.
0 comentarios
Respuestas (1)
Image Analyst
el 13 de Jul. de 2014
A common way of measuring similarity of 2D matrices (images) is ssim(), which is in the Image Processing Toolbox. You could also use psnr(), , or median absolute deviation, or mean absolute deviation, or something of your own choosing such as comparing the mean and standard deviation.
4 comentarios
Image Analyst
el 24 de Jul. de 2014
SSIM can be used to compare different images. But after a while it doesn't make sense. Let's say you compared lena to baboon and got 100, and then you compared cameraman to moon and got 200. Does that mean that lena is twice as similar to baboon as cameraman is to moon? No. They were not meant for that. These kinds of measures are usually used for denoising and compression algorithm comparisons and are generally valid only for smaller values, not huge values.
Not sure how you'd handle nans. Perhaps you can convert to a 1D vector and remove them, or else set them to zero.
I think you'd use the max value for your data type. Like I said, they're mostly used for compression comparisons so that's why.
I don't think ind2gray() would be of use here.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!