Similarity between two matrices of different sizes

10 visualizaciones (últimos 30 días)
GUru
GUru el 29 de Jul. de 2011
Comentada: Gayathri Nayar el 28 de Oct. de 2019
Dear all,
I have two matrices(or images) of different sizes. Now i want to compare these two matrices and find out the maximum similarity between the matrices. The output should contain the points of similarity between them. Is these any way to do it in matlab using any function or toolbox or kindly some way to write the code ..
Thank you Gurunath

Respuestas (3)

Dustin
Dustin el 29 de Jul. de 2011
I assume that by similarity you are referring to elements having the same values in the same locations. In that case, I suggest subtracting the two matrices, and finding the elements which are zero. I doubt that this approach will help you find similar regions in images though.

Paulo Silva
Paulo Silva el 29 de Jul. de 2011
%two random arrays with variable size and data
a=randi([1 10],randi([1 10]),randi([1 10]));
b=randi([1 10],randi([1 10]),randi([1 10]));
%find the common dimensions
mxr=min(size(a,1),size(b,1))
mxc=min(size(a,2),size(b,2))
%compare the values
a(1:mxr,1:mxc)==b(1:mxr,1:mxc)
you get the answer in one array with logic values, 1 when the values at same index are equal and 0 if they are not equal

Walter Roberson
Walter Roberson el 29 de Jul. de 2011

Categorías

Más información sobre Numeric Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by