Classification Tutorial 1: Create an Attribute Image
This tutorial is the first in a two-part series about preparing data for image classification.
Before running an unsupervised or supervised classification, you should consider including different attributes in the source image rather than spectral information alone. This is optional, but it may ensure more accurate results with classification. Attributes are unique characteristics that can help distinguish between different objects in an image. Examples include elevation, texture, and shape. Creating an attribute image is an example of data fusion in remote sensing. This is the process of combining data from multiple sources to produce a dataset that contains more detailed information than each of the individual sources.
In this tutorial, you will learn how to:
- Create individual images of spectral, spatial, and elevation attributes.
- Create a layer-stacked image where each band represents a different attribute.
See the following sections:
- Files Used in this Tutorial
- Background
- Getting Started
- Create an Enhanced Vegetation Index Image
- Create an Attribute Image
- Rename Bands of the Attribute Image
Files Used in this Tutorial
Tutorial files are available from our ENVI Tutorials web page. Click the Classification link to download the .zip file to your machine, then unzip the files.
Data files were provided by the National Ecological Observatory Network, 2014. Files were accessed in July 2016, available online at http://data.neonscience.org from the National Ecological Observatory Network (NEON), Boulder, CO, USA.
File |
Description |
---|---|
NEONUrban.dat |
Spatial and spectral subset of a reflectance image derived from the NEON imaging spectrometer. This image was acquired on 17 July 2013 near the town of Fruita, Colorado. Out of the original 426 spectral bands, only four essential bands were extracted for use with this tutorial:
The image has a spatial resolution of 0.5 meters. |
NEONUrban.hdr |
ENVI header file for above |
Height.dat |
This image was created by subtracting a digital elevation model (DEM) from a digital surface model (DSM) to yield height values in meters. The image has 0.5 meter resolution. The DSM and DEM images were created in ENVI LiDAR from NEON point cloud data. |
Height.hdr |
ENVI header file for above |
Background
To effectively train and evaluate a classification algorithm (or classifier), the source image should contain a variety of different attributes, in addition to spectral information. You can probably think of different attributes that would help uniquely identify objects in a remote sensing image:
- Height
- Shape
- Texture: variance, entropy, dissimilarity, and others
- Reflectance at 900 nanometers
- Saturation
- Normalized difference vegetation index (NDVI)
You can create raster images of each attribute and combine them into a layer stack in ENVI. Each band must have the same number of rows and columns, and they should all be georeferenced to the same map projection.
You do not necessarily want to include every attribute you can possibly derive. Having too many attributes may actually introduce more error into the classification. The key is to come up with a few attributes that will best identify the surface features that you want to classify.
The choice of attributes depends on the granularity of the classification. For example, will you discriminate between sidewalks, asphalt, and rooftops? Or will you have one impervious class? Will you discriminate between different vegetation species or only identify a few classes such as trees, shrubs, and grasses? Species mapping involves higher-resolution imagery and specific attributes such as a narrow-band vegetation indices, canopy height, and texture/roughness.
This tutorial series will demonstrate how to classify an urban scene with five simple classes: Buildings, Trees, Grass, Concrete, and Asphalt.
Getting Started
Follow these steps:
- Start ENVI.
- Click the Open button in the toolbar.
- Navigate to the location where you saved the tutorial files, and select
NEONUrban.dat
. Click Open. A true-color composite appears in the Image window. - Open the Data Manager to see all four bands.
- This image may initially appear too dark. Use the Stretch Type drop-down list to select a different stretch, if needed. Also experiment with the Brightness and Contrast sliders.
- Click the Open button in the toolbar.
- Select
Height.dat
. Click Open. The pixel values in this image represent height, in meters. - Click the Cursor Value button in the toolbar.
- Click in different parts of the height image. The Cursor Value window reports the pixel value under the red crosshairs. The brightest objects such as trees and buildings show higher pixel values in the Cursor Value window.
- Close the Cursor Value window.
- Use the Transparency slider in the toolbar to increase the transparency so that you can view the
NEONUrban.dat
layer underneath. You can see how the images are co-registered so that pixels from both images exactly line up.
So far you have spectral and elevation data that can be used to build an attribute image. The elevation data will help to classify the trees and buildings. A vegetation index will also help to identify grasses and trees. You will create an Enhanced Vegetation Index (EVI) image next.
Create an Enhanced Vegetation Index Image
- In the Search window of the Toolbox, type indices.
- Double-click the Spectral Indices tool.
- In the File Selection window, select
NEONUrban.dat
and click OK. - In the Index list, select Enhanced Vegetation Index.
- Choose a folder for the output file, and name the file
EnhancedVegetationIndex.dat
. - Enable the Display result option.
- Click OK. When processing is complete, the Enhanced Vegetation Index image appears in the Image window.
You can create other vegetation indices if you want. The Enhanced Vegetation Index was chosen because it does a good job of delineating trees and grass, while suppressing the signature of concrete and asphalt. It provides good contrast between the vegetation and pavement features, which may help with classification of these features.
Now that you have created images for spectral, elevation, and vegetation index attributes, you can combine them into a single image called an attribute image.
Create an Attribute Image
In this section you will use the Build Band Stack tool to combine the different datasets into one attribute image.
- In the Search window of the Toolbox, type band stack.
- Double-click the Build Band Stack tool. The Build Band Stack dialog appears.
- Click the Browse button next to Input Rasters.
- In the Data Selection dialog, use the Ctrl key to select the following files. Then click OK.
EnhancedVegetationIndex.dat
Height.dat
NEONUrban.dat
- In the Input Rasters field, click and drag the files to reorder them as follows:
- Choose a folder for the output file, and name the file
AttributeImage.dat
. - Leave the other parameters at their default values.
- Disable the Display result option.
- Click OK.
- When processing is complete, open the Data Manager to see all of the bands in the attribute image:
In the next section, you will provide more meaningful names to the bands.
Rename Bands of the Attribute Image
You can use the Edit ENVI Header tool to edit ENVI header fields, including band names.
- In the Search window of the ENVI Toolbox, type edit envi.
- Double-click the Edit ENVI Header tool.
- In the Data Selection dialog, select
AttributeImage.dat
and click OK. - Look for the Band Names section in the Edit ENVI Header dialog.
- Click the first band name, Band 1 (Enhanced Vegetation Index...).
- In the Edit field, type Enhanced Vegetation Index and press the Enter key.
- Rename the bands as follows, pressing the Enter key after each entry:
- Enable the Display result option.
- Click OK. The Layer Manager shows the attribute image, and the first band (Enhanced Vegetation Index) is displayed in the Image window.
- Use the Data Manager to verify that the band names are correct:
- You can select each band in the Data Manager and click the Load Grayscale button to view that band. Or, right-click on
AttributeImage.dat
in the Layer Manager and select Band Animation to animate through the bands.
Original band name |
New band name |
---|---|
Band 2 (Band Math (b1-b2):Height.dat) |
Height |
Band 3 (Band 19:NEONUrban.dat) |
Blue reflectance |
Band 4 (Band 34:NEONUrban.dat) |
Green reflectance |
Band 5 (Band 52:NEONUrban.dat) |
Red reflectance |
Band 6 (Band 97:NEONUrban.dat) |
NIR reflectance |
Now that you have created an attribute image, you can use it with any of ENVI's classification tools. If you plan to do supervised classification, you will need to collect training data. Refer to Classification Tutorial 2: Collect Training Data for instructions on how to do this.