Main Content


Pixel Region tool panel


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.


hpanel = impixelregionpanel(hparent,himage) creates a Pixel Region tool in a figure window. himage is a handle to the target image whose pixels are to be displayed. hparent is the handle to the figure or uipanel object that will contain the Pixel Region tool. hpanel is the handle to the Pixel Region tool.


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;
hIm = imshow('peppers.png');

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);

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])

Input Arguments

collapse all

Handle to a figure or uipanel object that will contain the Pixel Region tool, specified as a handle.

Handle to target image, specified as a handle.

Output Arguments

collapse all

Handle to Pixel Region tool, returned as a handle. A Pixel Region tool is a type of uipanel object.


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

Introduced before R2006a