Documentation

impixelinfo

Pixel Information tool

Syntax

impixelinfo
impixelinfo(h)
impixelinfo(hparent,himage)
hpanel = impixelinfo(...)

Description

impixelinfo creates a Pixel Information tool in the current figure. The Pixel Information tool displays information about the pixel in an image that the pointer is positioned over. The tool can display pixel information for all the images in a figure.

The Pixel Information tool is a uipanel object, positioned in the lower-left corner of the figure. The tool contains the text string Pixel info: followed by the pixel information. Before you move the pointer over the image, the tool contains the default pixel information text string (X,Y) Pixel Value. Once you move the pointer over the image, the information displayed varies by image type, as shown in the following table. If you move the pointer off the image, the pixel information tool displays the default pixel information string for that image type.

Image Type

Pixel Information

Example

Intensity

(X,Y) Intensity

(13,30) 82

Indexed

(X,Y) <index> [R G B]

(2,6) <4> [0.29 0.05 0.32]

Binary

(X,Y) BW

(12,1) 0

Truecolor

(X,Y) [R G B]

(19,10) [15 255 10]

Floating point image with CDataMapping property set to direct

(X,Y) value <index> [R G B]

(19,10) 82 <4> [15 255 10]

For example, for grayscale (intensity) images, the pixel information tool displays the x and y coordinates of the pixel and its value, as shown in the following figure.

If you want to display the pixel information without the "Pixel Info" label, use the impixelinfoval function.

impixelinfo(h) creates a Pixel Information tool in the figure specified by h, where h is a handle to an image, axes, uipanel, or figure object. Axes, uipanel, or figure objects must contain at least one image object.

impixelinfo(hparent,himage) creates a Pixel Information tool in hparent that provides information about the pixels in himage. himage is a handle to an image or an array of image handles. hparent is a handle to the figure or uipanel object that contains the pixel information tool.

hpanel = impixelinfo(...) returns a handle to the Pixel Information tool uipanel.

Note

To copy the pixel information string to the clipboard, right-click while the pointer is positioned over a pixel. In the context menu displayed, choose Copy pixel info.

Examples

Display an image and add a Pixel Information tool to the figure. The example shows how you can change the position of the tool in the figure using properties of the tool uipanel object.

h = imshow('hestain.png');
hp = impixelinfo;
set(hp,'Position',[5 1 300 20]);

Use the Pixel Information tool in a figure containing multiple images of different types.

figure
subplot(1,2,1), imshow('liftingbody.png');
subplot(1,2,2), imshow('autumn.tif');
impixelinfo;
Was this topic helpful?