Adjust Contrast tool
hfigure = imcontrast(...)
imcontrast creates an Adjust
Contrast tool in a separate figure that is associated with the grayscale
image in the current figure, called the target image. The Adjust Contrast
tool is an interactive contrast and brightness adjustment tool, shown
in the following figure, that you can use to adjust the black-to-white
mapping used to display the image. When you use the tool,
the contrast of the displayed image by modifying the axes
To modify the actual pixel values in the target image, click the Adjust
Data button. (This button is unavailable until you make
a change to the contrast of the image.) For more information about
using the tool, see Tips.
The Adjust Contrast tool can handle grayscale images of class
imcontrast(h) creates the
Adjust Contrast tool associated with the image specified by the handle
be a handle to a figure, axes, uipanel, or image object. If
an axes or figure handle,
imcontrast uses the first
image returned by
hfigure = imcontrast(...) returns
a handle to the Adjust Contrast tool figure.
The Adjust Contrast tool presents a scaled histogram of pixel values (overly represented pixel values are truncated for clarity). Dragging on the left red bar in the histogram display changes the minimum value. The minimum value (and any value less than the minimum) displays as black. Dragging on the right red bar in the histogram changes the maximum value. The maximum value (and any value greater than the maximum) displays as white. Values in between the red bars display as intermediate shades of gray.
Together the minimum and maximum values create a "window". Stretching the window reduces contrast. Shrinking the window increases contrast. Changing the center of the window changes the brightness of the image. It is possible to manually enter the minimum, maximum, width, and center values for the window. Changing one value automatically updates the other values and the image.
For more information about using the Adjust Contrast tool, see Adjust Image Contrast In Image Viewer App.
Clicking and dragging the mouse within the target image interactively changes the image's window values. Dragging the mouse horizontally from left to right changes the window width (i.e., contrast). Dragging the mouse vertically up and down changes the window center (i.e., brightness). Holding down the Ctrl key before clicking and dragging the mouse accelerates the rate of change; holding down the Shift key before clicking and dragging the mouse slows the rate of change. Keys must be pressed before clicking and dragging.