📄 loc_im_display.m
字号:
function loc_im_display(varargin)% displays image in a window whose position, scaling and colormap can be specified% if parameters are omitted then default values are used% % Arguments: im - matrix (array) of values% sf - scale factor (default is 2)% xpos - x position on screen (default is 100)% ypos - y position on screen (default is same as xpos)% cmap - colormap (default is 256 linear grayscale)%% Usage: loc_im_display(im,sf,xpos,ypos,cmap);%% Author: D.Renshaw %%define defaultssf=2; xpos=100; ypos=100;%create a linear 256 grayscale colormapfor i=1:256 for j=1:3 gscmap256(i,j) = (i-1)/255; endendcmap=gscmap256;%check number of input arguments and overwrite defaults as requiredif (nargin < 1) error('not enough input arguments')endim = varargin{1};if (nargin > 1) sf = round(varargin{2}(1)); %redefine the colormapendif (nargin > 2) xpos = round(varargin{3}(1)); ypos = xpos;endif (nargin > 3) ypos = round(varargin{4}(1));endif (nargin > 4) cmap = varargin{5};end%get and check array sizem = size(im,1);n = size(im,2);if m==0 || n==0 error('Degenerate array.')end%display the image figure('Position',[xpos ypos sf*size(im,2) sf*size(im,1)]); image(im); colormap(cmap)set(gca,'Position',[0 0 1 1])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -