开始使用图像查看器应用程序
TheImage Viewerapp presents an integrated environment for displaying images and performing common image processing tasks. The workflow for usingImage Viewertypically involves a combination of these steps:
The figure shows an image displayed inImage Viewerwith many of the related tools open and active.
Note
您也可以访问以外的单个工具Image Viewer应用程序。为此,请使用诸如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, seeInteractive Tool Workflow
Open Image Viewer App
There are three ways to open theImage Viewer应用程序。In each case, you can select an image from a variable in the workspace or specify the name of the image file.Image Viewercan open any file that can be read byimread
.
You can open theImage Viewerapp from the command line by using the
Imtool
功能。当您要控制初始图像显示的各个方面时,请使用此功能,例如初始放大倍率,colormap或显示范围。例如,此代码打开Image Viewer和loads the image with file namecameraman.tif
.imtool('cameraman.tif')
You can open theImage Viewerapp from the Apps tab, under Image Processing and Computer Vision. To bring image data intoImage Viewerfrom a file name, select
Open
from the文件菜单。将图像数据带入Image Viewer在工作区中,选择Import from Workspace
from the文件菜单。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 newImage Viewerfrom within an existingImage Viewerby using theNewoption from the文件菜单。
Note
When you specify a file name,Image Viewerdoes not save the image data in a workspace variable. However, you can export the image fromImage Viewerto the workspace. For more information, see保存和导出结果.
Navigate Image in Image Viewer App
打开后Image Viewer, the image appears in the app window.Image Viewerprovides 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 adetail rectanglethat indicates which portion of the image is currently visible inImage Viewer. 您可以在Image Viewerwindow 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 theSet Color上下文菜单上的选项。 To get the current position and size of the detail rectangle, right-click anywhere inside the rectangle and selectCopy Positionfrom 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 thePrint to Figureoption from the Overview tool文件菜单。See打印图像for more information. |
|
Magnify image | To enlarge or shrink an image by specifying a scale factor, use the放大选项Tools菜单。 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. Note You can also zoom by using theCtrl+Plus或者Ctrl+Minuskeys. These are thePlus(+)和Minus(-)keys on the numeric keypad of your keyboard. WhenImage Viewerscales 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 |
|
Pan image | To pan an image that is too large to fit in theImage Viewerwindow, use scroll bars or the Pan tool. |
|
Choose image colormap | To enhance the visibility of features in grayscale and indexed images, you can change the image colormap using the Colormap tool. You can select a MATLAB®colormap or a colormap variable from the workspace. You can also create a colormap by entering a MATLAB command. Image Viewerdoes not provide a color bar. To add a color bar, open the image in another figure window. For more information, see保存和导出结果. |
Get Information about Image Data
Image Viewerprovides 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确定图像查看器中的单个像素值. |
|
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, seeDetermine Image Display Range in Image Viewer. |
|
Pixel Region tool | Get information about a group of pixels. For more information, seeDetermine Pixel Values in an Image Region. |
|
Distance tool | Measure the Euclidean distance between two pixels. For more information, seeMeasure Distance Between Pixels in Image Viewer App |
|
Image Information tool | 获取有关图像和图像文件元数据的信息。 图像信息工具始终提供有关宽度,高度,数据类型和图像类型的基本信息。对于灰度和索引图像,此信息包括最小和最大强度值。 If you select an image to open inImage Viewerby specifying a file name, then the Image Information tool also displays image metadata. This metadata is the same information returned by the |
Modify Image Data
Image Viewerprovides tools that can help you adjust the image contrast and crop an image.
默认情况下,当您关闭时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保存和导出结果.
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, seeAdjust Image Contrast in Image Viewer App. | |
窗口/等级工具 | Adjust the contrast of an image by interacting with the image. For more information, seeAdjust Image Contrast in Image Viewer App. | |
Crop Image tool | Crop an image to a rectangular region of interest. For more information, seeCrop Image Using Image Viewer App. |
保存和导出结果
Image Viewerenables 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 theimcontrast
功能。
目的地 | Procedure |
---|---|
Create workspace variable | There are three ways to create a workspace variable from the image data inImage Viewer.
|
Save to file | Use the Save Image tool by selecting theSave as选项Image Viewer文件菜单。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 thePrint to Figureoption from the文件菜单。您可以使用此图形窗口查看颜色栏并打印图像。有关更多信息,请参阅Add Color Bar to Displayed Grayscale Image和打印图像. |