figure
is not required, imshow
just displays img
on it. If a figure
hadn't been opened, imshow
would've created a new one.
The colormap
colors the intensities of the image. The hot
map colors values in increasing intensity with black, red, yellow, and white-hot. Another popular colormap is jet
which has a number of interesting colors.
False colors
So the matrix you want to see has intensities which can have any range of values. For better visualization, the intensities are displayed in a range of colors or a set of false colors. Normally, a grayscale image will display an image is shades of grey, where white is maximum and black is minimum. False color is an extension of that concept with several colors in between (like jet
) and an effect of metal being heated in hot
.
Colormap at the pixel level
Suppose you have a matrix with pixel values ranging from [cmin xmax]
. Now, normalize the values so that the range is [0,1]. Also, suppose you have a color map, such that a range of colors are mapped to some values from 0 to 1 (e.g. 0.5 is mapped to RGB(100,200,100))- then you get the false color mapping by finding the closest intensity in the map and display the corresponding color.
More on colormap in the MATLAB documentation. I've included some picture from that link here:
Jet
Bone