필터 지우기
필터 지우기

Feature matching using Euclidean

조회 수: 2 (최근 30일)
Im
Im 2015년 5월 13일
댓글: Im 2015년 5월 18일
I am now doing copy move image forgery detection using DCT. Now I have some problem for matching part. It lagging for loading whole data since I am using looping to get the similarity between two row vector. Any idea to change my code in better way. Here is my code for the matching part.
z=0;
for num=1:group
for a=mS(num):mE(num)-1
for b=a+1:mE(num)
z=z+1;
Dsimilar(z,1) = norm(sort(a,:)-sort(b,:))
end
end
end

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 13일
That is not a valid calling form for the sort() function, so that code will not execute.
Why would you want to sort a single integer anyhow?
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 5월 13일
norm() by default calculates the 2-norm, which is the Euclidean length of the vector. Which is sqrt(sum(x.^2)) . You can calculate a lot of euclidean lengths at once. For example,
for a = Ms(num):Me(num)+1
Ta = repmat(sortZZ(a,:), Me(num)-a, 1);
Tb = sortZZ(a+1:me(num),:);
norms = sqrt(sum((Ta - Tb).^2, 2));
Dsimilar = [Dsimilar; norms(:)];
end
Im
Im 2015년 5월 18일
Thanks a lot. I get it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by