util_view_img_files.m

来自「Standard model object recognition matlab」· M 代码 · 共 54 行

M
54
字号
function util_view_img_files (filepath, varargin)% FUNCTION util_view_img_files (filepath, varargin)%% Look at all '.mat' images in filepath.% varargin{1} = 'mat' (default), 'pgm', or other image formats.if length(varargin) > 0  img_format = varargin{1};else  img_format = 'mat';endif ~exist(filepath,'dir')  error([filepath ' does not exist.']);endD = dir([filepath '/*' img_format]);if length(D) > 0  show_in_this_dir (filepath, img_format);endfunction show_in_this_dir (filepath, image_format)colormap gray;D = dir([filepath '/*' image_format]);for i = 1:length(D)  fn = [filepath '/' D(i).name];  if image_format == 'mat'    if ~strcmp(D(i).name, 'stim_size.mat')      load(fn, 'r');    else      r = 0;    end    clim = [-1 1];  else    r = imread(fn);    r = double(r)/255;    clim = [0 1];  end  disp([filepath '/' D(i).name]);  imagesc(r, clim);  axis image; drawnow;  pause(0.5);  % or do it in a montage, assuming all the images are of the  % same size.  %img_all(:,:,1,i) = r;end%montage (img_all);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?