Main Content

Get Pixel Information in Image Viewer App

TheImage Viewerapp 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 Viewerdisplays 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 Viewerupdates this information as you move the pointer over the image.

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

Image Type

Pixel Information

Example

Intensity

(X,Y) Intensity

(13,30) 82

Indexed

(X,Y) [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 withCDataMappingproperty set todirect

(X,Y) value [R G B]

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

The figure showsImage Viewerwith pixel location and grayscale pixel value displayed in the Pixel Information tool.

Note

You can also obtain pixel value information from a figure withimshowby using theimpixelinfofunction.

To save the pixel location and value information displayed, right-click a pixel in the image and choose theCopy pixel infooption.Image Viewercopies thex- andy-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 selectingPastefrom the context menu.

Determine Pixel Values in an Image Region

To view the values of pixels in a specific region of an image displayed inImage Viewer, use the Pixel Region tool. The Pixel Region tool superimposes a rectangle, called thepixel region rectangle, over the image displayed inImage Viewer. This rectangle defines the group of pixels that are displayed, in extreme close-up view, in the Pixel Region tool window.

The figure showsImage Viewerwith 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.

Note

You can also obtain pixel region information from a figure, such as displayed usingimshow, by using theimpixelregionfunction.

Select a Region

To start the Pixel Region tool, click thePixel Regionbuttonin theImage Viewertoolbar or select thePixel Regionoption from theToolsmenu.Image Viewerdisplays the pixel region rectanglein the center of the target image and opens the Pixel Region tool.

Note

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, seeDetermine 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 toolEditmenu and clear theSuperimpose Pixel Valuesoption.

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 thex- andy-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 theCopy Positionoption from the Pixel Region toolEditmenu. 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 selectPastefrom 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 thePrint to Figureoption from the Pixel Region toolFilemenu. SeePrint Imagesfor more information.

Determine Image Display Range in Image Viewer

Image Viewerprovides information about the display range of pixels in a grayscale image. The display range is the value of the axesCLim属性,该属性控制the mapping of imageCDatato the figure colormap.CLim是一个双元素向量[cmin cmax]specifying theCData值映射到第一个颜色colormap (cmin) and theCDatavalue to map to the last color in the colormap (cmax). Data values in between are linearly scaled.

For grayscale images,Image Viewerdisplays this information in the Display Range tool at the bottom right corner of the window.Image Viewerdoes not show the Display Range tool for indexed, truecolor, or binary images.

The figure shows an image with display range information inImage Viewer.

Note

You can also obtain the image display range from a figure, such as displayed usingimshow, by using theimdisplayrangefunction.

You can change the image contrast and brightness by adjusting the display range. For more information, seeAdjust Image Contrast in Image Viewer App.

See Also

|||

Related Topics