Open Image Viewer app
The Image Viewer presents an integrated environment for displaying images and performing common image processing tasks.
The Image Viewer provides all the image display capabilities of
imshow, which optimizes figure, axes, and image object property settings
for image display. The Image Viewer also provides access to several tools for navigating
and exploring images, such as the Pixel Region tool, Image Information tool, and the
Adjust Contrast tool.
imtool opens the Image Viewer app in an empty state. Use the
File menu options Open or Import from Workspace to
choose an image for display.
imtool( displays the grayscale image
I in the Image Viewer, using the default display range of
the image data type.
displays the grayscale image
I in the Image Viewer, specifying
the display range as
range. Pixel values outside the display
range are clipped to black or white. Pixel values within the display range are
displayed as intermediate shades of gray. The Image Viewer uses the default number
of gray levels.
imtool( displays the truecolor image
RGB in the Image Viewer.
imtool( displays the binary image
BW in the Image Viewer. Pixel values of
0 display as black; pixel values of
display as white.
imtool( displays the image
contained in the graphics file
filename in the Image
displays the image, specifying parameters and corresponding values that control
various aspects of the image display.
hfigure = imtool(___)
hfigure, a handle to the figure created by the Image
imtool close all closes all open Image Viewers.
Display a color image from a file.
Display an indexed image.
[X,map] = imread('trees.tif'); imtool(X,map)
Display a grayscale image.
I = imread('cameraman.tif'); imtool(I)
Display a grayscale image, adjusting the display range.
h = imtool(I,[0 80]); close(h)
I— 2-D grayscale image
2-D grayscale image, specified as an m-by-n numeric matrix.
range— Display range
Display range of the grayscale image
I, specified as
one of these values.
Image Viewer displays pixels with the value
Image Viewer automatically sets the display range to
RGB— 2-D RGB image
2-D RGB image, specified as an m-by-n-by-3 numeric matrix.
BW— 2-D binary image
2-D binary image, specified as an m-by-n logical matrix.
X— 2-D indexed image
2-D indexed image, specified as an m-by-n numeric matrix.
cmap— Color map
Color map associated with indexed image
as a c-by-3 numeric matrix containing the RGB values of
filename— File name
File name of the graphics file containing the image, specified as a
character vector. The file must contain an image that can be read by
dicomread or a reduced
resolution dataset (R-Set) created by
rsetwrite. If the file
contains multiple images, the first one is displayed. The file must be in
the current directory or on the MATLAB® path.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
imtool(I,'Colormap',jet)displays the grayscale image
'Colormap'— Color map
'DisplayRange'— Display range
Display range, specified as the comma-separated pair consisting of
'DisplayRange' and a 2-element vector of the form
Including the parameter name is optional, except when the
image is specified by a filename. The syntax
imtool(I,[low high]) is equivalent to
'DisplayRange' parameter must be
specified when calling
imtool with a
filename, as in the syntax
'InitialMagnification'— Initial magnification
'fit'| numeric scalar
Initial magnification, specified as the comma-separated pair
'InitialMagnification' and one of these
|The entire image is visible on initial display. If the image is too large to display on the screen, the Image Viewer displays the image at the largest magnification that fits on the screen.|
The Image Viewer scales the entire image to fit in the window.
The Image Viewer scales the entire image as a percentage of the original image size. For example, if you specify 100, the Image Viewer displays the image at 100% magnification (one screen pixel for each image pixel).
When the image aspect ratio is such that less than one pixel would be displayed in either dimension at the requested magnification, the Image Viewer issues a warning and displays the image at 100%.
By default, the initial magnification parameter is set to the value
'Interpolation'— Interpolation technique
Interpolation technique used when scaling an image, specified as the
comma-separated pair consisting of
and one of the following values.
|Nearest neighbor interpolation (default)|
hfigure— Handle to Image Viewer
Handle to Image Viewer figure, returned as a handle.
To view very large TIFF or NITF images that will not fit into memory, you can use
rsetwrite to create a reduced
resolution dataset (R-Set) viewable in the Image Viewer. R-Sets can also improve
performance of the Image Viewer for large images that fit in memory.
The following tools can be used with an R-Set: Overview, Zoom, Pan, Image Information, and Distance. Other tools, however, will not work with an R-Set. You cannot use the Pixel Region, Adjust Contrast, Crop Image, and Window/Level tools. Please note that the Pixel Information tool displays only the x and y coordinates of a pixel and not the associated intensity, index, or RGB values.
You can use the Image Processing Preferences dialog box to set toolbox preferences
that modify the behavior of the Image Viewer. To access the dialog, select File > Preferences in the MATLAB desktop or Image Viewer menu. You can also set preferences
Controls the initial magnification for image display. To
override this toolbox preference, specify the
Controls whether the Overview tool opens automatically when you open an image using the Image Viewer. Possible values:
For more information about these preferences, see
The 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 the Pixel Region tool, Image
Information tool, and the Adjust Contrast tool. The Image Viewer presents an
integrated environment for displaying images and performing some common image
For grayscale images having integer types, the default display range is
For grayscale images of class
double, the default display range is
1]. If the data range of a
double image is much larger or smaller than the default
display range, you might need to experiment with setting the display range to
see features in the image that would not be visible using the default display
You can access the Image Viewer through the Apps tab. Navigate to the Image Processing and Computer Vision group and select Image Viewer.
You can close a specific Image Viewer specified by the handle
hfigure, by using the command