You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LoadAsciiImagesMatch.m 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. function [imagesData] = LoadAsciiImagesMatch(dataFilePath, dataFileName, numNodes, debug, debugPath)
  2. if nargin >= 3
  3. if nargin < 4
  4. debug = 0;
  5. end
  6. if nargin < 5
  7. debugPath = 'debug/';
  8. end
  9. fullOutPath = strcat(dataFilePath, debugPath);
  10. if isdir(fullOutPath) == 0 && debug == 1
  11. mkdir(fullOutPath);
  12. end
  13. dataFullName = strcat(dataFilePath,dataFileName);
  14. outFullName = strcat(fullOutPath,dataFileName);
  15. imagesData = sparse(numNodes,numNodes); %% initilaize with zero
  16. matches = load(dataFullName);
  17. n = size(matches,1);
  18. % m = size(edges,2);
  19. for e=1:n
  20. i = matches(e,1);
  21. j = matches(e,2);
  22. if (i> numNodes || j>numNodes)
  23. LogMsg(sprintf('*** ERROR: LoadAsciiImagesMatch: Invalid edge %d (%d,%d)\n',e,i,j));
  24. else
  25. if i<j
  26. imagesData(i,j) = matches(e,5);
  27. else
  28. imagesData(j,i) = matches(e,5);
  29. end
  30. end
  31. end
  32. if debug == 1
  33. %save(strcat(outFullName,'_imagesData.txt'), 'imagesData', '-ascii');
  34. %SaveIntMatrixToFile(strcat(outFullName,'_imagesData.txt'), imagesData);
  35. save(strcat(outFullName,'_imagesData.mat'), 'imagesData');
  36. save(strcat(outFullName,'_loadMatches.mat'));
  37. end
  38. else
  39. fprintf('*** ERROR: LoadAsciiImagesMatch: Invalid parameters. expecting: dataFilePath, dataFileName, numNodes\n');
  40. end