Lab 4: Radiometric Enhancement

advertisement
CEE 615: Digital Image Processing
1
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
CEE 615: Digital Image Processing
2
Lab 4: Radiometric Enhancement
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.
Low 2% clip
High 2% clip
minimum
maximum
value of
value of
Original
original
original
histogram.
data
data
Note: no gaps
Stretched (display) histogram.
Note: range from 0-255;
unoccupied bins;
high population at 0, 255
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
CEE 615: Digital Image Processing
3
Lab 4: Radiometric Enhancement
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
Gaussian 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.
CEE 615: Digital Image Processing
4
Lab 4: Radiometric Enhancement
 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.
CEE 615: Digital Image Processing
5
Lab 4: Radiometric Enhancement
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 lookup-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.
CEE 615: Digital Image Processing
6
Lab 4: Radiometric Enhancement
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. Contouring
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.
CEE 615: Digital Image Processing
7
Lab 4: Radiometric Enhancement
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.
The stretch can be "inverted" by setting the stretch bottom to the maximum value and the
stretch top to the minimum value.
If Auto Apply is on, the new contrast stretch is applied to the image immediately.
4. Apply a selected color table automatically to the current image by clicking on the desired
color table name. IDL provides a number of pre-saved color tables. The "B-W linear" table
provides a grayscale image. The "RAINBOW" color table provides a "cool" to "hot"
density slice. Other color table options allow you to apply their preferred color scheme.
5. To save the color table to an ASCII file:
A. Select File >Save Color Table to ASCII.
B. Enter a filename and click "OK."
C. Interactive Density Slicing
The interactive density slicing function allows you to select data ranges and colors to
highlight areas in your grayscale image.
1. In the Main Image window, select Tools > Color Mapping > Density Slice.
The #n Density Slice dialog (where "n" is the display number used to start the function)
will appear with eight default ranges listed under "Defined Density Slice Ranges". The
ranges are defined using a minimum and maximum data value calculated from the Scroll
window and shown in the "Min" and "Max" text boxes.
2. Enter the desired minimum and maximum values in the appropriate text boxes to change
the density slice range. To reset the data range to the initial values, click "Reset".
3. Select whether the density slice colors will be applied to the image window, scroll window,
or both windows by selecting the desired check boxes next to "Windows" at the bottom of
the dialog.
4. Click "Apply" to apply the default ranges and colors to the image.
 To edit the data range:
o Select a data range and click "Edit Range" to change the range values or color.
o When the Edit Density Slice Range dialog appears, enter the desired minimum and
maximum values and select a color from the "Colors" menu.
o Click "OK" to make the changes to the range in the "Defined Density Slice
Ranges" list.
o Click "Apply" to apply the new ranges and colors to the image.

To remove a range from the list, select the data range and click "Delete Range".

To clear the list of density slice ranges, click "Clear Ranges".

To add or alter the number of data ranges see “The Options pulldown menu” below.
CEE 615: Digital Image Processing
8
Lab 4: Radiometric Enhancement
The Options Pulldown Menu
The Options menu has selections to add new ranges, set default ranges, and set the number of
default ranges to be used.
 To add ranges:
1. Within the Density Slice dialog, select Options > Add New Ranges.
2. When the Add Density Slice Ranges dialog appears, enter the range start value, range
end, and number of ranges desired in the appropriate text boxes.
3. Choose the starting color from the "Colors" menu. The colors of multiple ranges will
follow the list of graphics colors.
4. Click "OK" to return to the Density Slice dialog. The determined ranges will be listed
in the dialog and can be edited as desired.
5. Click "Apply" to apply the density slicing colors to the image.
 To enter the desired number of default ranges used, select Options > Set Number of
Default Ranges and enter the desired value.
 To reset the "Defined Density Slice Ranges" list to the default ranges and colors
determined by the "Min" and "Max" values and number of set default ranges:
1. Select Options > Apply Default Ranges.
2. Click "Apply" to apply these ranges and colors to the display.
Color Transforms
Use Color Transforms to convert 3-band red, green, blue (RGB) images to one of several
specific color spaces and from the selected color space back to RGB. Adjusting the contrast
stretch between the two transforms, you can produce a color-enhanced color composite image.
Additionally, the value or lightness band can be replaced by another band (usually of higher
spatial resolution) to produce an image that merges the color characteristics of one image with
the spatial characteristics of another image. (Image Sharpening).
The color spaces supported by ENVI include the Hue, Saturation, Value (HSV), the Hue,
Lightness, Saturation (HLS) and the USGS Munsell.
You will want to use one of the multi-band images for this exercise.
Transforming RGB to HSV
Use RGB to HSV to transform an RGB image into the HSV (hue, saturation, and value) color
space. The input RGB values must be byte data in the range 0 to 255. An input file with at least 3
bands or a color display must be open to execute this function. The stretch that is applied in the
color display is applied to the input data. The hues produced are in the range of 0 to 360 degrees
(where red is 0 degrees, green is 120 degrees, and blue is 240 degrees) and saturation and value
in the range 0 to 1 (floating-point).
1. Select Transforms > Color Transforms > RGB to HSV.
2. When the RGB to HSV Input dialog appears, select the three bands to transform from
either a displayed color image or from the Available Bands List (for detailed instructions,
see Selecting Bands from Color Displays). The RGB to HSV Parameters dialog appears.
CEE 615: Digital Image Processing
9
Lab 4: Radiometric Enhancement
3. Select File or Memory output.
4. Click OK to start the processing.
A status window appears. When the forward transform is completed, the HSV names are entered
into the Available Bands List where they can be displayed using standard ENVI gray-scale or
RGB color composite methods. Note: the display can only operate in RGB, thus Hue, Saturation
and Value are displayed as some permutation of Red, Green and Blue.
Decorrelation Stretch
1. Use Decorrelation Stretch to remove the high correlation commonly found in
multispectral datasets and to produce a more colorful color composite image. Highly
correlated data sets often produce quite bland color images. Decorrelation stretching uses
a sequence of Principal Components Analysis (PCA), contrast stretching and inverse
PCA to produce the desired results. Decorrelation stretching requires three bands for
input. These bands should be stretched byte data or may be selected from an open color
display. Select Transforms > Decorrelation Stretch.
2. When the Decorrelation Stretch Input dialog appears, select three bands for input from
either an open color image display or from the Available Bands. The Decorrelation
Stretch Parameters dialog appears.
3. Select either File or Memory output.
4. Click OK to start the decorrelation processing.
A status message appears while each band is calculated. When processing is complete, the
Decorrelation stretch names are entered into the Available Bands List.
Photographic Stretch
Use Photographic Stretch to enhance the color of a True Color input image to produce an RGB
image that correspond well to the response of the human eye. These results look more like
realistic color photos. The bands of the True Color input image are nonlinearly scaled and then
co-added to produce this stretch.
1. Select Transform > Photographic Stretch.
2. When the Photographic Stretch Input dialog appears, select three bands for input from
either an open color image display or from the Available Bands. The Photographic
Stretch Parameters dialog appears.
3. Select either File or Memory output.
4. Click OK to start the processing. A status message appears while each band is calculated.
When processing is complete, the photographic stretch names are entered into the
Available Bands List.
5. Show the resulting RGB bands in a new Display.
Saturation Stretch
Use Saturation Stretch to enhance the color of a 3-band input image by producing output bands
that have more saturated colors. The input data are transformed from red, green, and blue (RGB)
space to hue, saturation, and value (HSV) space. A Gaussian stretch is performed on the
saturation band so the data fills the entire saturation range. The HSV data are then automatically
transformed back to RGB space.
CEE 615: Digital Image Processing
10
Lab 4: Radiometric Enhancement
Saturation stretching requires 3 bands for input. (Try this with the bhtmref.img or the
can_tmr.img.) These bands should be stretched byte data or selected from an open color display.
1. Select Transforms > Saturation Stretch.
2. When the Saturation Stretch Input dialog appears, select three bands for input from an
open color image display or from the Available Bands.
3. Select either File or Memory output.
4. Click OK to start the processing.
A status message appears while each band is calculated. When complete, the saturation stretch
names are entered into the Available Bands List.
Band Ratios
Band ratios were introduced in lecture as a method for minimizing atmospheric effects.
However, ratios are also effective for eliminating topographic effects. As an example, load the
cup95eff.int image from the ENVI data file directory: RSI/IDL63/products/ENVI43/data. If
the image doesn't automatically display, display it in RGB format using bands 183, 193 and 207
for red, green and blue, respectively. Next, create a color ratio image using the same set of
bands.
1. Select Transform > Band Ratios
2. Select 3 pairs of images: 183/193; 193/207; 207/183 (Select "Enter Pair" after selecting
each set.)
3. Select OK.
4. Display the color ratio image as a color image in a new window.
Note how virtually all the topographic shading has been eliminated and the blocks of similar
materials are now rather clearly delineated, regardless of shadowing and light. The technique is
particularly effective with this image because the area is arid calm (very little water vapor or
aerosols), meaning that the atmospheric effects are relatively small.
Download