scaleimage.m

来自「matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译」· M 代码 · 共 42 行

M
42
字号
function imgsc = scaleimage(img, range)%SCALEIMAGE Scale the image to a specified z-range.%%	I = SCALEIMAGE(IMG, ZRANGE)%%	SCALEIMAGE scale the image IMG using the ZRANGE%	information and the global variable MAPSIZE that%	define the colormap size. If zrange is omitted the%	image is scale to the min and max values.%%       See also IMAGESC.%%       Claudio 25 Feb. 1995.%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu%global MapSize;if nargin ==1   range=[min(min(img)) max(max(img))];endif isempty(range)  range=[min(min(img)) max(max(img))];endimin = range(1);imax = range(2);if (imax-imin)==0  imin=0;  imax=imin+1e-12;endimgsc = min(MapSize,round((MapSize-1)*(img-imin)/(imax-imin))+1);return

⌨️ 快捷键说明

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