if the coding is correct to find the euclidean distance

1 回表示 (過去 30 日間)
ajith
ajith 2013 年 3 月 28 日
x=double(imread('result.png'));
[pc, score,latent,tsquare] = princomp(x);
y=double(imread('result1.png'));
[pc1,score1,latent1,tsquare1] = princomp(y);
img=latent;
img2=latent1;
dist = sqrt(sum((img - img2) .^ 2));
ITS A CORRECT CODING SIR

回答 (2 件)

Walter Roberson
Walter Roberson 2013 年 3 月 28 日
Maybe. It is not obvious to me that taking the euclidean distance of the latent is meaningful, though. Also I see no inherent reason why the vectors would be the same length unless the images happened to be the same size.

Jan
Jan 2013 年 3 月 28 日
Please note that uppercase characters means shouting in a forum.
It is hard to guess, if the coding is correct, when you do not explain, what the function should do. Perhaps you want a single number as output:
dist = sqrt(sum((img(:) - img2(:)) .^ 2))
  1 件のコメント
Walter Roberson
Walter Roberson 2013 年 3 月 28 日
princomp is documented as returning a vector for the "latent" output parameter, so it should not be necessary to use (:)

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

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by