📄 displayimage.m
字号:
% displayImage - displays an image in a convenient way in the current axes.%% displayImage(img) - displays image in a new window% img can be of any numerical type or a logical, and it% must have two (gray-scale) or three (RGB) dimensions.% img can be an Image structure (see initializeImage).% The image is scaled appropriately.%% displayImage(img,doNormalize)% If doNormalize is 1, the image is maximum-normalized % (default: 0).%% See also displayMap, displayMaps, showImage, initializeImage, dataStructures.% This file is part of the SaliencyToolbox - Copyright (C) 2006-2007% by Dirk B. Walther and the California Institute of Technology.% See the enclosed LICENSE.TXT document for the license agreement. % More information about this project is available at: % http://www.saliencytoolbox.netfunction displayImage(img,doNormalize)if (nargin < 2) doNormalize = 0;endif (isa(img,'struct')) displayImage(loadImage(img),doNormalize); return;endif (isa(img,'logical')) img = double(img);endif (~isa(img,'double')) img = im2double(img);endimg = squeeze(img);num_dims = length(size(img));if ((num_dims ~= 2) & (num_dims ~= 3)) disp([mfilename ' error - unknown image format: ' class(img)]); return;endmx = max(img(:));mn = min(img(:));if (doNormalize & (mx > mn)) img = mat2gray(img); %img = (img - mn) / (mx - mn);endif (num_dims == 2) % gray scale image -> RGB img = reshape(img,size(img,1),size(img,2),1); img(:,:,2) = img(:,:,1); img(:,:,3) = img(:,:,1);endmx = max(max(max(img))); mn = min(min(min(img)));if ((mx > 1.0) | (mn < 0.0)) disp('showImage.m: image out of range 0.0 ... 1.0'); fprintf('(max: %g; min: %g)\n',mx,mn); disp ('cutting off ...'); img(find(img > 1.0)) = 1.0; img(find(img < 0.0)) = 0.0;end% display the RGB imageimage(img);axis image;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -