Compare Image and Reference Spectra
Lesson content
Lesson 1 of 1
Compare Image and Reference Spectra
In this quick guide, you will:
- •
Open and display an AVIRIS-3 reflectance image. * •
Collect and compare reflectance image spectra in the same plot window. * •
Plot different mineral spectra from a spectral library. * •
Resample custom library spectra to match the wavelength range and sampling interval of image spectra.
Sample Data
Download sample data below. Then extract the contents of the .zip file to a local directory.
[AVIRIS3_Refl_Preprocessed.zip
888.8 MB
DownloadArrow down with horizontal line beneath it](assets/AVIRIS3_Refl_Preprocessed.zip)
Open and Display a Reflectance Image
- 1
From the Menu bar, select File > Open. An Open dialog appears. 2. 2
Go to the location where you saved the sample data, and select the file AVIRIS3_Refl_Preprocessed.dat. 3. 3
Click Open. ENVI displays the image with an approximate true-color representation. 4. 4
Press the F12 key on your keyboard to see the full extent of the image.

This is an AVIRIS-3 image that was calibrated to surface reflectance using the Quick Atmospheric Correction (QUAC®) tool in ENVI. Reflectance values range from 0 to 1. The image covers the Mountain Pass Mine in California.
View Image Spectra
ENVI can extract horizontal (X), vertical (Y), and spectral (Z) profiles from any image display. See the View Profiles quick guide for more information. Hyperspectral data analysis is primarily concerned with extracting spectral profiles, which take spectral information from the whole file and not just the bands displayed on the screen. For example, the file AVIRIS3_Refl_Preprocessed.dat has 257 bands, so a spectral profile for any given pixel will show the reflectance values for all 257 bands.
- 1
Right-click on AVIRIS3_Refl_Preprocessed.dat in the Layer Manager and select Profiles > Spectral. Red crosshairs appear in the Image window, and a Spectral Profile plots the reflectance values for the selected pixel at the intersection of the crosshairs.

- 2
Note the shape of the reflectance curve. It has two straight lines noted in the image below. These parts of the spectrum represent bands that were removed from the original image because they had severe noise from the water vapor and CO2 absorption regions.

- 3
You can also display reflectance curves for multiple pixels in one plot. Press and hold the Shift key on your keyboard, then click on a different pixel in the Image window. The reflectance curve for that pixel is displayed in a different color in the plot window. 2. 4
Click the small right-facing "Show" arrow on the right side of the Spectral Profileto display plot and curve properties. Here, you can see the colors and image coordinates of the pixels associated with both curves.

These two image spectra represent unknown materials. Next, you will compare them to a library spectrum that represents ground-truth data.
View Library Spectra
A common workflow in hyperspectral data analysis is to compare spectra derived from image data to those collected in the field or laboratory. Absorption and reflectance features are easy to compare when the spectra are plotted in the same window.
Included with your installation of ENVI are several groups of laboratory spectra from the NASA Jet Propulsion Laboratory (JPL), Johns Hopkins University (JHU), and the U.S. Geological Survey (USGS). Spectral libraries are stored in ENVI spectral library (.sli) format, with each line of the image corresponding to an individual spectrum and each sample corresponding to an individual spectral measurement at a specific wavelength.
Your study area may only have a limited number of different materials; however, spectral libraries contain spectra for dozens or hundreds of materials.
- 1
From the menu bar, select Display > Spectral Library Viewer. 2. 2
On the left side of the Spectral Library Viewer, expand the usgs_v7 folder, followed by the minerals_asdng.sli collection. 3. 3
Click on the Muscovite_GDS116_Tanzania_ASDNGaspectrum and note the shape and detail of the reflectance curve. Also note how the wavelengths are scaled differently from those of the image spectra in the Spectral Profile.

- 5
Click the small right-facing "Show" arrow on the right side of the Spectral Library Viewerto display plot and curve properties. 2. 6
Click the Curve tab in the plot properties. 3. 7
Click the Color field and select a shade of blue.

- 8
Select the *Muscovite_GDS116_Tanzania_ASDNGa spectrum name from the plot key of the Spectral Library Viewer, and drag it to the Spectral Profile. The library spectrum is added to the Spectral Profile*.

The reflectance curve of muscovite looks different than the image spectra. Plotting spectra in the same window allows you to visually compare their shapes and absorption features.
The two spectra taken from the reflectance image do not necessarily represent muscovite. They may completely different materials. The purpose of this exercise is to demonstrate comparing image spectra with library spectra.
Ensure Consistency Between Image and Library Spectra
You could plot the spectra of other known materials from the spectral library, but with hundreds of spectra available, that would take too much time. ENVI has automated tools such as Spectral Feature Fitting (SFF) and Spectral Angle Mapper (SAM) that evaluate the similarity between unknown and reference materials. Those tools require you to directly compare spectral endmembers extracted from an image with library spectra.
Image and library spectra must be consistent with each other in terms of:
- •
Units: reflectance, downwelling radiance, etc. For example, a spectral library that contains reflectance values cannot be directly used with an image whose pixels represent radiance. * •
Scaling: Does reflectance in one spectrum range from 0 to 1, while the other ranges from 0 to 1000? * •
Wavelength range: Both library and image spectra should have overlap in the range of wavelengths. A material of interest may not be identified in an image if the bands do not cover the same range as the reference spectra. * •
Sampling interval: Spectrometer measurements are typically collected at around 1 nm spacing, while hyperspectral sensor spectral resolutions are typically between 5 nm and 10 nm.
Notice how the wavelength ranges are slightly different: The image spectra range from 450 to 2,500 nm. The muscovite library spectrum starts at 400 nm and extends to 2,500 nm. Also, this can be difficult to visualize in the plot window, but their sampling intervals are different. The reflectance data points captured by a spectrometer (for the spectral library) are only a few nanometers apart, whereas the image reflectance data points are approximately 7.5 nm apart.
To alleviate these inconsistencies, you can resample the library spectra to the image spectrum.
Resample Library Spectra
- 1
In the search window of the Toolbox, enter resampling. 2. 2
Double-click the Spectral Library Resampling tool. The Spectral Resampling Input File dialog appears. 3. 3
Click the Open drop-down button at the bottom of the dialog and select Spectral Library. A file selection dialog appears. 4. 4
Go to the following directory in your ENVI installation path. (xx is the version number.)
Windows: C:\Program Files\NV5\ENVIxx\resource\speclib\usgs_v7
Linux: /user/local/NV5/envixx/resource/speclib/usgs_v7
Mac: /Applications/NV5/envixx/resource/speclib/usgs_v7
5. 5
Select minerals_asdng.sli and click Open. 6. 6
Click OK in the Spectral Resampling Input File dialog. The Spectral Resampling Parameters dialog appears. 7. 7
Select the Input Data File option. 8. 8
Enter an output filename of USGSv7_Minerals_Resampled.sli.

- 9
Click OK. The File Containing Output Wavelength dialog appears. This is where you select the image that the library spectra should be resampled to. 2. 10
Select AVIRIS3_Refl_Preprocessed.dat and click OK. The resampling process begins. When it is complete, USGSv7_Minerals_Resampled.sli is added to the Spectral Library Viewer.

*Plot Image Spectra and Resampled Library Spectra*
- 1
Select Display > New Plot Window from the ENVI Menu bar. An empty ENVI Plot window appears. You will use this to collect both library and image spectra. 2. 2
In the Spectral Library Viewer, select a few minerals under USGSv7_Minerals_Resampled.sli (one at a time) and drag them to the ENVI Plot window. The resampled spectra are plotted there.

- 3
Click the right-facing "Show" arrow on the right side of the ENVI Plot window to view the plot properties and spectrum names.

- 4
In the property sheet of the Spectral Profile, select one image spectrum (red or green) and change its color to orange.

- 5
Drag that spectrum name from the Spectral Profile to the ENVI Plot window.

The Scale Incoming Curve Data dialog appears.
- 6
You do not need to make any changes in this dialog. Click OK to dismiss it. The image and library spectra are now displayed together in one plot window. They have the same X and Y data ranges and the same sampling interval.

This quick guide demonstrated how to visually compare image spectra with library spectra in a plot window. If the two are sampled differently, you can resample one to the other so that they have the same wavelength ranges and sampling intervals.
The AVIRIS-3 image and resampled spectral library of minerals can be used together in hyperspectral analysis.
Your input is important to us, please take a few moments to fill out ourQuick Guide Feedback(opens in a new tab)form.
© 2024 NV5 Geospatial Solutions, Inc. This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR).