Main Content

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.

Grayscale image of the moon, with pixel info displayed for the pixel with location (181, 223) and intensity value 213

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.

Grayscale image of the moon, with the imported and adjusted pixel value for the pixel located at (181, 223)

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 DisplayRange name-value argument of the imageViewer function or in the app, Image Viewer displays the original pixel value and the adjusted pixel value.

Indexed

Numeric scalar representing an index into a colormap.

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.

Binary

Logical scalar (true or false).

Truecolor (RGB)

Three-element vector [R G B] in which each element specifies the intensity of a color channel.

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.

  1. 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.

  2. Select Show Pixel Values.

  3. 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 Pan button 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.

Grayscale image of the moon with the Pixel Region tool active and displaying pixel values for a region of the moon image.

The format of the pixel values depends on the image type.

Image Type

Value Description

Intensity (grayscale)

Numeric scalar I, representing the pixel intensity.

If you adjust the image contrast, the app displays the original imported value I and the adjusted value Adj.

Indexed

Numeric scalar I, representing an index into a color map.

If you adjust the image contrast, the app displays the original imported value I and the adjusted value Adj.

Binary

Logical scalar I, which is either true or false.

Truecolor (RGB)

Three values, R, G, and B, for the three color channels.

Note

You can also obtain pixel region information from a figure created by imshow by using the impixelregion function.

See Also

| |

Related Topics