Azzera filtri
Azzera filtri

Similarity between two matrices of different sizes

12 visualizzazioni (ultimi 30 giorni)
GUru
GUru il 29 Lug 2011
Commentato: Gayathri Nayar il 28 Ott 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

Risposte (3)

Dustin
Dustin il 29 Lug 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 il 29 Lug 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 il 29 Lug 2011

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by