Filter löschen
Filter löschen

How to quantify shape similarity between two vectors.

7 Ansichten (letzte 30 Tage)
dipak sanap
dipak sanap am 9 Sep. 2024
Beantwortet: Image Analyst am 10 Sep. 2024
I need to quanitfy how similarity between two spectral profile. I have looked at procrustes distance but it dosent work when spectrum is shifted on x axis. Is there a way to quanitfy this, ideally between 0 (no similairty) and 1 (perfect similarity) ?
x1 = 0:0.1:10;
Y1 = gaussmf(x1,[0.8 5 ]);
Y2 = gaussmf(x1,[0.8 3 ]);
Y3 = gaussmf(x1,[0.4 2 ]);
figure(1)
plot(x1,Y1, 'k','Linewidth',2)
hold on
plot(x1,Y2, 'b','Linewidth',2)
hold on
plot(x1,Y3, 'r','Linewidth',2)
legend(["A","B","C"])
figure(1)
In the toy example, A and B are very similar so that should have a high similairty index but A-C and B-C should have lower similarity.

Antworten (3)

Torsten
Torsten am 9 Sep. 2024
Bearbeitet: Torsten am 9 Sep. 2024
Shift the curves by their means first so that the means of all objects lie in the origin (0). This will remove translational differences between the objects.

Matt J
Matt J am 10 Sep. 2024
Bearbeitet: Matt J am 10 Sep. 2024
Perhaps you could use correlation-based similarity?
x1 = 0:0.1:10;
Y1 = gaussmf(x1,[0.8 5 ]);
Y2 = gaussmf(x1,[0.8 3 ]);
Y3 = gaussmf(x1,[0.4 2 ]);
corrcoeff(Y2,Y1)
ans = 1.0000
corrcoeff(Y2,Y3)
ans = 0.8944
corrcoeff(Y1,Y3)
ans = 0.8944
function coeff=corrcoeff(u,v)
coeff=max(xcorr(u,v))/norm(u)/norm(v);
end

Image Analyst
Image Analyst am 10 Sep. 2024

Kategorien

Mehr zu Elementary Polygons finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by