Get Pixel Information in Image Viewer App
The Image Viewer app provides tools that enable you to see the pixel values and coordinates of individual pixels and groups of pixels. You can save the pixel location and value information.
Determine Individual Pixel Values in Image Viewer
Image Viewer displays information about the location and value of individual pixels in an image in the bottom left corner of the tool. The pixel value and location information represent the pixel under the current location of the pointer. Image Viewer updates this information as you move the pointer over the image.
The format of the pixel information depends on the image type.
(X,Y) <index> [R G B]
(2,6) <4> [0.29 0.05 0.32]
(X,Y) [R G B]
(19,10) [15 255 10]
Floating point image with
(X,Y) value <index> [R G B]
(19,10) 82 <4> [15 255 10]
The figure shows Image Viewer with pixel location and grayscale pixel value displayed in the Pixel Information tool.
You can also obtain pixel value information from a figure with
imshow by using the
To save the pixel location and value information displayed, right-click a pixel in the image and choose the Copy pixel info option. Image Viewer copies the x- and y-coordinates and the pixel value to the clipboard. You can paste this pixel information into the MATLAB® workspace or another application by right-clicking and selecting Paste from the context menu.
Determine Pixel Values in an Image Region
To view the values of pixels in a specific region of an image displayed in Image Viewer, use the Pixel Region tool. The Pixel Region tool superimposes a rectangle, called the pixel region rectangle, over the image displayed in Image Viewer. This rectangle defines the group of pixels that are displayed, in extreme close-up view, in the Pixel Region tool window.
The figure shows Image Viewer with the Pixel Region tool. Note how the Pixel Region tool includes its own Pixel Information tool in the display.
The following sections provide more information about using the Pixel Region tool.
You can also obtain pixel region information from a figure, such as displayed using
imshow, by using the
Select a Region
To start the Pixel Region tool, click the Pixel Region button in the Image Viewer toolbar or select the Pixel Region option from the Tools menu. Image Viewer displays the pixel region rectangle in the center of the target image and opens the Pixel Region tool.
Scrolling the image can move the pixel region rectangle off the part of the image that is currently displayed. To bring the pixel region rectangle back to the center of the part of the image that is currently visible, click the Pixel Region button again. For help finding the Pixel Region tool in large images, see Determine the Location of the Pixel Region Rectangle.
Using the mouse, position the pointer over the pixel region rectangle. The pointer changes to the fleur shape,.
Click the left mouse button and drag the pixel region rectangle to any part of the image. As you move the pixel region rectangle over the image, the Pixel Region tool updates the pixel values displayed. You can also move the pixel region rectangle by moving the scroll bars in the Pixel Region tool window.
Customize the View
To get a closer view of image pixels, use the zoom buttons on the Pixel Region tool toolbar. As you zoom in, the size of the pixels displayed in the Pixel Region tool increase and fewer pixels are visible. As you zoom out, the size of the pixels in the Pixel Region tool decrease and more pixels are visible. To change the number of pixels displayed in the tool, without changing the magnification, resize the Pixel Region tool using the mouse.
As you zoom in or out, note how the size of the pixel region rectangle changes according to the magnification. You can resize the pixel region rectangle using the mouse. Resizing the pixel region rectangle changes the magnification of pixels displayed in the Pixel Region tool.
If the magnification allows, the Pixel Region tool overlays each pixel with its numeric value. For RGB images, this information includes three numeric values, one for each band of the image. For indexed images, this information includes the index value and the associated RGB value. If you would rather not see the numeric values in the display, go to the Pixel Region tool Edit menu and clear the Superimpose Pixel Values option.
Determine the Location of the Pixel Region Rectangle
To determine the current location of the pixel region in the target image, you can use the pixel information given at the bottom of the tool. This information includes the x- and y-coordinates of pixels in the target image coordinate system. When you move the pixel region rectangle over the target image, the pixel information given at the bottom of the tool is not updated until you move the cursor back over the Pixel Region tool.
You can also retrieve the current position of the pixel region rectangle by selecting
the Copy Position option from the Pixel Region tool Edit menu. This option copies the position information to the
clipboard. The position information is a vector of the form
[xmin ymin width
height]. To paste this position vector into the MATLAB workspace or another application, right-click and select
Paste from the context menu.
The figure shows these components of the Pixel Region tool.
Print the View of the Image in the Pixel Region Tool
You can print the view of the image displayed in the Pixel Region tool. Select the Print to Figure option from the Pixel Region tool File menu. See Print Images for more information.
Determine Image Display Range in Image Viewer
Image Viewer provides information about the display range of pixels in a
grayscale image. The display range is the value of the axes
property, which controls the mapping of image
CData to the figure
CLim is a two-element vector
CData value to map to the first color in the colormap
cmin) and the
CData value to map to the last color
in the colormap (
cmax). Data values in between are linearly
For grayscale images, Image Viewer displays this information in the Display Range tool at the bottom right corner of the window. Image Viewer does not show the Display Range tool for indexed, truecolor, or binary images.
The figure shows an image with display range information in Image Viewer.
You can also obtain the image display range from a figure, such as displayed using
imshow, by using the
You can change the image contrast and brightness by adjusting the display range. For more information, see Adjust Image Contrast in Image Viewer App.
Image Viewer |