| Graphics |    | 
8-Bit and 16-Bit Indexed Images
If the class of X is uint8 or uint16, its values are offset by 1 before being used as colormap indices. The value 0 points to the first row of the colormap, the value 1 points to the second row, and so on. The image command automatically supplies the proper offset, so the display method is the same whether X is double, uint8, or uint16.
The colormap index offset for uint8 and uint16 data is intended to support standard graphics file formats, which typically store image data in indexed form with a 256-entry colormap. The offset allows you to manipulate and display images of this form in MATLAB using the more memory-efficient uint8 and uint16 arrays.
Because of the offset, you must add 1 to convert a uint8 or uint16 indexed image to double. For example,
Conversely, subtract 1 to convert a double indexed image to uint8 or uint16.
|   | Working with 8-Bit and 16-Bit Images | 8-Bit and 16-Bit Intensity Images |  | 
© 1994-2005 The MathWorks, Inc.