ReadOutexTxt.m
上传用户:kandtrade
上传日期:2009-06-26
资源大小:12k
文件大小:1k
源码类别:

图形图象

开发平台:

Matlab

  1. %  ReadOutexTxt gets picture IDs and class IDs from txt for Outex Database
  2. %  [filenames, classIDs] = ReadOutexTxt(txtfile) gets picture IDs and class
  3. %  IDs from TXT file for Outex Database
  4. function [filenames, classIDs] = ReadOutexTxt(txtfile)
  5. % Version 1.0
  6. % Authors: Zhenhua Guo, Lei Zhang and David Zhang
  7. % Copyright @ Biometrics Research Centre, the Hong Kong Polytechnic University
  8. fid = fopen(txtfile,'r');
  9. tline = fgetl(fid); % get the number of image samples
  10. i = 0;
  11. while 1
  12.     tline = fgetl(fid);
  13.     if ~ischar(tline)
  14.         break;
  15.     end
  16.     index = findstr(tline,'.');
  17.     i = i+1;
  18.     filenames(i) = str2num(tline(1:index-1))+1; % the picture ID starts from 0, but the index of Matlab array starts from 1
  19.     classIDs(i) = str2num(tline(index+5:end)); 
  20. end
  21. fclose(fid);