How to compare 2 feature matrix of 2 different dimensions?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am working on project "Person Identification via retinal blood vessels". I have computed feature matrix for images. Feature matrix constitutes of angle and distances between a candidate feature point and 4 nearest neighbors. Feature matrix is N x 8. N varies for every image depending on the number of feature points it has. So its quite possible that query image and images in database have different N.
Now for recognition I have to do matching step . For which I have to compare the feature matrix of query image with the feature matrix of the rest of the images. I have read some papers regarding this. They are doing matching using euclidean distance between the query image and the images in database.
My question is that how to find the euclidean distance between query image and all the images in database? As the dimension of the feature may appear to be different depending on the number of feature they have. And euclidean distance find distance on the basis of index location. I tried using norm. First I reshaped my feature matrix to 1D array and then computed norm. I also tried the following.
x2 = reshape(X',1 ,prod(size(X)));
y2 = reshape(Y', 1,prod(size(Y)));
dist = sqrt(dot(x2-y2,x2-y2));
All of this works fine with matrix having same dimension. However as dimension for my feature matrix are different so it gives error "matrix dimension must agree". I can think of 2 ways of resolving it. Either perform zero padding or perform truncation of feature vectors. So that query image and images in database become of same dimension . however this will effect the result. Is there any other way to rectify this issue. I am totally stuck please help me.
1 commentaire
Bisma Waheed
le 25 Mar 2018
Hey! I'm having the same issue of Matrix Dimensions not agreeing for a project SPEAKER RECOGNITION SYSTEM. I am also computing the Euclidean Distance. Did you find a way to get rid of the error?
Réponses (1)
Image Analyst
le 25 Mar 2018
Try pdist2:
features1 = rand(5, 8); % Whatever...
features2 = rand(10, 8); % Whatever...
distances = pdist2(features1, features2)
0 commentaires
Voir également
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!