The Image Viewer app presents an integrated environment for displaying images and performing common image processing tasks. The workflow for using Image Viewer typically involves a combination of these steps:
The figure shows an image displayed in Image Viewer with many of the related tools open and active.
You can also access individual tools outside the Image Viewer app. To do so,
display an image in a figure window using a function such as
imshow, then create one or more tools using toolbox functions. For example,
you can build an image processing app with custom layout and behavior using a combination of
individual tools. For more information, see Interactive Tool Workflow
There are three ways to open the Image Viewer app. In each case, you can
select an image from a variable in the workspace or specify the name of the image file.
Image Viewer can open any file that can be read by
You can open the Image Viewer app from the command line by using the
imtool function. Use this function when
you want to control various aspects of the initial image display, such as the initial
magnification, color map, or display range. For example, this code opens Image
Viewer and loads the image with file name
You can open the Image Viewer app from the Apps tab, under Image
Processing and Computer Vision. To bring image data into Image Viewer from a
file name, select
Open from the
File menu. To bring image data into Image Viewer
from the workspace, select
Import from Workspace from the
File menu. Optionally filter the variables in the workspace
to show only images of a desired type, such as binary, indexed, intensity (grayscale),
or truecolor (RGB) images.
You can start a new Image Viewer from within an existing Image Viewer by using the New option from the File menu.
When you specify a file name, Image Viewer does not save the image data in a workspace variable. However, you can export the image from Image Viewer to the workspace. For more information, see Save and Export Results.
After you open Image Viewer, the image appears in the app window. Image Viewer provides navigation aids and tools that can help you explore images in detail.
|Action||Tools and Navigation Aids||Depiction of Tool|
|See image overview|
To see what portion of the image is currently visible when the image is magnified, use the Overview tool. The Overview tool displays the entire image, scaled to fit. Superimposed over this view of the image is a detail rectangle that indicates which portion of the image is currently visible in Image Viewer.
You can pan and zoom the image visible in the Image Viewer window by moving and resizing the detail rectangle in the Overview tool.
To achieve better contrast of the detail rectangle against the underlying image, you can change the color of rectangle. Right-click anywhere inside the rectangle and select a color from the Set Color option on the context menu.
get the current position and size of the detail rectangle, right-click anywhere
inside the rectangle and select Copy Position from the
context menu. The tool copies the position as a four-element vector of the form
To print the view of the image displayed in the Overview tool, select the Print to Figure option from the Overview tool File menu. See Print Images for more information.
To enlarge or shrink an image by specifying a scale factor, use the Magnification option on the Tools menu.
To enlarge or shrink an image by clicking the image, use the Zoom tool. The tool centers the new view of the image on the spot where you clicked.
You can also zoom by using the Ctrl+Plus or Ctrl+Minus keys. These are the Plus(+) and Minus(-) keys on the numeric keypad of your keyboard.
When Image Viewer scales an image, it uses interpolation to
determine the values for screen pixels that do not directly correspond to elements
in the image matrix. For more information about interpolation methods used for
resizing images, see
To pan an image that is too large to fit in the Image Viewer window, use scroll bars or the Pan tool.
|Choose image color map|
To enhance the visibility of features in grayscale and indexed images, you can change the image color map using the Colormap tool. You can select a MATLAB® color map or a color map variable from the workspace. You can also create a color map by entering a MATLAB command.
Image Viewer does not provide a color bar. To add a color bar, open the image in another figure window. For more information, see Save and Export Results.
Image Viewer provides tools that can help you get information about pixel values and other aspects of the image data.
|Tool||Description||Depiction of Tool|
|Pixel Information tool|
Get the (x, y) coordinates and the value of a single pixel under the pointer. For more information, see Determine Individual Pixel Values in Image Viewer.
|Display Range tool|
Determine the display range of grayscale image data. The tool is not enabled for RGB, indexed, or binary images. For more information, see Determine Image Display Range in Image Viewer.
|Pixel Region tool|
Get information about a group of pixels. For more information, see Determine Pixel Values in an Image Region.
Measure the Euclidean distance between two pixels. For more information, see Measure Distance Between Pixels in Image Viewer App
|Image Information tool|
Get information about image and image file metadata.
The Image Information tool always provides basic information about the width, height, class, and image type. For grayscale and indexed images, this information includes the minimum and maximum intensity values.
If you select an
image to open in Image Viewer by specifying a file name, then the Image
Information tool also displays image metadata. This metadata is the same
information returned by the
Image Viewer provides tools that can help you adjust the image contrast and crop an image.
By default, when you close Image Viewer, the app does not save the modified image data. However, you can export the modified image to a file or save the modified data in a workspace variable. For more information, see Save and Export Results.
|Tool||Description||Depiction of Tool|
|Adjust Contrast tool||Adjust the contrast of an image by setting a window over a histogram of pixel values. For more information, see Adjust Image Contrast in Image Viewer App.|
|Window/Level tool||Adjust the contrast of an image by interacting with the image. For more information, see Adjust Image Contrast in Image Viewer App.|
|Crop Image tool||Crop an image to a rectangular region of interest. For more information, see Crop Image Using Image Viewer App.|
Image Viewer enables you to export image data to the workspace, save the
image data to file, and open images in a new figure window. When saving and exporting image
data, changes to the display range are not preserved. If you would like to preserve your
changes, then use the
|Create workspace variable|
There are three ways to create a workspace variable from the image data in Image Viewer.
|Save to file|
Use the Save Image tool by selecting the Save as option on the Image Viewer File menu. This tool enables you to navigate your file system to determine where to save the file, specify the file name, and choose the file format.
|Open new figure window|
Select the Print to Figure option from the File menu. You can use this figure window to see a color bar and print the image. For more information, see Add Color Bar to Displayed Grayscale Image and Print Images.