AsymmetricDistanceComputationWDist.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. function [ iXMinDist ] = AsymmetricDistanceComputationWDist(iXQ, YCDistMat, nRecall)
  2. %UNTITLED Summary of this function goes here
  3. % Detailed explanation goes here
  4. kk=size(YCDistMat,2);
  5. mm=size(YCDistMat,3);
  6. %imgSz=size(YSetMat,1);
  7. %subImgSz=imgSz/mm;
  8. Ntests=size(YCDistMat,1);
  9. DistMat=zeros(kk,mm);
  10. iXMinDist=zeros(Ntests,nRecall);
  11. for ii=1:Ntests
  12. %for jj=1:mm
  13. % DistMat(:,jj)=EuclideanDistancesMat(YSetMat((jj-1)*subImgSz+1:jj*subImgSz,ii),CSubSetMat(:,:,jj));
  14. %end
  15. DistMat=squeeze(YCDistMat(ii,:,:));
  16. DistVec = SumCentroidsDistances(DistMat,iXQ);
  17. [~, iXMinDisttemp] = sort (DistVec);
  18. maxRec=size(iXMinDisttemp,2);
  19. if maxRec >= nRecall
  20. iXMinDist(ii,:)=iXMinDisttemp(:, 1:nRecall);
  21. else
  22. ouch=size(iXMinDisttemp,1);
  23. iXMinDist(ii,:)=[iXMinDisttemp, zeros(1,nRecall-maxRec)];
  24. end
  25. %pp=double(ii/Ntests*100);
  26. %if(pp<10)
  27. %fprintf('\b\b\b\b\b\b %2.2f%%',pp);
  28. %else
  29. %fprintf('\b\b\b\b\b\b\b %2.2f%%',pp);
  30. %end
  31. end
  32. % for rr=1:Ntests
  33. % for ii=1:Ntr
  34. % SEucDist=0;
  35. %
  36. % for jj=1:m
  37. % SEucDist=SEucDist+dEucXCent(iYQ(rr,jj),ii,jj)^2;
  38. % end
  39. % TEucDist(ii)=sqrt(SEucDist);
  40. % end
  41. % pp=rr/Ntests*100;
  42. % if(pp<10)
  43. % fprintf('\b\b\b\b\b\b%2.2f %%',pp);
  44. % else
  45. % fprintf('\b\b\b\b\b\b\b%2.2f %%',pp);
  46. % end
  47. % [~,indMin]=min(TEucDist);
  48. % iXMinDist(rr)=indMin;
  49. % end
  50. end