How to compare 2 feature matrix of 2 different dimensions?

3 ビュー (過去 30 日間)
Sidra Aleem
Sidra Aleem 2017 年 4 月 12 日
回答済み: Image Analyst 2018 年 3 月 25 日
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 件のコメント
Bisma Waheed
Bisma Waheed 2018 年 3 月 25 日
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?

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2018 年 3 月 25 日
Try pdist2:
features1 = rand(5, 8); % Whatever...
features2 = rand(10, 8); % Whatever...
distances = pdist2(features1, features2)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by