getrangefromclass
Default display range of image based on its class
Description
Examples
Get Default Display Range of Image
Read a sample image of data type uint8
.
Im = imread('peppers.png');
imshow(Im)
Get the display range from the image. Images of type uint8
have pixel values in the range [0, 255].
rangeIm = getrangefromclass(Im)
rangeIm = 1×2
0 255
Convert the image from type uint8
to type double
.
RGB = im2double(Im);
Get the display range of the new image. The pixel values are in the range [0, 1], which is consistent with how the MATLAB® software interprets images of type double
.
rangeRGB = getrangefromclass(RGB)
rangeRGB = 1×2
0 1
Input Arguments
I
— Input image
numeric array | logical array
Input image, specified as a numeric array or logical array.
Output Arguments
range
— Display range
2-element numeric vector
Display range, returned as a 2-element numeric vector of the form
[min max]
.
For
single
anddouble
data,getrangefromclass
returns the range[0 1]
to be consistent with the way MATLAB® software interprets images of typedouble
andsingle
.For integer data,
getrangefromclass
returns the minimum and maximum representable values for that integer class. For example, if the class isuint8
, the dynamic range is[0 255]
.For
logical
data,getrangefromclass
returns the range[0 1]
.
Data Types: double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced before R2006a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)