Scale and Mask Reflectance Images
Lesson content
Lesson 1 of 1
Scale and Mask Reflectance Images
In this quick guide, you will:
- •
Open and display a surface reflectance image. * •
Scale the pixel values so they range from 0 to 1. * •
Apply a mask that sets outlier values above 1 to "NoData."
Sample Data
Download sample data below. Then extract the contents of the .zip file to a local directory.
[AVIRIS3_Reflectance.zip
691.6 MB
DownloadArrow down with horizontal line beneath it](assets/AVIRIS3_Reflectance.zip)
Open and Display a Surface 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_MountainPassCA.dat. 3. 3
Click Open. The image is added to the Layer Manager and displayed in the Image window. This is an AVIRIS-3 hyperspectral image of the Mountain Pass Mine in California.

The image was corrected for atmospheric effects using the Quick Atmospheric Correction (QUAC®) tool in ENVI, using the steps in the Preprocess AVIRIS-3 Radiance Data quick guide.
Data values in a reflectance image represent the percentage of reflectance (0 to 100%). QUAC automatically scales reflectance data by 10,000 to produce integer data, which consumes less disk space than floating-point data. For example, a pixel value of 3900 represents a reflectance value of 0.39 or 39% reflectance in that band.
If you plan to compare image spectra to reference spectra—such as a spectral library or spectrometer data—then image reflectance values should range from 0 to 1 instead of 0 to 10,000. This is because most spectral libraries and spectrometer reflectance values range from 0 to 1. Scaling your reflectance image to the same range will facilitate direct comparison.
This is not always a mandatory step. It depends on your intended application. Scaling is not necessary if you are computing a simple band ratio or spectral index that divides one band by another.
For this exercise, you will use the Band Math tool to divide the reflectance values by 10,000.
Scale Reflectance Data
- 1
In the search window of the Toolbox, enter band math. 2. 2
Double-click the Band Math tool. The Band Math dialog appears. 3. 3
In the Enter an expression field, enter b1 / 10000. Be sure to add a period at the end. This will create a floating-point image. 4. 4
Click the Add to List button. The expression is added to the Previous Band Math Expressions field.

- 5
Click OK. The Variables to Band Pairings dialog appears. 2. 6
Click the Map Variable to Input File button. The Band Math Input File dialog appears. 3. 7
Select *AVIRIS3_Refl_MountainPassCA.datand click OK. The Band Math Input File* dialog is dismissed. The mathematical expression will apply to all bands of the reflectance image. 4. 8
Enter an output filename of AVIRIS3_Refl_Scaled.dat. 5. 9
Click OK in the Variables to Band Pairings dialog. ENVI applies the mathematical expression to the entire image. When processing is complete, the scaled reflectance image is added to the Layer Manager and displayed in the Image window. It does not look any different than the original image.
Next, you will inspect the range of reflectance values in each band to look for and remove outliers.
Inspect Reflectance Values
Sometimes the QUAC and FLAASH atmospheric correction tools can produce images with a few pixels that have DNs below 0 or above 1. If so, those pixels did not model well during the atmospheric correction process. Values above 1 could be caused by clouds or other highly saturated features in the image. Depending on how much they extend below 0 or above 1, you can either create a mask to ignore those pixels, or you can set them to 0 or 1, respectively.
- 1
In the Layer Manager, right-click on AVIRIS3_Refl_Scaled.dat and select Quick Stats. Two progress dialogs show the status of computing statistics, then the Statistics View dialog appears. 2. 2
Review the Basic Stats table in the lower half of the dialog. Scroll through all of the bands.

None of the "Min" values fall below 0; however, all of the "Max" values are above 1. The top red line in the histogram represents the maximum pixel values across all bands.

However, the "Mean" column and the black line in the histogram show that mean pixel values are generally centered around 0.2. Pixels with values above 1 are few and far between. These outliers can impact the accuracy of spectral analysis; they should be excluded from this image using a mask.
- 3
Close the Statistics View dialog.
Apply a Mask
For this exercise, you will use a mask that has already been created. It sets pixels with values above 1 to "No Data" so that ENVI will ignore them when the image is used for spectral analysis. See the Create and Apply Masks quick guide for instructions on creating masks.
In the following steps, you will create a copy of the AVIRIS3_Refl_Scaled.dat image with the mask applied.
- 1
Select File > Open from the Menu bar. 2. 2
Go to the location where you saved the sample data, and select the file ClipMask.dat. 3. 3
Click Open. The mask is added to the Layer Manager and displayed in the Image window. Most of the mask image have pixels with a value of 1 (white). When you apply the mask to the scaled reflectance image, those pixels will retain their original values. The black pixels in the mask correspond to pixels in the reflectance image whose values were above 1. Those pixels are circled in red below. They are mostly associated with highly saturated pixels over white buildings and vehicles.

- 4
Uncheck all of the layers in the Layer Manager to hide them. 2. 2
From the Menu bar, select File > Save As > Save As (ENVI, NITF, TIFF, DTED). The Data Selection dialog appears. 3. 3
Select AVIRIS3_Refl_Scaled.dat. 4. 4
Click the Mask button. The Mask Selection dialog appears. 5. 5
Select ClipMask.dat, then click OK.

- 6
Cick OK in the Data Selection dialog. The Save File As Parameters dialog appears. 2. 7
Enter 0 in the Data Ignore Value field. 3. 8
Click the Browse button next to Output Filename. 4. 9
Navigate to a preferred output directory, and name the output file: AVIRIS3_Refl_Preprocessed.dat. 5. 10
Click OK. When processing is complete, the masked reflectance image is added to the Layer Manager and displayed in the Image window. 6. 11
In the Layer Manager, right-click on AVIRIS3_Refl_Preprocessed.dat and select Quick Stats. The Statistics View dialog appears. 7. 12
Verify that none of the pixel values in the "Max" column exceed 1.0. Notice that the top red line in the histogram (which represents maximum pixel values) does not go above 1.0.

- 13
This concludes the exercise.
You now have a surface reflectance image whose values range from 0.0 to 1.0, representing 0 to 100% reflectance. You can use this image in spectral applications that compare image spectra with library spectra.
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).