Due: Mar. 12, 2010

lemonadeviraginityAI and Robotics

Nov 6, 2013 (3 years and 11 months ago)

62 views

Exercise #5






Name: _______________________________

Geography 475






Digital Image Processing

Histogram Stretching/Spatial Filters

Due: Mar.
12, 2010


This exercise introduces the basics of contrast enhancement for image interpretation,
as well as the

use of spatial filters to suppress or enhance high
-
frequency image
components.


Part I: Histogram Stretching


Retrieve the Exercise
5

data from the server and save it on your local hard drive.
Change the permissions to allow write access. Start ERDAS and

open the image
minot_area_band4.img. This is ETM+ Band 4 (NIR reflectance) for the Minot area.
Enlarge the viewer and fit the image to the window. Display the layer information
(
Utility/Layer Info
).


1.

What are
the
minimum and maximum DNs? Mean? Standard d
eviation?




Display the band’s histogram. Once displayed, place the cursor inside the histogram
window.
The displayed values on top of the histogram
correspond to the band mean,
minimum, and maximum values, respectively.


Here’s an important point:
these

values are
often based on a sample and not on the
population
. To speed processing, ERDAS calculates statistics based upon samples
from the population of pixels. Click on the sigma (

) symbol to recalculate statistics.
Notice that the “skip factors” for X
and Y are set to a high number (around 35). These
are the number of columns and rows skipped when ERDAS calculates univariate image
statistics. Change the values to
1

and click
OK
. After processing, all pixel DNs are
included in the statistics calculation.


2.

What are the
population

minimum and maximum DNs? Mean? Standard
deviation?




3.

What “happened” to the shape of the histogram as a result of statistics
recalculation?




Close the ImageInfo box. By default, ERDAS displays data already stretched. You can
“s
ee” the stretch by selecting
Raster/Contrast/Breakpoints
. Displayed in the
breakpoint editor are: a) the original histogram in gray; b) the stretched histogram in
yellow; and c) a dashed line representing the portion of the original histogram that has
been

stretched (the endpoints are called “breakpoints” and represent the min and max
values used in the stretch).

To see the breakpoints used for this stretch, click the look
-
up table (LUT) icon (
). The
table that loads displays the LUT bei
ng used and the breakpoints. Note that the first
breakpoint is the minimum value possible (0), and the last is the maximum value
possible (255). The second breakpoint is the DN used as a minimum for the stretch (it
and all lesser DNs are set to a display v
alue of 0), and the third is the maximum (it and
all greater DNs are set to a display value of 255).


4.

What values are used as display minimum and maximum?





5.

Using those numbers and the min
-
max stretch formula provided during lecture,
calculate the output

display value for an input value of 70 (show your work).
Check your answer against the LUT. Does your calculation match the LUT?






Examination of input DNs and output brightness values serves to illustrate another
important point:
DNs are not permanent
ly changed by histogram enhancement (unless
so desired


there is an option in ERDAS to change them permanently). Rather,
changes are to display values (LUTs) only
.


Now, look at the image with no stretch (i.e., in its natural state). Change the breakpoint
s
in the table so that an input DN of 0 equals a display value of 0 and an input DN of 255
represents an output display value of 255. The input and output histograms should now
match. In the LUT, there should be one
-
to
-
one agreement between input DNs and
o
utput display values. Click on the
red lightning bolt

to apply the changes.


6.

What happened to the contrast of the image? Based upon this visual evidence,
why are histogram stretches important in terms of image interpretation?





Close the breakpoint edito
r windows.


There are several types of image stretches built into ERDAS. You can access them by
selecting
Raster/Contrast/General Contrast
. Click on the down arrow to display all of
the possible methods. Note that we discussed several during lecture, and
that there are
several others we did not discuss. Select
Standard Deviations
. Change the number of
standard deviations to 1.0. and click
Apply
. Note the change in contrast on the image.
Now click “breakpoints” and then the LUT icon.


7.

Do the minimum and ma
ximum values (breakpoints) used for this stretch
correspond to

1 standard deviations from the band mean? (Show your work).




8.

Again use the formula provided in class to calculate an output display value for a
DN of 70 (show your work). Does your calculati
on match the value in the LUT?






Change the method to “linear” and click
Apply
. This returns the display to a non
-
stretched image.


Next, set up a user
-
defined stretch

by using the histogram edit tools
. Say you are
interested in extracting water bodies

from the image. You should know that water has
low reflectance (high absorption) in the NIR portion of the electromagnetic spectrum,
which translates to low pixel DNs on digital imagery. Change the breakpoints so that the
maximum value in the stretch is 5
0.


9.

How well did this procedure highlight water bodies? Change the value to 40. Is
this stretch better or worse for extraction of water bodies?





Return the stretch method to “linear.”


Finally, you will examine histogram equalization. Select the “histo
gram equalization”
method and click
Apply
. Look at the histogram shown in the breakpoint editor.
Remember that this method is non
-
linear (as evidenced by the stretch curve displayed
over the histogram). Histogram equalization seeks to “equalize” the freque
ncy of DNs
among each gray scale.


10.

Describe the contrast of the resulting image display. How does histogram
equalization compare to the other stretches in terms of enhancing your ability to
visually interpret the data?







These stretches work on color
composite imagery as well. Open a second viewer and
load the file minot_area_072800.img. Enlarge the viewer and fit the image to the
window. Experiment with a few histogram stretches on the color display (check out the
non
-
stretched linear view!). When fin
ished “experimenting,” display a

2 standard
deviation stretch.


Part II: Spatial Filtering


Another form of image enhancement is spatial filtering.


Close the viewer displaying the Band 4 data. For the color composite, display a 5,4,1
(maximum OIF) band
combination. There are two general ways to go about spatial
filtering in ERDAS. One changes the display values (LUT) only (non
-
permanent
change), and the other outputs new image files with new pixel DNs. You will explore the
use of both approaches.


Select

Raster/Filtering/Smooth
. Note that you are warned that the filter will not
permanently alter the image file. Select
OK
.


11.

Describe the appearance of the image? For what applications might a smooth
filter be useful?





Now select
Raster/Filtering/Sharpen
.



12.

Describe the appearance of the image? For what applications might a sharpen
filter be useful?




Now select
Raster/Filtering/Find Edges
.


13.

Describe the appearance of the image? For what applications might an edge
filter be useful?




Return the image to
a “sharpened” display. Next, you will look at some specialized
filters. Select
Raster/Filtering/Convolution
. You are presented with a list of kernels or
different sizes with different purposes. Select 3x3 low
-
pass and then click
Edit
.



14.

What coefficients
are used in this kernal?













Close the kernal editor.
Apply

in sequence 3x3, 5x5, and 7x7 low
-
pass filters.


15.

What is the apparent effect of kernal size on the resulting image?






Now select 3x3 high
-
pass and then click
Edit
.


16.

What coefficien
ts are used in this kernal?













Apply
in sequence 3x3, 5x5, and 7x7 high
-
pass filters.


17.

Does this action support your finding in question 15? Explain.





Note that you can create your own filters. Click
New

and enter the following high
-
pass
ke
rnal coefficients:


1

-
2

1

-
2

5

-
2

1

-
2

1



When finished, select
File/Librarian
. After “Name:” type “3x3 High Pass Custom” and
click
Save
. Then, click
Close
. Close the kernal editor as well. The filter you created
should now appear at the bottom of the

list of kernels. Select it and click
Apply
.


18.

Describe the filter’s effect on the image.





Now, close all windows except the viewer. You will look at the other way to filter image
data. Click the
Interpreter

icon and then
Spatial Enhancement
. These tools

all change
create output images with permanently changed DNs
. Click on
Convolution
. Set the
in
put file to
minot_area_072800.img and call the output file

high_pass.img


(
do not
save the output
file on the server!
)
.
Then, note the list of filters (the same

list you saw
earlier). Scroll down to find the custom high
-
pass filter you created and select it. Run the
filter. After the image processes, open a new viewer window and load high_pass.img.


19.

Describe the appearance of the image.





Take a closer look at

the use of edge filters. Click on
Convolution

and then click
New
.
Create a north directional filter using the following coefficients:


1

1

1

1

-
2

1

-
1

-
1

-
1


Select
File/Librarian

and save the kernal under the name “north.” Close the windows,
and selec
t the new kernal in the convolution dialog window. Again, use the
minot_area_072800.img file as input and call the output north.img. Run the filter. When
the process completes, load the file north.img into a new viewer.


20.

Did the filter perform as you expe
cted? What types of edges are highlighted?







Click on
Convolution

and then click
New
. You will now create a non
-
directional
Laplacian filter using the following coefficients:


-
1

-
1

-
1

-
1

8

-
1

-
1

-
1

-
1


Save the kernal under the name “Laplacian.” Ru
n the filter on the same input image,
naming the output file laplacian.img. Load the output file into a viewer.


21.

Describe the characteristics of this image. What types of features were
enhanced? Can you think of a practical application for this filter?





22.

Change the band combination so only Band 1 data are displayed. What types of
edges are shown in Band 1? Change the combination so only Band 4 data are
displayed. What types of edges are shown in Band 4?






Finally, run a Sobel filter. Select
Non
-
Directi
onal Edge
. Use the same input as
before and call the output sobel.img.

As an aside, click
View
. This loads the Sobel
model into the Spatial Modeler. Note how the program runs: the input file is fed into
two separate convolution functions, which work with
separate convolution masks
that operate simultaneously. Output from the convolution functions are two
temporary files, which are recombined to produce a single output raster file.


Double
-
click on each of the model’s convolution masks and record the coeff
icients
below:




















23.

Do these coefficients match those provided during lecture?




Close the spatial modeler window and run the Sobel filter. Load the resulting image.


24.

Describe the appearance of this image. What types of featur
es are enhanced?
For what practical purposes might this filter be useful?