0% found this document useful (0 votes)
240 views11 pages

Lab 03 - Data Formats - Contrast Stretching - Density Slicing

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 11

Data Formats, Contrast Stretching, and

Digital Density Slicing


Objectives:

 Understand common digital data storage formats


 Obtain image statistics and histograms
 Perform contrast stretching and histogram equalization
 Density-slice an image into specified classes

Part I. Data Formats and Import/Export

Beginning with this exercise we will frequently use images in formats other the
IMAGINE (*.img), such as the LAN (*.lan) format. The ".lan" suffix signifies that the
files were created using a previous version of IMAGINE (e.g. IMAGINE 7.5). The
images can be copied from the class blackboard directory as before.  However, they must
first be imported into Imagine and converted into IMAGINE (*.img) format before you
can process them. Directions for doing this are found below. Begin by copying the
murrells-inlet_cams_1997-08-02.lan file to your local hard drive.  After you begin
IMAGINE, go to Manage Data | Import:

When the Import dialog box appears, do the following:

 Set the input format to ERDAS 7.5 LAN.


 Locate the Input file as murrells-inlet_cams_1997-08-02.lan.
 As soon as you locate the input file, the system will automatically file in
the Output file with a *.img format. Make sure it will output to the
appropriate directory.
 When you are ready to import the image, select [OK]. Another menu will
probably pop-up. Just select [OK] again.

2
Now display the newly imported murrells-inlet_cams_1997-08-02.img file in the viewer
with RGB = bands 6,4,2. This equates to placing the NIR band (6) in the red image plane,
the red band (4) in the green image plane, and the green band (2) in the blue image plane
as previously discussed in lecture.

1) Briefly describe (you may want to use simple illustrations) the logic and
differences between the three most common generic binary data storage
formats and any advantages/disadvantages of each including:

a) band sequential (BSQ)


b) band interleaved by line (BIL)
c) band interleaved by pixel (BIP)

Part II. Contrast Stretching and Histogram Equalization

For this part of the exercise, you will be using an unrectified nine band NASA CAMS
(Calibrated Airborne Multispectral Scanner) image acquired August 2, 1997 over
Murrell's Inlet, South Carolina.  You will need the IMAGINE (*.img) file you created in
Part I.  It is IMPORTANT that throughout Part II, you do NOT save any contrast
changes you make to this image. You will perform some basic contrast stretching
procedures on this image.

Display murrells-inlet_cams_1997-08-02.img in an imagine viewer with the following


CIR band selection: band 6 in the red plane, band 4 in the green plane, and band 2 in the
blue plane (RGB = bands 6,4,2). Once the image is displayed in the viewer, click to
Home | Layer Info | View/edit image metadata dialog. As you discovered in the previous
exercise, the ImageInfo window displays band, statistics, and map information for the

3
selected channel as well as projection (including elevation) information if the image has
been rectified and projected. The band (layer) you choose to view can be modified so that
you can in turn view each band individually. Since this image has not been rectified or
projected, the Map Info is in file coordinates (row and column), not map coordinates (i.e.
UTM coordinates) and the Projection Info is blank.

Find and select the button that displays the layer Histogram. The range of the x-axis
consists of brightness values from 0 to 255 (corresponding to 8-bits; 0 is black and 255 is
bright white). The y-axis starts at 0 and increases upwards, showing the total number of
pixels that are being placed into each x-axis range from 0 to 255. You can query the
histogram by moving the cursor into the window displaying the histogram. Roam around
inside the graph and notice that the cursor arrow becomes a cross. The x- and y-axis
values are displayed for the center cross location within the histogram. Resize the
histogram window by dragging the corners for a closer inspection of the data distribution.
Note that changing the layer in the ImageInfo dialog will change the histogram as well.

%
% 2) On a sheet of paper, recreate each of the histograms for all nine bands and
briefly interpret the general characteristics of each band's histogram based
on your knowledge of the electromagnetic spectrum. [You may want to
consider using a free screen capture program such as ScreenHunter to capture
screen images that you use when answering the exercise questions.] Label the
highest frequency represented, minimum, maximum, and the mean value for
each band.

Close the ImageInfo window and leave the CIR image displayed in the Viewer.  Navigate

4
to the Multispectgral | General Contrast menu and click on the green histogram ICON.  A
menu will appear with sliding bars that allow allows you to change the Contrast Stretch
Method. Click the [Apply] button in this menu to view the contrast changes applied in
the viewer. Experiment using this tool by increasing the contrast of the image to a level
where the estuaries and wetlands within Murrell's Inlet can be identified more easily.

3a) What is ERDAS' default standard deviation contrast?

3b) Why do you think the contrast between the uplands and the wetlands is
so great?

3c) What standard deviation contrast levels did you choose to view the
estuaries and wetlands within Murrell's Inlet?

When you are finished experimenting with the contrast tool, reset the standard deviation
contrast stretch to 2.0. Do NOT save any contrast changes you made to the image.

Navigate to the Multispectgral | General Contrast menu and click on the green histogram
ICON again.  When the Contrast Adjust tool appears, click on the [Breakpoints...] button.
This brings up the Breakpoint Editor and three histograms (one for each band displayed
in the image) should appear.

5
Each histogram corresponds with the color memory plane in which the individual bands
are being displayed (Red, Green, Blue). Notice the light gray histogram that is behind
each colored histogram (you may need to increase the size of the Breakpoint Editor to see
this clearly). These light gray histograms correspond to the input data file’s raw data
values that you saw earlier in this exercise. The change between these two histograms
(light gray and colored) represents the contrast enhancements that have automatically
been applied to the image by the software. The enhancement represented graphically by
the colored histograms is a contrast stretch over +2 standard deviations from the mean
data value in each band.

4a) On a new sheet of paper, draw and label in the same way as before the
newly contrast stretched histograms for bands 6 (histogram in the red plane)
and 4 (histogram in the green plane) .

Each dashed sloped line that crosses a histogram illustrates the transformation of image
data values into brightness values and is a graph of the lookup table. The line shows how
the input file value of x is changed to produce an output brightness value of y. By moving
the cursor into the windows and over the histograms the cursor changes again into a cross
and information about the histograms can be gained. The buttons along the top of the
Breakpoint Editor allow you to manipulate these linear transformations in different ways.
Now go back to the Contrast Adjust window and make sure the Method is set to
[Histogram Equalize] and then click [Apply]. Notice the changes that occur in the
Breakpoint Editor to all three histogram patterns and in the slopes of their lines. Now
click the [Apply All] button in the Breakpoint Editor. You may want to zoom in on

6
selected areas to get a better feel on what the contrast enhancements are doing to the
displayed image.

4b) What happened to the histograms when you applied histogram


equalization? How did it affect the images? When would histogram
equalization not be appropriate to use?

Now move the cursor into each histogram window and when over the graph select the
right mouse button, this should display a hidden function window. In this hidden window
find and select [Undo All Edits] for each of the three histograms and then click [Apply
All] in the Breakpoint Editor. This will return the histogram to it original condition. Now
go to the Contrast Adjust window where you selected histogram equalization before and
this time change that selection to [Standard Deviations].  Notice that the default standard
deviation setting to view images is 2.0. Move down to the single box just below this
selection and change the number of the standard deviations to 4.0 and then select [Apply]
in that window and then [Apply All] in the Breakpoint Editor. Notice the changes that
occur in both the image and in the histograms.  Please note that you can also get to all of
the tools by clicking on the General Contrast button in the Multispectral menu.
Experiment with this toolbox.

5a) What happens to the image when the Standard Deviation is changed to
4.0? Why?

Now change the number for the standard deviations to 1.0 and select [Apply] in both
menu windows.

5b) What happens to the image when the Standard Deviation is changed to
1.0? Why?

Part III. Density Slicing

Density slicing is a form of selective one-dimensional (i.e., only one band is analyzed)
classification. The continuous gray scale of a single band is “sliced” into a series of
classifications based on ranges of brightness values. All pixels within a “slice” are
considered to be the same information class (i.e. water, forest, urban etc.). This slicing
takes place in the Raster Attribute Editor in ERDAS IMAGINE.

Density slicing can only be performed on one band at a time. Therefore, it will be
necessary to bring up the individual band of the dataset you are interested in density
slicing as a single band. Right click in the viewer window and select |Clear View|. Now
open the marco-island_spot_1988-10-21.img file you used in last week's exercise.
Display it using RGB = bands 3,4,2). You are only going to use band 3 of this dataset to
perform density slicing. So, go to |Raster | Subset & Chip | Create Subset Image. The
input file name should be marco-island_spot_1988-10-21.img and call the output file

7
name Marco_band_3.img. Next, specify "Select Layers: 3". Make sure the output file is
in the same folder as the input file. Once everything is in order, click O.K.

Go to the Viewer and open Marco_band_3.img and specify that it will be displayed as:
Pseudo Color in the Raster Options menu. It only contains a single band (band 3).
This displays the band 3 image in shades of black and white. Now you are ready to
density-slice this single band image into three general land cover classes:

1. Water
2. Vegetation
3. Urban/Barren

To do this you will need to right click on Marco_band_3.img in the left hand Contents
area and select Display Attribute Table|. This displays a histogram with a color
column below the original image viewer. Also, bring up the raw data value histogram
for the band to aid in your feature discrimination. This can be done using the procedures
discussed in Part I.

Once you have both a histogram and the Display Attribute Table open you are ready to
proceed. Examine the row and columns in the Display Attribute Table. The rows in the
table correspond to the input file data values that can range from 0 to 255 (8 bits). The
columns show a histogram frequency and a color for each brightness value, as well as a
binary opacity (on / off) setting.  As you scroll through the Display Attribute Table you
should see a progression from dark to light shades of gray. You can resize this table to
display more or less of the columns and rows as you wish.

8
Move the cursor back into the Viewer where the NIR band is displayed and with the right
mouse button bring up a Quick View menu and select [Inquire Cursor].  Roam the cursor
around the image and watch to see what typical brightness values (pixel values) are
associated with the water class, the vegetation class, and the urban/bare land class within
the NIR band. You should be trying to get an idea about what boundary values
correspond with each of these classes (i.e. vegetation = 80 to 255, water = 40 to 79,
urban/bare land 1 to 39).  NOTE: These are not accurate choices and are only given as an
example. At this point you may wish to consult the histogram of the NIR band to make
any further estimates as to the class into which you plan to place a particular brightness
value.

After you have used the Inquire Cursor and determined the boundary values for the three
classes listed above, move back to the Display Attribute Table. What you will now do is
to assign to each of these three classes characteristic colors that will represent them in the
image (i.e. instead of water being dark black in the NIR band it will appear as the color
you chose- blue might be nice). The method for assigning your characteristic colors is
quite simple. Use the left mouse button to select ("highlight") each row you feel is
characteristic of one particular class, i.e. water. This can be done by clicking on each row
number (farthest left column) individually or by selecting a series of rows. To select a
series you should depress the left mouse button, and while keeping it depressed, move the
mouse up or down within the row column. This will have the effect of scrolling the
attribute editor up or down, highlighting all the rows along the way. If you wish to do a
combination of scrolling and selecting individually then make sure you hold the shift key
down anytime you depress the left mouse button and proceed as before.

Once you have made your row selections you can modify the color in all of them by
depressing the right mouse button when the cursor is over the color column.  Note that
the color will only change in the rows you have selected.  You have the option of
choosing a default color or using [Other...] to create your own color. If you choose
[Other...] the Color Chooser will open and you have two options to choose from:
[Standard] or [Custom]. The [Standard] gives you the ability to choose colors by name.
The [Custom] option allows you to choose a color using the three sliding bars in RGB
(Red, Green, Blue) mode or IHS (Intensity, Hue, Saturation) mode. You can also pick a
color by using the cursor to move the black circle within the color wheel. You will no
doubt end up using some combination of all the above.  Whatever process you choose to
pick a color, select [Apply] and the color should appear on the IMAGINE Viewer
representing that "slice" or class of the NIR band. Repeat this step for all three classes.

9
5) Record the range of values you used to density slice each land cover class
using the near-infrared image:

Water =
Vegetation =
Urban/Bare land =

When you are finished, exit the Display Attribute TableGo to the top left icon and click |
Save | Top Layer|. Close the Viewer and then open the Marco_band_3.img file by once
again specifying Pseudo-color in the Raster Options menu. You should see that your
density slicing decisions are in place.

Sometimes we want to export remote sensing density sliced images to be analyzed as


thematic map data in a GIS. Therefore, we often turn *.img files into *.gis files using the
ERDAS Import/Export software. To do this, go to |Manage Data| Export menu bar, and
specify the type of output file you want to create, e.g. *.GIS por GeoTIFF.. Make sure
the input file and the output file are in the same directory. Then click O.K.

10
Now open a new viewer and specify at the bottom of the viewer that you are looking for a
*.gis file rather than a *.img file and open the Marco_band_3.gis file. It should contain
all of your density sliced information. It is also ready to be used by other GIS programs
such as ArcGIS 9.3 that can read the ERDAS *.gis data format. An ERDAS *.gis file also
has a companion *.trl (trailer) file that must be transmitted along with the *.gis file.

Please provide me with a view of your NIR band 3 density-sliced image. I will be
looking for:

- Are the 3 land cover classes represented correctly (i.e. are the class
threshold boundary choices you mad reasonable)?

- Were there 3 different colors assigned to the 3 different classes?

- Do the colors reasonably represent thee land cover classes (e.g. red for
water would be a poor choice, etc.)

11

You might also like