Lab: Introduction to ENVI Part I

advertisement
Lab #1 Manipulating Files in ENVI
Name:
Lab #1: FOR 504 Advanced Topics in Remote Sensing
Objectives of this laboratory exercise:
Introduce the student to the options and commands in ENVI in order to:
• import, analyze, and output image data
• create and use region of interest files
The questions provided within this lab are designed to help the student better understand the
practical details of programming in IDL and are recommended but are not for assessment.
Location:
RS/GIS Lab
Login:
Password:
XXXX
XXXX
1
Before you start:
Double click the ENVI icon on the desktop:
ENVI 4.0.lnk
This starts both ENVI (The Environment for Visualizing Images) and the IDL (Integrated
Development Language) programming interface
Ignore IDL but don’t close it as this closes ENVI as well.
Task # 1
1.1
Opening and Viewing an existing image file in ENVI
Viewing an Image
With your mouse pointer, select File/Open image file and by using Browse select the file you
want to open (image1) and press ok. This will open the available bands list. Double clicking on
Band1 of image1 will load the image in Display. Selecting the Map info tab in the Available
bands list provides you with the projection information of the image.
2
The first thing you will notice is that there is more than 1 viewer window.
For this image, there are the ‘Main Image Window’ and the ’Zoom Window’. The Zoom window
contains the contents of the red box seen in the Main image window. In larger images the
contents of the Main Image Window are themselves a small red box in a ‘Scroll Window’, which
contains the complete image.
Try moving the Main Image Window around the computer screen – you will see that the Zoom
window remain locked in place. To move each window separately, right click on the Main Image
Window to bring up the Main Image Options Menu:
This menu gives you a number of options.
However, for now we only want the Scroll/Zoom
Position option.
By Selecting Auto Placement Off – you can move
the separate windows without the others
following.
I recommend this as it is much easier to analyze
and manipulate data with this option selected.
1.2
Using the Zoom Window
Concentrate only on the Zoom Window.
To move the red box, left click anywhere within the Main Image Window.
You can create a ‘dynamic link’ with the zoom window (i.e. if you move the red box around the
zoom contents will automatically change) by clicking anywhere outside the red box on the image
window. Now hold down the left mouse button and move it around the Main Image Window.
If you click inside the red box, this link will not happen.
In the bottom left hand corner of the zoom window, there are three icons:
Zoom Out
Zoom In
Show Crosshair
Now left click anywhere in the zoom window and when holding the left mouse button down,
move the mouse up, down, left, and right. You should see that the location of the red box and the
contents of the zoom window change as you move the mouse around. This is another technique
to navigate with the zoom window.
To clear files in the Available bands list select File/Close all Files from the Available Bands list
menu bar. Do this.
3
1.3
Opening a Satellite Sensor File
ENVI can open several different types of file format. In the last two stages, we dealt with a basic
ASCII file. However, as a plethora of remote sensing systems exist, ENVI has been adapted to
be able to read multiple different file formats.
In this stage, we are going to import the visible to mid infrared bands of some MODIS data.
Instead of using Open Image
File, instead select, Open
External
File/EOS/MODIS
1B.
This will produce the typical
Browse option to look for a
suitable file. In the ATRS
folder select the available .hdf
file.
As
ENVI
version
4
automatically detects MODIS
level 1B data. This will open
two files: one in radiance and
the other in reflectance. Through this route, you cannot get a file with simple DN values.
However, if you opened this file using the File/Open Image File
option, you would get the following window:
Select Earth View 500M Solar Bands Scaled Integers to get the
MODIS bands 1-7 DN Values (After selecting BSQ as the file type
in the next window).
4
With the reflectance data you can produce a true color version of the image. This is done by first
selecting the RGB option at the bottom of the Available Bands list box and assigning the correct
bands to the R, G, and B
Note that in lecture 1 the MODIS
bands associated with blue, green
,red, and near infrared are not
simply bands 1,2,3,& 4.
Band 1 = Red
Band 2 = NIR
Band 3 = Blue
Band 4 = Green
Therefore, to display a RGB
MODIS image you need to select
R=1; G=4; & B=3
The first thing you will notice is
the image is VERY dark.
This
is
because
ENVI
automatically sets the histogram
stretch to cover the whole range
of pixel values. Thus if a few
number of very bright pixels are present (snow, cloud, ice, etc) all the darker pixels just appear
black.
To see this image better, we need to move the limits of each of the red, green, and blue
histograms. This is done by selecting Enhance/Interactive Stretching from the Main Image menu
bar:
5
Now left click on the right hand side vertical dotted line and when holding the left mouse button
down drag the line left until it is placed at the edge of the normal looking distribution. Then
select the G button and repeat this for both the green and blue histograms.
After repeating this task for all three options, press Apply and if the image looks ok close this
window and move the red box in the Scroll Window onto the dark feature 2/3rds the ways down
the image on the left hand side:
Identify:
This dark feature:
The blue stuff at the top-right hand side of the Main image:
Justify this answer (Hint: use bands 5,6, or 7):
The white feature in the bottom middle of the Main image?
6
1.4
Creating a Subset of an Image
Using the menu ENVI menu bar Select Basic Tools/Resize Data (Spatial/Spectral), select the
first (the Reflectance data) MODIS image.
What you will notice is when
you select the file, information
is displayed on the right hand
side.
On the bottom of this window,
there are several options.
Spatial subset allows you to
only select a small area of the
total image.
Spectral Subset allows you to
select which combination of
bands you want to subset (i.e.
1, 2, … or all)
File allows you can select a previously subsetted file and this command will make your chosen
file the same size and dimensions. The other options will be covered in a later exercise.
Select Spatial Subset:
You can subset an image in several ways:
1.
2.
3.
4.
5.
Typing in the exact samples and lines
By selecting the Area on one of the Image bands
Typing in exact map coordinates
Comparing this image with an existing file
Subsetting data within a defined region of Interest
(ROI) – we will come to this in the next stage
6. Using the Scroll function – ignore.
Select Image, move the box around, and then press ok.
You will notice that the sample and line numbers will
change. When using Image you can change the size of
the box by either entering a larger size or by clicking on
a corner of the red box and dragging the mouse.
7
Using the sample and lines option enter the following numbers and press ok:
Now select Spectral Subset and highlight only the Red, Green, and Blue bands:
Now press ok, and again press ok on the main subset box. This will bring up a window asking
you to either save this image on the computer or to save it in the computer’s memory.
Select Choose and call the image: subset1 and save it under C:\ATRS.
Next, select subset 1 from the Available bands list and display the RGB image. Remember that
B1=Red; B4=Green; and B3=Blue. Display the image.
8
Identify and Justify with other bands:
The dark feature:
1.5
Creating and Using Regions of Interest (ROIs)
This stage will describe how to produce and use regions of interest in ENVI. This stage is
important, as we will be using this function a lot in this course. For more examples
In the Main image menu bar, select Tools/Region of
Interest/ROI Tool to display this window:
The Window options allow you to select which of the
Image windows you want to create the region of
interest in. i.e.
Image - create ROIs in the IMAGE window
Scroll - create ROIs in the SCROLL window
Zoom - create ROIs in the ZOOM window
Off – can select any window without creating a ROI.
ROI Window Options:
- To select a new region, simply press New Region.
- To name a region, select Edit and in a name for each region.
- To keep a region but remove it from the window display, select the region and press Erase.
- To completely delete a region, select the region and press Delete.
- The File menu bar option allows you to save, restore, import, and export ROIs
- ROI type Menu bar option allows you to set whether you are drawing a polygon, polyline,
pixel, rectangle, or ellipse.
- The Stats button produces the min, max, mean, and standard deviation for each band of the
selected ROI
9
- Many more options are contained in the options menu, but we will cover these later
Producing a ROI
Select ROI_type/Pologon and make sure Zoom is selected.
Using the mouse produce a polygon (you choose the shape) within the dark feature in the middle
of the image:
Now on the ROI window box select New Region. Next click on the upper left hand corner of the
Main Image window and draw a second polygon in the dark green area.
Next create a new region and create a third polygon in
the lighter area beside the dark green area:
Next press Edit and Name the ROIs as red=burned; green=trees; and blue=grass.
Next select File/Save ROIs and select press Select all Items. Finally, save this ROI file as
subsetroi in the C:/ATSR directory.
Now that we have these regions, we can do a number of useful things with them.
Selecting Options/Stats for all Regions –produces the min, max, mean, and standard deviation
for each band of EACH ROI.
Likewise selecting Options/Mean for all Regions – produces the mean value for each band of
EACH ROI in a graphical format.
10
Subsetting and Image with the ROIs
Refer back to stage 1.4 and use the Basic Tools/Subset Data with ROIs option from the Main
ENVI menu bar.
Select subset1 and don’t press the spectral subset option as
we will subset each band.
Next, select only the burned ROI and select the option to
mask all the pixels outside of the ROI. This converts all
these pixels to a set value (default = 0) and keeps the
values in the ROI as they were.
Next, choose a suitable file name and press ok.
This produces a new file in the Available Bands list which
only contains the values contained in the burned ROI.
Now, experiment and try this again with one, two, or all of
the ROIs and with different masks/no masks.
Creating a Supervised Classification
The final task of this lab will be to use the ROIs to produce a supervised classification of the
subsetted image.
From the Main ENVI menu bar select Classification/Supervised/Maximum Likelihood
Next select subset1 and press ok. This will display the maximum likelihood window.
In this window, ONLY select all the ROIs, select no to providing rule images, and provide a
filename and then press ok:
11
This will produce a new file in the available bands list, which is a classified version of subset1.
Next display the image.
Describe:
How good do you think the classification is?
How could the classification be improved?
12
Download