function [frames, descriptors] = loadSURFFile(SURFFile) % [frames, descriptors] = loadSURFFile(SURFFile) % Loads data of an ETH-SURF file into memory. fid = fopen(SURFFile, 'r'); if (fid < 0) error('Cannot read SURF file.'); end descriptorLen = fscanf(fid, '%d', 1); descriptorLen = descriptorLen - 1; numFeatures = fscanf(fid, '%d', 1); frameLen = 6; rowLen = descriptorLen + frameLen; frames = zeros(numFeatures, frameLen); descriptors = zeros(numFeatures, descriptorLen); for nRow = 1:numFeatures row = fscanf(fid, '%f', rowLen); frames(nRow,1:frameLen) = row(1:frameLen); descriptors(nRow,1:descriptorLen) = row(frameLen+1:rowLen); clear row; end % nRow fclose(fid);