12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

imageImage Typeindexed(colormap)truecolor(RGB)Double-precision Data(double array)Image is stored as a two-dimensional(m-by-n) array of integers in the range[1, length(colormap)]; colormap isan m-by-3 array of floating-pointvalues in the range [0, 1]Image is stored as a three-dimensional(m-by-n-by-3) array of floating-pointvalues in the range [0, 1]8-bit Data (uint8 array)16-bit Data (uint16 array)Image is stored as a two-dimensional(m-by-n) array of integers in the range[0, 255] (unit8) or [0, 65535](uint16); colormap is an m-by-3 arrayof floating-point values in the range[0, 1]Image is stored as athree-dimensional (m-by-n-by-3) arrayof integers in the range [0, 255](unit8) or [0, 65535] (uint16)Indexed ImagesIn an indexed image of class double, the value 1 points to the first row in thecolormap, the value 2 points to the second row, and so on. In a uint8 or uint16indexed image, there is an offset; the value 0 points to the first row in thecolormap, the value 1 points to the second row, and so on.If you want to convert a uint8 or uint16 indexed image to double, you need toadd 1 to the result. For example,orX64 = double(X8) + 1;X64 = double(X16) + 1;To convert from double to uint8 or unit16, you need to first subtract 1, andthen use round to ensure all the values are integers.orX8 = uint8(round(X64 – 1));X16 = uint16(round(X64 – 1));The order of the operations must be as shown in these examples, because youcannot perform mathematical operations on uint8 or uint16 arrays.2-230

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!