Matlab Program For Contrast Stretching

Matlab Program For Contrast Stretching Average ratng: 4,2/5 9804 reviews

This 9th session is to describe the histogram equalisation and contrast streching operations on low contrast.

This example shows several image enhancement approaches. Three functions are particularly suitable for contrast enhancement: imadjust, histeq, and adapthisteq. This example compares their use for enhancing grayscale and truecolor images.

Enhance Grayscale Images

Using the default settings, compare the effectiveness of the following three techniques:

  • imadjust increases the contrast of the image by mapping the values of the input intensity image to new values such that, by default, 1% of the data is saturated at low and high intensities of the input data.

    UFile ONLINE offers more free returns than any other major online tax software. UFile ONLINE is free for: first-time filers, new Canadians, Canadians with a total income under $20,000, all post. Www.ufile.ca/download for mac. Download your 2019 version of UFile for Windows. Additional returns. Additional returns can be purchased here: UFile for Windows 2019 Shop. UFile currently accepts Visa, Mastercard and American Express credit cards. Transactions are in Canadian dollars. Secure and available 24 hours a day. System requirements. UFile ONLINE, the online equivalent of UFile for Windows, supports Mac and Linux operating systems running the latest version of Internet Explorer, Google Chrome, Opera and all browsers based on the latest Mozilla rendering engine (e.g., Firefox) as well as Safari for the 2008 tax year (for earlier tax years on a Mac, please use Internet Explorer for Mac).

  • histeq performs histogram equalization. It enhances the contrast of images by transforming the values in an intensity image so that the histogram of the output image approximately matches a specified histogram (uniform distribution by default).

  • adapthisteq performs contrast-limited adaptive histogram equalization. Unlike histeq, it operates on small data regions (tiles) rather than the entire image. Each tile's contrast is enhanced so that the histogram of each output region approximately matches the specified histogram (uniform distribution by default). The contrast enhancement can be limited in order to avoid amplifying the noise which might be present in the image.

Read a grayscale image into the workspace. Enhance the image using the three contrast adjustment techniques.

Display the original image and the three contrast adjusted images as a montage.

Read a second grayscale image into the workspace and enhance the image using the three contrast adjustment techniques.

Display the original image and the three contrast adjusted images as a montage.

Notice that imadjust had little effect on the image of the tire, but it caused a drastic change in the case of pout. Plotting the histograms of pout.tif and tire.tif reveals that most of the pixels in the first image are concentrated in the center of the histogram, while in the case of tire.tif, the values are already spread out between the minimum of 0 and maximum of 255 thus preventing imadjust from being effective in adjusting the contrast of the image.

Histogram equalization, on the other hand, substantially changes both images. Many of the previously hidden features are exposed, especially the debris particles on the tire. Unfortunately, at the same time, the enhancement over-saturates several areas of both images. Notice how the center of the tire, part of the child's face, and the jacket became washed out.

Concentrating on the image of the tire, it would be preferable for the center of the wheel to stay at about the same brightness while enhancing the contrast in other areas of the image. In order for that to happen, a different transformation would have to be applied to different portions of the image. The Contrast-Limited Adaptive Histogram Equalization technique, implemented in adapthisteq, can accomplish this. The algorithm analyzes portions of the image and computes the appropriate transformations. A limit on the level of contrast enhancement can also be set, thus preventing the over-saturation caused by the basic histogram equalization method of histeq. This is the most sophisticated technique in this example.

Enhance Color Images

Contrast enhancement of color images is typically done by converting the image to a color space that has image luminosity as one of its components, such as the L*a*b* color space. Contrast adjustment is performed on the luminosity layer 'L*' only, and then the image is converted back to the RGB color space. Manipulating luminosity affects the intensity of the pixels, while preserving the original colors.

Read an image into the workspace. The 'shadow.tif' image is an indexed image, so convert the image to a truecolor (RGB) image. Then, convert the image from the RGB color space to the L*a*b* color space.

The values of luminosity span a range from 0 to 100. Scale the values to the range [0 1], which is the expected range of images with data type double.

Perform the three types of contrast adjustment on the luminosity channel, and keep the a* and b* channels unchanged. Convert the images back to the RGB color space.

Display the original image and the three contrast adjusted images as a montage.

See Also

adapthisteqhisteqimadjust

Matlab Program For Contrast Stretching

Related Topics