To display an image using a different colormap than the default one, you can use the colormap
function in Matlab. After reading in your image using the imread
function, you can display it using imshow
and then set the colormap using the colormap
function. Here's an example:
main.m321 chars13 lines
In the above example, we first read in an image and display it using the default colormap. Then, we display it again in a subplot with a different colormap (in this case, grayscale) using the colormap
function. Finally, we add a colorbar to the second subplot using the colorbar
function.
You can replace 'gray' in the above example with any other valid Matlab colormap name to display the image with a different colormap.
gistlibby LogSnag