imcontrast
Adjust Contrast tool
Description
Use the imcontrast
function to create an Adjust Contrast
tool. The Adjust Contrast tool enables you to interactively adjust the contrast and
brightness of a displayed grayscale image. For more information about using the tool,
see Tips.
Note
The Adjust Contrast tool adjusts the values of the pixels used to display the
image but does not change the actual image data. If you want to change the image
data, use the imadjust
function.
imcontrast
creates an Adjust Contrast tool in a separate
figure that is associated with the grayscale image in the current figure.
imcontrast(
creates an Adjust Contrast
tool associated with the image in the graphics container
h
)h
.
returns the figure hTool
= imcontrast(___)hTool
containing the Adjust Contrast
tool.
Examples
Input Arguments
Output Arguments
Tips
The Adjust Contrast tool displays a histogram of pixel values and information about the data range and display range.
The data range corresponds to the underlying pixel values of the image. The data range is a fixed property of the image data, and, by default, does not change when you adjust the display range using the Adjust Contrast tool.
The display range controls the display of the image. Any pixel with a value less than or equal to the minimum value of the display range displays as black. Any pixel with a value greater than or equal to the maximum value displays as white. In the Adjust Contrast tool, the red-tinted box overlaid on the histogram corresponds to the display range.
You can use the Adjust Contrast tool to adjust the display range of the image in these ways.
Description Image Adjust the minimum and maximum values of the display range by dragging the left and right edges of the red window. Change the center of the window by dragging the dotted line in the interior of the window.
Enter specific values in the Window section. You can also define the minimum or maximum value by clicking the dropper button next to the corresponding field. When you do this and move the pointer over the image, the pointer becomes an eye dropper shape. Position the eye dropper shape over the pixel with the value that you want to be the minimum or maximum and left-click.
Scale the display range automatically. Select Match Data Range to make the display range equal to the data range of the image. Select Eliminate outliers to saturate an equal percentage of pixels at the top and bottom of the display range. By default, the tool eliminates 2%, so the top 1% and the bottom 1% of pixel values. This is equivalent to the operation performed by the
stretchlim
function.When you use the Adjust Contrast tool,
imcontrast
adjusts the contrast of the displayed image by modifying the axesCLim
property. To modify the actual pixel values in the target image, select Adjust Data. You cannot select Adjust Data until you make a change to the contrast of the image.The Adjust Contrast tool can process grayscale images of class
double
andsingle
with data ranges beyond the default display range of [0, 1]. For these images,imcontrast
sets the histogram limits to fit the image data range, with padding at the upper and lower bounds.
Version History
Introduced before R2006a