Image Processing Toolbox User's Guide Previous page   Next Page

Understanding Contrast Adjustment

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 performs contrast stretching. In this process, pixel values below a specified value are mapped to black and pixel values above a specified value are mapped to white. The result is a linear mapping of a subset of pixel values to the entire range of display intensities (dynamic range). This produces an image of higher contrast by darkening pixels whose value is below a specified value and lightening pixels whose value is above a specified value. The Adjust Contrast tools adjust brightness by moving this window over the display range, without changing its size. In this way, the pixel values map to lighter or darker intensities.

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 box in the Adjust Contrast tool.

Display Range to Dynamic Range Mapping

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 intensities.

By default, the Image Tool sets the CLim property to the entire dynamic range available to the data type. For example, the dynamic 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 this mapping between image pixel values (display range) and the dynamic range. You create a window over the range that defines which pixels in the image map to the black in the dynamic range by shrinking the range from the bottom up.

Previous page  Adjusting the Contrast and Brightness of an Image Adjusting Contrast and Brightness Next page

© 1994-2005 The MathWorks, Inc.