Keywords: front-page

## Lab: Histogram Stretching Contrast Enhancement

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with the histogram stretch technique for image contrast enhancement.

Activities:

1. Read the image $DIP/data/cathedral.kdf and display it using the operators User defined and Display Image.

   1. Glyphs:Input/Output:Data Files:User defined
   2. Glyphs:Visualization:Non-Interactive Display:Display Image

2. Determine the histogram of the image and plot it. Use operators Histogram and Display 2D Plot.

   1. Glyphs:Data Manip:Histogram Operators:Histogram
   2. Glyphs:Visualization:Plot Display:Display 2D Plot
   3. When the plot comes up, select the "Options" button, and change the "Plot Type" to "Discrete".

3. Perform a histogram stretch on the image, calculate the new histogram and plot it. Use operators Stretch, Histogram, and Display 2D Plot. Display the resulting contrast enhanced image using Display Image.

   1. Glyphs:Data Manip:Histogram Operators:Stretch
   2. Glyphs:Data Manip:Histogram Operators:Histogram
   3. Glyphs:Visualization:Plot Display:Display 2D Plot
   4. Glyphs:Visualization:Non-Interactive Display:Display Image
   5. Change the plot type to "discrete". Compare the images and the histograms of the original versus the histogram stretched image.

Exercises

1. Perform the same experiment using images with high contrast and with low contrast.
2. Do you think an interactive histogram modification tool is a desirable tool to have?
3. Can you think of other methods to enhance the contrast of an image?

Khoros Workspace
Execute the visual program c4s4histogram-stretch.wk