Get Pixel Information in Image Viewer App
The Image Viewer app enables you to see the pixel values and coordinates of individual pixels and groups of pixels.
Determine Individual Pixel Values in Image Viewer
Image Viewer shows the xy-location and value of an individual pixel from the image in the bottom-left corner of the main display pane. The displayed information corresponds to the pixel that is currently under the pointer. Image Viewer updates this information as you move the pointer over the image.
This figure shows Image Viewer displaying the location and value for a grayscale image pixel.
Note
You can also obtain pixel value information from a figure created by
imshow
by using the impixelinfo
function.
For grayscale and indexed images, if you adjust the contrast using the
DisplayRange
name-value argument of the
imageViewer
function or in the app, Image
Viewer displays the original pixel value and the adjusted pixel value. For more
details about contrast adjustment, see Adjust Image Contrast in Image Viewer App.
This figure shows Image Viewer displaying the location, the original imported value, and the contrast-adjusted value for a grayscale image pixel.
The format of the pixel value depends on the image type.
Image Type | Value Description |
---|---|
Intensity (grayscale) | Numeric scalar representing the pixel intensity. If you
adjust the contrast using the |
Indexed | Numeric scalar representing an index into a colormap. If you
adjust the contrast using the |
Binary | Logical scalar ( |
Truecolor (RGB) | Three-element vector |
View Pixel Values in Image Region
When you zoom in far enough on an image, you can view the pixel values overlaid on the image.
On the Viewer tab of the app toolstrip, in the Zoom section, open the drop-down and select
Zoom To Pixels
. The app automatically zooms in until the individual pixels of the image are visible.Select Show Pixel Values.
Set Interpolation Method to
nearest
to view the image data as a grid of pixel elements that correspond to the value labels.
To locate the magnified pixels in the overall image, open the Overview pane by, on the Viewer tab of the app toolstrip, selecting Image Overview. The Overview pane displays the entire image with a rectangle indicating which part of the image is visible in the main display. You can pan the main display by dragging the rectangle in the Overview pane, or by selecting Pan in the top-right corner of the main display pane and dragging the image in the main display pane. The pixel values update as you pan the image.
This figure shows Image Viewer with pixel values visible in the main display pane, and the Overview pane indicating the currently displayed part of the image.
The format of the pixel values depends on the image type.
Image Type | Value Description |
---|---|
Intensity (grayscale) | Numeric scalar If you adjust the image contrast, the app displays the
original imported value |
Indexed | Numeric scalar If you adjust the image contrast, the app displays the original
imported value |
Binary | Logical scalar |
Truecolor (RGB) | Three values, |
Note
You can also obtain pixel region information from a figure created by
imshow
by using the impixelregion
function.
See Also
Image Viewer | impixelregion
| impixelinfo