

That means it has RGB value of the 9th row of the map: 0.6000 0.6000 0.6000. Let's check the pixel at (128, 128) and see what index the pixel has: It's 16 rows of RGB and each row corresponds to the index stored in the indexed image X which has the same dimension ($256 \times 256$) as the input. Looks like the map has 16 RGB values as we specified in the command. I read it in and converted to indexed image The rgb2gray() converts RGB images to grayscale by eliminating the hue and saturation information while retaining the luminance. So, I converted it to real-grayscale using rgb2gray() which converts the truecolor image RGB to the grayscale intensity image. The values for the intensity seem reasonable because all three components have almost identical values. The grayscale image supposed to have $845 \times 915$ without 3 which indicates RGB. When I try to check the pixel value (intensity) using size():

I got this off the Web and loaded the image into Matlab: If it's uint8, the range that Matlab interprets is, and so on. Note that the value range depends on the data type class: for example, the $$ is for double data type.

For example, if the 19th color is magenta $cmap(19,:) = $, then $img(m,n) = 19$ is a magenta-colored pixel. The colormap holds all colors used in the image and the index matrix represents the pixels by referring to colors in the colormap.
