Main Content

impixelregionpanel

Pixel Region tool panel

Description

Use the impixelregionpanel function to add a Pixel Region tool to the same figure as an image. The Pixel Region tool is an aid to explore pixel values of images.

The Pixel Region tool displays an extreme close-up view of a small region of pixels in the target image. The tool overlays a rectangle, called the pixel region rectangle, over the target image. To view pixels in a different region, click and drag the rectangle over the target image, or scroll the Pixel Region tool. You can resize the pixel region rectangle to change the resolution of pixels in the Pixel Region tool. If the size of the pixels allows, the tool superimposes the numeric value of the pixel over each pixel.

hTool = impixelregionpanel(hParent,hImage) creates a Pixel Region tool that displays the pixel values of image hImage. The Pixel Region tool hTool is added to the parent figure or panel hParent.

example

Examples

collapse all

Display an image in a figure. This example displays the image in a subplot to create space in the figure window for the pixel region tool.

hFig = figure;
subplot(1,2,1)
hIm = imshow('peppers.png');

Figure contains an axes object. The hidden axes object contains an object of type image.

Create a pixel region tool in the same figure as the image. The pixel region tool covers the entire figure window.

hpanel = impixelregionpanel(hFig,hIm);

Figure contains 2 axes objects and another object of type uipanel. Hidden axes object 1 contains 101 objects of type line, image, text. Hidden axes object 2 contains 12 objects of type line, patch, image.

Reduce the dimensions of the pixel region tool to 40% of the height and width of the figure. Specify the position of the bottom left corner of the tool so that the tool occupies the space in the figure to the right of the image.

To explore pixel values across the image, try dragging and resizing the pixel region rectangle over the target image and scrolling the pixel region tool.

set(hpanel,'Position',[0.55 0.3 .4 .4])

Figure contains 2 axes objects and another object of type uipanel. Hidden axes object 1 contains 29 objects of type line, image, text. Hidden axes object 2 contains 12 objects of type line, patch, image.

Input Arguments

collapse all

Parent of the Pixel Region tool, specified as a Figure or Panel object.

Image, specified as an Image object.

Output Arguments

collapse all

Pixel Region tool, returned as a Panel object.

Tips

  • To create a Pixel Region tool in a separate figure window, use impixelregion.

Version History

Introduced before R2006a