1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- function [imagesData] = LoadAsciiImagesMatch(dataFilePath, dataFileName, numNodes, debug, debugPath)
-
- if nargin >= 3
- if nargin < 4
- debug = 0;
- end
- if nargin < 5
- debugPath = 'debug/';
- end
-
- fullOutPath = strcat(dataFilePath, debugPath);
- if isdir(fullOutPath) == 0 && debug == 1
- mkdir(fullOutPath);
- end
-
- dataFullName = strcat(dataFilePath,dataFileName);
- outFullName = strcat(fullOutPath,dataFileName);
-
- imagesData = sparse(numNodes,numNodes); %% initilaize with zero
- matches = load(dataFullName);
-
- n = size(matches,1);
- % m = size(edges,2);
-
- for e=1:n
- i = matches(e,1);
- j = matches(e,2);
- if (i> numNodes || j>numNodes)
- LogMsg(sprintf('*** ERROR: LoadAsciiImagesMatch: Invalid edge %d (%d,%d)\n',e,i,j));
- else
- if i<j
- imagesData(i,j) = matches(e,5);
- else
- imagesData(j,i) = matches(e,5);
- end
- end
- end
-
- if debug == 1
- %save(strcat(outFullName,'_imagesData.txt'), 'imagesData', '-ascii');
- %SaveIntMatrixToFile(strcat(outFullName,'_imagesData.txt'), imagesData);
- save(strcat(outFullName,'_imagesData.mat'), 'imagesData');
- save(strcat(outFullName,'_loadMatches.mat'));
- end
- else
- fprintf('*** ERROR: LoadAsciiImagesMatch: Invalid parameters. expecting: dataFilePath, dataFileName, numNodes\n');
- end
|