An image lacks contrast when there are no sharp differences between black and white. Brightness refers to the overall lightness or darkness of an image.
To change the contrast or brightness of an image, the Adjust Contrast tool in the Image View app performs contrast stretching. In this process, pixel values below a specified value are displayed as black, pixel values above a specified value are displayed as white, and pixel values in between these two values are displayed as shades of gray. The result is a linear mapping of a subset of pixel values to the entire range of grays, from black to white, producing an image of higher contrast.
The following figure shows this mapping. Note that the lower limit and upper limit mark the boundaries of the window, displayed graphically as the red-tinted window in the Adjust Contrast tool — see Open the Adjust Contrast Tool
Relationship of Pixel Values to Display Range
The Adjust Contrast tool accomplishes this contrast stretching by modifying the
CLim property of the axes object that contains the image. The
CLim property controls the mapping of image pixel values to display
By default, the Image Viewer sets the
CLim property to the default
display range according to the data type. For example, the display range of an image of class
uint8 is from 0 to 255. When you use the Adjust Contrast tool, you change
the contrast in the image by changing the display range which affects the mapping between
image pixel values and the black-to-white range. You create a window over the range that
defines which pixels in the image map to the black in the display range by shrinking the range
from the bottom up.