Effacer les filtres
Effacer les filtres

Similarity between two matrices of different sizes

12 vues (au cours des 30 derniers jours)
GUru
GUru le 29 Juil 2011
Commenté : Gayathri Nayar le 28 Oct 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

Réponses (3)

Dustin
Dustin le 29 Juil 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 le 29 Juil 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 le 29 Juil 2011
  1 commentaire
Gayathri Nayar
Gayathri Nayar le 28 Oct 2019
Sir, this link doesn't work anymore.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by