>  Docs Center  >  Using ENVI  >  Classification Tutorial 1: Create an Attribute Image


Classification Tutorial 1: Create an Attribute Image

Classification Tutorial 1: Create an Attribute Image

This tutorial is the first in a two-part series about preparing data for image classification. It requires ENVI 5.4 or later and will take approximately one hour to complete.

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

Tutorial files are available from our website or on the ENVI Resource DVD in the classification directory. Copy these files to your local drive.

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.




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:

  • Band 19: Blue (0.4724 µm)
  • Band 34: Green (0.5476 µm)
  • Band 52: Red (0.6378 µm)
  • Band 97: Near-infrared (0.8632)

The image has a spatial resolution of 0.5 meters.


ENVI header file for above


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.


ENVI header file for above


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:

  1. Start ENVI.
  2. Click the Open button in the toolbar.
  3. 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.
  4. Open the Data Manager to see all four bands.
  5. 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.
  6. Click the Open button in the toolbar.
  7. Select Height.dat. Click Open. The pixel values in this image represent height, in meters.
  8. Click the Cursor Value button in the toolbar.
  9. 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.
  10. Close the Cursor Value window.
  11. 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

  1. In the Search window of the Toolbox, type indices.
  2. Double-click the Spectral Indices tool.
  3. In the File Selection window, select NEONUrban.dat and click OK.
  4. In the Index list, select Enhanced Vegetation Index.
  5. Choose a folder for the output file, and name the file EnhancedVegetationIndex.dat.
  6. Enable the Display result option.
  7. 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

You will use the ENVI Layer Stacking tool to combine the different datasets into one image. This tool requires images to have the same dimensions, pixel sizes, and spatial reference (map projection).

  1. In the Search window of the Toolbox, type layer stack.
  2. Double-click the Layer Stacking tool.
  3. In the Layer Stacking Parameters dialog, click the Import File button.
  4. In the Layer Stacking Input File dialog, use the Ctrl key to select the following files. Click OK.
    • EnhancedVegetationIndex.dat
    • Height.dat
    • NEONUrban.dat
  5. Choose a folder for the output file, and name the file AttributeImage.dat.
  6. Leave the other parameters at their default values, and click OK.
  7. When processing is complete, the attribute image appears in the Image window.
  8. Open the Data Manager to see all of the bands in the attribute image:

Notice how ENVI retains all of the processing steps in the band names. This helps to record the history of how datasets were created; however, it can result in lengthy band names. In the next section, you will shorten the band names.

Rename Bands of the Attribute Image

You can use the Edit ENVI Header tool to edit ENVI header fields, including band names.

  1. In the Search window of the ENVI Toolbox, type edit envi.
  2. Double-click the Edit ENVI Header tool.
  3. In the File Selection dialog, select AttributeImage.dat and click OK.
  4. Look for the Band Names section in the Edit ENVI Header dialog.
  5. Click the first band name, Layer (Enhanced Vegetation Index...).
  6. In the Edit field, type Enhanced Vegetation Index and press the Enter key.
  7. Rename the bands as follows, pressing the Enter key after each entry:
  8. Original band name

    New band name

    Layer (Band Math (b1-b2):Height.dat)


    Layer (Band 19:NEONUrban.dat)

    Blue reflectance

    Layer (Band 34:NEONUrban.dat)

    Green reflectance

    Layer (Band 52:NEONUrban.dat)

    Red reflectance

    Layer (Band 97:NEONUrban.dat)

    NIR reflectance

  9. Enable the Display result option.
  10. Click OK. The Layer Manager shows the attribute image, and the first band (Enhanced Vegetation Index) is displayed in the Image window.
  11. Use the Data Manager to verify that the band names are correct:
  12. 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.

Next Steps

In the next tutorial, you will define regions of interest (ROIs) that contain training data. See Classification Tutorial 2: Collect Training Data

© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us