The binary encoding classification technique encodes the data and endmember spectra into zeros and ones, based on whether a band falls below or above the spectrum mean, respectively. An exclusive OR function compares each encoded reference spectrum with the encoded data spectra and produces a classification image. All pixels are classified to the endmember with the greatest number of bands that match, unless you specify a minimum match threshold, in which case some pixels may be unclassified if they do not meet the criteria.


Mazer, A. S., M. Martin, M. Lee, and J. Solomon. "Image Processing Software for Imaging Spectrometry Analysis." Remote Sensing of Environment 24, No. 1 (1988): 201-210.

  1. Use the ROI Tool to define training regions for each class. The more pixels and classes, the better the results will be.
  2. Use the ROI Tool to save the ROIs to an .roi file.
  3. Display the input file you will use for Binary Encoding, along with the ROI file.
  4. Select one of the following:
    • From the Toolbox, select Classification > Supervised Classification > Binary Encoding Classification.
    • From the Endmember Collection dialog menu bar, select Algorithm > Binary Encoding.
  5. The Classification Input File dialog appears.

  6. Select the input file and perform optional spatial and spectral subsetting, and/or masking, then click OK. The Binary Encoding Parameters dialog appears.
  7. In the Select Classes from Regions list, select ROIs and/or vectors as training classes. The ROIs listed are derived from the available ROIs in the ROI Tool dialog. The vectors listed are derived from the open vectors in the Available Vectors List.
  8. Select one of the following thresholding options from the Set Minimum Encoding Threshold area:
    • None: Use no threshold.
    • Single Value: Use a single threshold for all classes. Enter a decimal percentage value (from 0.0 to 1.0) in the Minimum Encoding Threshold field. The percentage value represents the number of bands that must match.
    • Multiple Values: Enter a different threshold for each class. Use this option as follows:
  9. In the list of classes, select the class or classes to which you want to assign different threshold values and click Multiple Values. The Assign Minimum Encoding Threshold dialog appears.
  10. Select a class, then enter a threshold value in the field at the bottom of the dialog. If you do not enter a minimum value, ENVI classifies all pixels. Repeat for each class. Click OK when you are finished.
  11. Select classification output to File or Memory.
  12. Use the Output Rule Images? toggle button to select whether or not to create rule images. Use rule images to create intermediate classification image results before final assignment of classes. You can later use rule images in the Rule Classifier to create a new classification image without having to recalculate the entire classification.
  13. If you selected Yes to output rule images, select output to File or Memory.
  14. Click Preview to see a 256 x 256 spatial subset from the center of the output classification image. Change the parameters as needed and click Preview again to update the display.
  15. Click OK. ENVI adds the resulting output to the Layer Manager. If you selected to output rule images, ENVI creates rule images for each class with the pixel values equal to the percentage (0-100%) of bands that matched that class. Areas that satisfied the minimum threshold are carried over as classified areas into the classified image.