CEE 615: Digital Image Processing 2 Lab 4: Radiometric Enhancement
Lab 4: Radiometric Enhancement
Task: Apply a variety of image enhancement procedures to several images and compare the effects.
As used in this class, the term "image enhancement" describes any process designed to improve the visual interpretability of an image. The effectiveness of an enhancement procedure will vary according to the type of image, and to the response of the human visual system.
It is difficult to generalize about the effectiveness of a given procedure. The user is the one who determines the value of a particular enhancement, and one individual may find a particular enhancement helpful while another finds it confusing or misleading. Furthermore, the same procedure may produce very different visual effects on two images with exactly the same statistical distribution of gray values because the spatial distribution of the gray values is quite different.
For this lab we will simply explore some of the capabilities available with ENVI to enhance the display image. The operations that we will consider are:
Histogram modification Pseudocolor mappings
Standard grayscale transforms False color mappings
Note: In ENVI, the enhanced image being displayed is created on-the-fly. The original disk version of the image is always maintained when performing enhancements unless the user expressly saves an enhanced version using the same file name.
Select an Image
There are several images that will be useful for this exercise. Two are in the ENVI data base in the directory C://RSI/IDL6.0/Products/ENVI4.0/data:
can_tmr A 6-band TM image of Canon City, Colorado
bhdemsub A DEM of Bighorn Basin, Wyoming
cup95eff.int A 50-band subset of an AVIRIS image of Cuprite, Nevada
Two other images are on the CEE 615 web page:
Ithaca.img A subset of a 1999 SPOT panchromatic image of the Ithaca area.
SPOT_XI A subset of a SPOT XI (4-band) image of an agricultural region
Histogram modification
A single-band image is generally more useful for exploring histogram modification. Try Band-3 of the SPOT_XI image.
An enhancement procedure that operates only on the gray values of the pixels in an image and is insensitive to the position of that pixel is called a point operation. Since the histogram of gray values summarizes the information content of the gray values in an image, changes in the gray value distribution often can be described most effectively in terms of the histogram, and procedures which directly adjust the histogram – histogram modification – are some of the most effective enhancement procedures available.
A. Quick stretches. Several automatic histogram modification routines are available by selecting Enhance in the image window. Each automated stretch may be applied based on the data in the main image window, the zoom window, or the scroll window. In each case, only the pixels appearing in the selected window are used to compute the histogram on which the enhancement is based. You will be able to better observe the effect of the quick stretches if you first display the histogram of the image by selecting Enhance > Interactive Stretching from the main image menu.
Select each of the filters, observing the effect on the image and the changes in the histograms. Note the position of the clip lines (vertical dotted lines) in the input histogram, and the shape and data range for the output histogram.
When you select the zoom window as a base for the stretch, select Options > Auto Apply in the histogram window and observe the effect of moving the zoom window around in the main image window.
Linear uses the data minimum and maximum to perform a linear contrast stretch (no clipping). This is particularly useful for displaying images with only a few data values, where clipping might saturate all of the values.
Linear 0–255 does not actually stretch the data—it displays the actual DN values of the pixels as computer screen display values that range from 0 to 255, where 0=no black and 255=maximum brightness. When using the Linear 0–255 stretch, it is not unusual for the image to appear to be of very poor quality simply because the data was not stretched to fill the display's dynamic range.
Linear 2% applies a linear stretch with a 2% clip on both ends of the displayed data, i.e., 2% of the brightest pixels are displayed as white (255) and 2% of the darkest pixels are displayed as black (0). All other gray values are linearly mapped between those extremes. This is the stretch that ENVI performs by default with every display
G au ssian applies a Gaussian stretch with a mean of DN 127 and the data values at ± 3 standard deviations set to 255 and 0, respectively.
Equalization applies a histogram equalization stretch of the displayed data.
Square Root takes the square root of the input histogram and then applies a linear stretch.
B. Interactive histogram modification
Now turn your attention to the Interactive Stretching window. To begin with, continue to use the single Band 3 SPOT image. (If an RGB color image is displayed, then three radio buttons will appear, allowing each band to be adjusted separately. This can be confusing.)
When first started, the displayed input and output histograms show the current input data and applied (2%) stretch, respectively. The vertical dashed lines on the input histogram mark the minimum and maximum thresholds. The actual values of the minimum and maximum are displayed in the text boxes at the top of the dialog.
1. Graphic tools
· To change the minimum and maximum stretch values, click with the left mouse button on either of the dashed lines and drag them to a new location. The current DN, number of pixels, percentage of pixels for this specific DN, and the cumulative percent are shown above the input histogram when either bar is selected.
· You may also change the minimum and maximum by entering explicit values in the text boxes and pressing <ENTER>. When specifying the minimum and maximum, enter either the actual values desired (e.g., 37 for the minimum and 68 for the maximum). The min/max bars in the input histogram move to match the values entered. The output histogram updates to reflect the changes made to the input histogram and shows the distribution of the data with the new stretch applied.
Note: unless you have selected Options > Auto Apply, the image display does not change until you select <Apply>.
· Press and hold the left mouse button within the histogram and drag the resulting white cross-hair cursor. The current DN, number of pixels, percentage of pixels having this specific DN, and the cumulative percent will be displayed in the text box below the histogram
· To change the vertical scale of the histograms, click the middle mouse button (CNTRL – left button) at the desired maximum Y value anywhere within the plot to be scaled.
· To reset the vertical scale to the original Y value, click the middle mouse button below the X axis of the plot to be reset.
· To restore the original data range, select Options > Reset Stretch within the dialog.
· Set your preference for whether the range you entered is retained when new data is loaded by selecting Options > Auto Reset Histogram.
2. The Stretch_Type Pulldown Menu
The Stretch_Type menu within the Interactive Contrast Stretching dialog contains a list of all the types of interactive stretches that can be selected. Most of these choices are the same as in the Quick Enhance menu, but three new types appear here:
a. Piecewise Linear Contrast Stretch
A piecewise linear contrast stretch can be interactively defined by using the mouse to position points in the input histogram. Linear segments connect the points while providing linear stretching between them.
1. Select Stretch_Type >Piecewise Linear. A transfer function will be plotted on the input histogram.
2. Click the middle mouse button anywhere on the transfer function to plot a symbol marking the X, Y coordinates of the selected point.
Line segments are plotted to connect the endpoints to the plotted symbol.
· To move the position of a point, click the left mouse button on the symbol and drag it to a new position.
· To delete points, click on the symbol with the right mouse button.
· To enter input and output values manually, select Options > Edit Piecewise Linear.
The resulting histogram will be plotted in the output display. The output histogram shows the distribution of data with the new stretch applied.
b. Arbitrary Contrast Stretching and Histogram Matching
The Arbitrary option allows you to "arbitrarily" draw any shape histogram on top of the output histogram or match a histogram from another image.
1. Select Stretch_Type > Arbitrary.
The input histogram shows the unmodified data distribution.
2. Draw the output histogram in the Output Histogram window by clicking the left mouse button to draw segments of the output histogram, or by drawing with the left mouse button depressed.
· The arbitrary histogram will appear in green.
· To erase the histogram, click the middle mouse button.
3. Click the right mouse button to accept the output histogram and match the data statistics to the drawing. The output histogram shows your histogram in red and the matched data function as a white curve.
c. User Defined Look-Up-Tables
A user defined look-up-table stretches each input DN to an output value. It can be restored (see Saving and Restoring LUTs) or defined interactively. To define a look-up-table (LUT) or edit the LUT:
1. Select Stretch_Type > User Defined LUT.
2. Select Options > Edit User Defined LUT . When the edit dialog appears, a list of the input DN values and their corresponding output stretch values will be shown under the "Edit User Defined LUT" label. These values reflect the current stretch.
3. Click on the value to edit.
4. When it appears in the "Edit Selected Item:" text box, enter the desired value and press the return key.
Note: To reset the look-up-table to the values it had when the function was initiated, click "Reset".
5. Click "OK."
6. Click "Apply" to apply the stretch to the displayed data.
3. The Histogram_Source Pulldown Menu
Input histogram information can be extracted from the Main Image window, from the Scroll window (subsampled), from the Zoom window, from the entire image band (all pixels of the data), or from a user defined region-of-interest (ROI).
Select Histogram_Source and select the desired input data source. The output histogram, and thus the resulting stretch, changes based upon the source of the input histogram.
For the Zoom window:
· View histograms for different portions of the image by moving the zoom box in the Main Image window.
· View Histograms for the Zoom window in real-time by clicking and holding the middle (CNTRL + left) mouse button inside the zoom box in the Main Image window and dragging the box to a new location. The input and output histograms will be automatically updated as the box moves. Changing the size of the zoom box changes the pixels displayed, and thus also changes the histograms.
4. The Options Pulldown Menu
The Options pulldown menu has selections that allow for histogram and stretch resetting and options that pertain to specific stretch types. Most of these options have been described above within specific stretch type descriptions. Several of the options cited below are specific to a particular type of enhancement and will be active only when the corresponding stretch type as already been selected under the Stretch_Type menu.
Reset Stretch
· To reset the displayed stretch to the stretch that was applied when the Contrast Stretching function was initiated, select Options > Reset Stretch.
Set Gaussian Stdv – The Set Gaussian Stdv selection allows for input of the desired range of standard deviations for the Gaussian stretch type histogram distribution.
Edit User Defined LUT and Edit Piecewise Linear
· To edit the values used in these stretches, choose Options > Edit User Defined LUT or Edit Piecewise Linear. For more information, see User Defined Look-Up-Tables and Piecewise Linear Contrast Stretch.
Auto Reset Histogram On/Off
· To set whether the "Min" and "Max" entered range is retained (Off) or reset (On) when new data is loaded into the input histogram, select Options > Auto Reset Histogram On or Auto Reset Histogram Off.
Auto Apply
· To have any stretching or histogram changes applied to your images automatically, the Auto Apply option should show a checkmark next to it.
B. Co ntouring
While you can accomplish contouring by directly editing an User Defined LUT or Editing the Piecewise Linear LUT. However, ENVI provides an alternate and more effective method using overlays to create contour lines. The computations use the histogram to locate the contour lines, but automates the process very effectively and uses an overlay for display, thus not altering even the display version of the image. (The DEM image bhdemsub.img is the best for illustrating this feature.)
To apply contouring, select Overlay > Contour Lines in the image window. Select the band to be used for contouring. (The displayed band will be highlighted as the default.) In the Contour Plot window, you may select the number of levels (Options > Select number of default levels), change the color and thickness of the lines and adjust the location of the lines (based on the image gray value.) Select Apply to see the result.
The contouring routine is actually a subset of the density slice routine (see below.)
C. Pseudocolor mappings
The ENVI Color Tables option allows both linear contrast stretching and the application of standard color tables (density slices) to grayscale images. (To design your own color tables see the instructions in Editing System Color Tables in ENVI's On-Line Help.)
1. In the Main Image window, select Tools > Color Mapping > ENVI Color Tables. The ENVI Color Tables dialog appears, where you may adjust the screen color tables using the default IDL color tables. The dialog contains a grayscale wedge (or color wedge if a color table is applied) and two sliders to control the contrast stretch. It also has two pulldown menus, File and Options.
2. To have any color table changes applied to your images automatically, toggle Options > Auto Apply. Auto Apply is on when the checkmark appears. When Auto Apply is not checked you must manually apply the color mappings.
3. Move the sliders labeled "Stretch Bottom" and "Stretch Top" respectively to control the minimum and maximum values to be displayed. Moving the Stretch Bottom slider to the right causes bright areas of the image to become darker, while moving the Stretch Top slider to the left causes dark areas of the image to become brighter.