Graphics |
Reading a Graphics Image
The function imread
reads an image from any supported graphics image file in any of the supported bit depths. Most of the images that you will read are 8-bit. When these are read into memory, MATLAB stores them as class uint8
. The main exception to this rule is that MATLAB supports 16-bit data for PNG and TIFF images. If you read a 16-bit PNG or TIFF image, it is stored as class uint16
.
Note
For indexed images, imread always reads the colormap into an array of
class double , even though the image array itself can be of class uint8 or
uint16 .
|
The following statement reads the image ngc6543a.jpg
into the workspace variable RGB
and then displays the image using the image
function.
You can write (save) image data using the imwrite
function. The statements
create a BMP file containing the clown image.
Reading, Writing, and Querying Graphics Image Files | Writing a Graphics Image |
© 1994-2005 The MathWorks, Inc.