getrangefromclass
Default display range of image based on its class
Description
Examples
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
Input image, specified as a numeric array or logical array.
Output Arguments
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™.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
The getrangefromclass
function
fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray
(Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a
MATLAB Command
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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)