Illustration of Image processing:
This displays that there are 64 rows, or in another word, 64 colors, in this specific colormap. It also displays that the first five colors are shades of blue.
The format of calling the image function is as shown below:
here the matrix mat is a matrix which represents the colors in an m × n image. When the matrix has the size m × n, then each and every element is an index into the present colormap.
The one way to show the colors in the jet colormap (that has 64 colors) is to generate a matrix which stores the values 1 through 64, and pass that to the image function, as shown in figure.
Whenever the matrix is passed to the image function, then the value in each element in matrix is used as an index into the colormap. For illustration, the value in cmap(1,2) is 9, therefore the color displayed in position(1,2) in the image will be the color presented by the ninth row in the colormap. By using numbers 1 through 64, we can see all colors in this colormap.
>> cmap = reshape(1:64, 8,8)
This represents that the first colors are shades of blue, the end colors are shades of red, and in between there are shades of aqua, green, yellow, & orange.