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.
Display range, returned as a 2-element numeric vector of the form
[min max].
For single and double
data, getrangefromclass returns the range
[0 1] to be consistent with the way
MATLAB® software interprets images of type
double and
single.
For integer data, getrangefromclass returns
the minimum and maximum representable values for that integer
class. For example, if the class is uint8,
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™.