J = im2uint8(I)
converts the grayscale, RGB, or binary image I to
uint8, rescaling or offsetting the data as
necessary.
If the input image is of data type uint8, then the output
image is identical. If the input image is of data type
logical, then im2uint8 changes
true-valued elements to 255.
Input image, specified as a numeric array or logical array of any size and
dimension.
If I is a grayscale or RGB image, then it can
be of data type uint8, uint16,
int16, double,
single, or logical.
The
im2uint8 function expects images of data type
double and single to have values in the range [0, 1].
If I has values outside the range [0, 1], then you can rescale values to
the expected range by using the rescale
function.
If I is an indexed image, then it can be of
data type uint8, uint16,
double, or logical. If the
indexed image is of data type double, then the
maximum value must be 256 or less. If the indexed image is of data
type uint16, then the maximum value must be 255
or less.
If I is a binary image, then it must be
logical.
Data Types: single | double | int16 | uint8 | uint16 | logical
im2uint8 supports the generation of C
code (requires MATLAB®
Coder™). Note that if you choose the generic MATLAB Host Computer
target platform, im2uint8 generates code that uses a precompiled,
platform-specific shared library. Use of a shared library preserves performance optimizations
but limits the target platforms for which code can be generated. For more information, see Types of Code Generation Support in Image Processing Toolbox.
GPU Code Generation Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.