www.gusucode.com > 声音的处理有:LPC,FFT,共振峰,频谱源码程序 > siganlandsystemusingMatlab/SSUM/library/load_imagedata.m
function imagedata = load_imagedata(varargin) savedir = pwd; if nargin == 1, filenamepath = varargin{1}; else try cd([ssumroot, 'data/images']); catch fprintf('Cannot find %s...\n', [ssumroot, 'data/images']); end % Also be able to select aiff [filename,path] = uigetfile({... '*.jpg; *.gif; *.tif; *.tiff','Image Files'; ... '*.mat','MATLAB data'; '*.*','All files (*.*)'}, ... 'Select a file'); if isequal(filename,0) | isequal(path,0) return; end filenamepath = [path filename]; end imagedata = struct('data',[],'map',[],'filenamepath',''); [t,extension] = strtok(filenamepath,'.'); switch(lower(extension)) case '.mat' fprintf('Loading database...\n'); imagedata = load(filenamepath); %audiodata = audiodata.database; otherwise [imagedata.data, imagedata.map] = imread(filenamepath); end imagedata.filenamepath = filenamepath; cd(savedir);