Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pmi432 / LR07 / 2read / image processing toolbox guide.pdf
Скачиваний:
166
Добавлен:
18.03.2015
Размер:
18.08 Mб
Скачать

4 Displaying and Exploring Images

Adjusting Image Contrast Using the Adjust Contrast Tool

In this section...

“Understanding Contrast Adjustment” on page 4-42 “Starting the Adjust Contrast Tool” on page 4-43

“Using the Histogram Window to Adjust Image Contrast” on page 4-46 “Using the Window/Level Tool to Adjust Image Contrast” on page 4-47 “Modifying Image Data” on page 4-50

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 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 “Starting the Adjust Contrast Tool” on page 4-43

4-42

Adjusting Image Contrast Using 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 intensities.

By default, the Image Tool 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.

Starting the Adjust Contrast Tool

This section describes how to use the Adjust Contrast tool in the Image Tool.

1View an image in the Image Tool. imtool('moon.tif')

You can also use the Adjust Contrast tool independent of the Image Tool by calling the imcontrast function.

4-43

4 Displaying and Exploring Images

2Click Adjust Contrast in the Image Tool toolbar, or select the Adjust Contrast option from the Image Tool Tools menu. The Adjust Contrast tool opens in a separate window containing a histogram of the image displayed in the Image Tool. The histogram shows the data range of the image and the display range of the image. The data range is the range

of intensity values actually used in the image. The display range is the black-to-white mapping used to display the image, which is determined by the image class. The Adjust Contrast tool works by manipulating the display range; the data range of the image remains constant.

For example, in the following figure, the histogram for the image shows that the data range of the image is 74 to 224 and the display range is the default display range for the uint8 class, 0 to 255. The pixel values for the image are clustered in the middle of the display range. Adjusting the contrast spreads the pixel values across the display range, revealing much more detail in the image.

To adjust the contrast of the image, you can manipulate the red-tinted rectangular box, called a window, that the Adjust Contrast tool overlays on the histogram. By changing the size and position of this window using the mouse, you can modify the display range of the image and improve its contrast and brightness — see “Using the Histogram Window to Adjust Image Contrast” on page 4-46.

4-44

Adjusting Image Contrast Using the Adjust Contrast Tool

Adjust Contrast tool button

Adjust Contrast tool

Data range

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Contrast adjustment

Image histogram

Click to change

 

window

 

 

pixel values in image.

Adjust Contrast in Image Tool

4-45

Соседние файлы в папке 2read