Convert indexed image to RGB image
RGB = ind2rgb(X,map)
RGB = ind2rgb(X,map) converts the indexed image, X, and the corresponding colormap, map, to the truecolor image, RGB. The indexed image, X, is an m-by-n array of integers. The colormap, map, is a three-column array of values in the range [0,1]. Each row of map is a three-element RGB triplet that specifies the red, green, and blue components of a single color of the colormap.
If you specify X as an array of class unit8 or uint16, then the value 0 corresponds to the first color in the colormap.
If you specify X as an array of class single or double, then the value 1 corresponds to the first color in the colormap.
The truecolor image output, RGB, is an m-by-n-by-3 array. For more information on image types, see Image Types.