Image Display and Exploration Overview

The Image Processing Toolbox™ software includes two display functions, imshow and imtool. Both functions work within the graphics architecture: they create an image object and display it in an axes object contained in a figure object.

imshow is the fundamental image display function. Use imshow when you want to display any of the different image types supported by the toolbox, such as grayscale (intensity), truecolor (RGB), binary, and indexed. For more information, see Display an Image in Figure Window. The imshow function is also a key building block for image applications you can create using the toolbox modular tools. For more information, see Build Interactive Tools.

The other toolbox display function, imtool, opens the Image Viewer app, which presents an integrated environment for displaying images and performing some common image processing tasks. Image Viewer provides all the image display capabilities of imshow but also provides access to several other tools for navigating and exploring images, such as scroll bars, the Pixel Region tool, the Image Information tool, and the Adjust Contrast tool. For more information, see Get Started with Image Viewer App.

In general, using the toolbox functions to display images is preferable to using MATLAB® image display functions image and imagesc because the toolbox functions set certain graphics object properties automatically to optimize the image display. The following table lists these properties and their settings for each image type. In the table, X represents an indexed image, I represents a grayscale image, BW represents a binary image, and RGB represents a truecolor image.

Note

Both imshow and imtool can perform automatic scaling of image data. When called with the syntax imshow(I,'DisplayRange',[]), and similarly for imtool, the functions set the axes CLim property to [min(I(:)) max(I(:))]. CDataMapping is always scaled for grayscale images, so that the value min(I(:)) is displayed using the first color map color, and the value max(I(:)) is displayed using the last color map color.

Property

Indexed Images

Grayscale Images

Binary Images

Truecolor Images

CData (Image)

Set to the data in X

Set to the data in I

Set to data in BW

Set to data in RGB

CDataMapping (Image)

Set to 'direct'

Set to 'scaled'

Set to 'direct'

Ignored when CData is 3-D

CLim (Axes)

Does not apply

double: [0 1]
uint8
:  [0 255]
uint16
[0 65535]

Set to [0 1]

Ignored when CData is 3-D

Colormap (Figure)

Set to data in map

Set to grayscale color map

Set to a grayscale color map whose values range from black to white

Ignored when CData is 3-D