MATLAB 帮助中心
基于所属类的图像的默认显示范围
range = getrangefromclass(I)
range = getrangefromclass(I) 根据图像 I 所属的类类型返回该图像的默认显示范围。
range
I
示例
全部折叠
读取数据类型为 uint8 的一个示例图像。
uint8
Im = imread('peppers.png'); imshow(Im)
从该图像中获取显示范围。uint8 类型的图像的像素值在 [0, 255] 范围内。
rangeIm = getrangefromclass(Im)
rangeIm = 1×2 0 255
将图像从 uint8 类型转换为 double 类型。
double
RGB = im2double(Im);
获取新图像的显示范围。像素值在 [0, 1] 范围内,这与 MATLAB® 软件解释 double 类型的图像的方式一致。
rangeRGB = getrangefromclass(RGB)
rangeRGB = 1×2 0 1
输入图像,指定为数值数组或逻辑数组。
显示范围,以 [min max] 形式的二元素数值向量形式返回。
[min max]
对于 single 和 double 数据,getrangefromclass 返回的范围 [0 1] 与 MATLAB® 软件解释 double 和 single 类型图像的方式一致。
single
getrangefromclass
[0 1]
对于整数数据,getrangefromclass 返回该整数类的最小和最大可表示值。例如,如果类为 uint8,则动态范围为 [0 255]。
[0 255]
对于 logical 数据,getrangefromclass 返回范围 [0 1]。
logical
数据类型: double
全部展开
backgroundPool
ThreadPool
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
getrangefromclass 函数完全支持 GPU 数组。要在 GPU 上运行该函数,请将输入数据指定为 gpuArray (Parallel Computing Toolbox)。有关详细信息,请参阅在 GPU 上运行 MATLAB 函数 (Parallel Computing Toolbox)。
gpuArray
在 R2006a 之前推出
intmin | intmax
intmin
intmax
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处