This workflow allows you to extract segments only without performing rule-based or example-based classification. After you choose your segmentation options, ENVI will compute spatial, spectral, and texture attributes and will generate a segmentation image to which you can add your own attributes or classify however you choose.

This tool requires a separate license for ENVI Feature Extraction; contact your sales representative for more information.

You can also write a script to extract segments using the FXSegmentation task.

Select Input Files for Feature Extraction


For best results with Feature Extraction, consider preprocessing your imagery to reduce noisy or redundant data, to correct for atmospheric effects, or to suppress vegetation. See Preprocess Imagery for available options.

For hyperspectral imagery, it is strongly recommended that you run a principal components analysis or independent components analysis on the dataset before using it in Feature Extraction. Segmentation and merging work best on datasets with only a few bands.

Also consider reducing the spatial resolution of your input image to speed up processing and to remove small, unwanted features. For example, you can down-sample a 10,000 by 10,000 pixel image by a factor of 10 to yield a 1,000 by 1,000 pixel image.

  1. From the Toolbox, select Feature Extraction > Segment Only Feature Extraction Workflow. The Data Selection panel appears.
  1. Click the Browse button and select a panchromatic or multispectral image for input using the Data Selection dialog. Feature Extraction accepts any image format listed in Supported Data Types.
  2. To apply a mask, select the Input Mask tab in the File Selection panel. In addition to the mask, any pixel values specified in the Data Ignore Value field of the associated header file (for ENVI-format files) will be treated as mask values and will not be processed by Feature Extraction.
  3. In the Ancillary Data tab, you can import ancillary data to help extract features of interest. An example is combining a LiDAR digital surface model (DSM) with a multispectral image to identify rooftops in a residential area, then building a rule using height data from the DSM to more accurately extract the rooftops. (The height data would be in the Spectral Mean attribute for the DSM band.) Multiple datasets often provide more accurate results. The following rules apply:
    • You can only use raster data for ancillary data. Vector data must be converted to raster format prior to import.
    • The ancillary image file must be georeferenced to a standard or Rational Polynomial Coefficient (RPC) spatial reference. If the ancillary data is not in the same map projection as the input image, ENVI will reproject the ancillary data to match the base projection. Images with a pseudo spatial reference cannot be used as ancillary data.
    • The ancillary data and input image must have some geographic overlap.
    • If you spatially subset the input image, the ancillary data will be reprojected to match that spatial extent.
  4. In the Ancillary Data tab, click Add Data. Select one or more ancillary files for input. You can select spectral subsets from each ancillary data file. ENVI will create new bands for each ancillary file that you import; you can then use these bands for rule-based classification. The ancillary bands are identified by the name of the ancillary file and the respective band number of that file.

  5. Select the Custom Bands tab and enable the following options if desired. The input image must be georeferenced to a standard map projection for these options to be available.
    • Normalized Difference: Enable the check box, then select two bands for computing a normalized band ratio as follows:

      [(b2 - b1) / (b2 + b1 + eps)]

      Where "eps" is a very small number to avoid division by zero.

    • If b2 is near-infrared and b1 is red, then Normalized Difference will be a measure of normalized difference vegetation index (NDVI).

      For example, if you have a QuickBird image with four bands where Band 3 is red and Band 4 is near-infrared and you want to compute NDVI, select Band 3 from the Band 1 drop-down list and select Band 4 from the Band 2 drop-down list.

      ENVI will create a Normalized Difference band that you can use for segmentation or classification.

    • Color Space: Enable the check box, then select the Red, Green, and Blue band names from the image. ENVI will perform an RGB to HSI color space transformation and will create new bands for Hue, Saturation, and Intensity that you can use for segmentation or rule-based classification. The bands are as follows:
      • Hue: Often used as a color filter, measured in degrees from 0 to 360. A value of 0 is red, 120 is green, and 240 is blue.

      • Saturation: Often used as a color filter, measured in floating-point values that range from 0 to 1.0.

      • Intensity: Often provides a better measure of brightness than the Spectral_Mean spectral attributes. Intensity is measured in floating-point values that range from 0 to 1.0.

  6. Note: You should not perform segmentation with a combination of custom bands (normalized difference or HSI color space) and visible/NIR bands. You can perform segmentation on the normalized difference or color space bands by themselves, but not in combination with visible and NIR bands.

  7. Click Next.

ENVI will create a single dataset from the combined bands of the input image, ancillary data, normalized difference, hue, saturation, and intensity (if selected). This single dataset will be used throughout the rest of the Feature Extraction workflow.

Segment Images


After file selection, the file opens in the view and the Object Creation panel appears. If the selected file was displayed in the view before you started the workflow, the display bands and image location are retained, as well as any brightness, contrast, stretch, and sharpen settings. The image location is not retained for pixel-based images or those with pseudo or arbitrary projections.

Enable the Preview check box in the Object Creation panel. A Preview Window with segments outlined in green appears over the center of the view (you may need to move the Object Creation panel to see it).

  1. Segmentation is the process of partitioning an image into objects by grouping neighboring pixels with common values. The objects in the image ideally correspond to real-world features. Effective segmentation ensures that classification results are more accurate. Under Segment Settings, select an Algorithm from the drop-down list. The following algorithms are available:
    • Edge: Best for detecting edges of features where objects of interest have sharp edges. Set an appropriate Scale Level and Merge Level (see steps below) to effectively delineate features.
    • Intensity: Best for segmenting images with subtle gradients such as digital elevation models (DEMs) or images of electromagnetic fields. When selecting this method, do not perform any merging; set the Merge Level to 0. Merging is used primarily to combine segments with similar spectral information. Elevation and other related attributes are not appropriate for merging.
  2. See Watershed Algorithm Background for more detailed descriptions of each option.

  3. Adjust the Scale Level slider as needed to effectively delineate the boundaries of features as much as possible without over-segmenting the features. Increasing the slider results in fewer segments; decreasing the slider results in more segments. You should also ensure that features of interest are not grouped into segments represented by other features. See Watershed Algorithm Background for a more detailed discussion of how the Scale Level is used with respect to gradient and intensity images.
  4. Click the Select Segment Bands button to choose specific bands for applying the segmentation settings. The settings will apply to a grayscale image derived from the average of all selected bands. All available bands are selected by default.
  5. Tip: For best segmentation results, select a combination of bands that have similar spectral ranges such as R, G, B, and NIR bands. You should not perform segmentation with a combination of custom bands (normalized difference or HSI color space) and visible/NIR bands. You can perform segmentation on the normalized difference or color space bands by themselves, but not in combination with visible and NIR bands.

  6. Merging combines adjacent segments with similar spectral attributes. Under Merge Settings, select an Algorithm from the drop-down list. The following algorithms are available:
    • Full Lambda Schedule: (default). Merges small segments within larger, textured areas such as trees or clouds, where over-segmentation may be a problem.
    • Fast Lambda: Merges adjacent segments with similar colors and border sizes.
  7. See Merge Algorithms Background for more detailed descriptions of each option.

  8. Adjust the Merge Level slider as needed to combine segments with similar colors (Fast Lambda) or to merge over-segmented areas (Full Lambda Schedule). Increasing the slider results in more merging; no merging will occur if you leave the slider value at 0. For example, if a red building consists of three segments, selecting Fast Lambda and increasing the Merge Level should combine them into one segment. All available bands are selected by default. To delineate treetops or other highly textured features, select Full Lambda Schedule and increase the Merge Level value.
  9. Click the Select Merge Bands button to choose specific bands for applying the merge settings. Merging will be based on the differences between region colors based on all selected bands.
  10. Select a Texture Kernel Size value, which is the size (in pixels) of a moving box centered over each pixel in the image. Texture attributes are computed for each kernel. Enter an odd number of 3 or higher. The maximum value is 19. The default value is 3. Select a higher kernel size if you are segmenting large areas with little texture variance such as fields. Select a lower kernel size if you are segmenting smaller areas with higher variance such as urban neighborhoods.
  11. Click Next.

Export Classification Results


When segmenting and merging is complete, ENVI loads a segmentation image into the view and the Export panel appears.

To export, select the output formats for vectors, images, and statistics. By default, files are saved to the directory specified in the Output Directory preference.

  1. In the Export Vector tab, enable the check boxes for the desired output:

    • Export Segmentation Vectors: Save the regions in the segmentation image to a shapefile. Shapefiles have a maximum file size of 2 GB, so if your image has a large number of segments and the resulting shapefile exceeds this file size, it will be broken into smaller shapefiles. Shapefiles larger than 1.5 GB cannot be displayed. Specify an Output Filename and directory in the field provided.
    • Export Attributes: Select this option if you want to include the spatial, spectral, and texture attributes that were computed for each region in the output shapefile.
  2. In the Export Raster tab, enable the Export Segmentation Image check box to create a multispectral image in ENVI raster format that shows the regions defined by segmentation. Each region will be assigned the mean spectral values of all the pixels that belong to that region. Specify an Output Filename and directory in the field provided.
  3. In the Advanced Export tab, enable the Export Attributes Image check box to create a multi-layer image in ENVI raster format where each layer represents the values of a specific attribute. The Select Attributes dialog will appear for you to select which attributes to export to an attribute image. Select the attribute name(s) to export in the Available Attributes column, and click the Add Selected Attribute button. If an attribute does not contain any valid values, then that attribute band will be assigned pixel values of 0. See Selecting Attributes for Classification for further details on using this dialog.

    When finished, click OK in the Select Attributes dialog, then specify an Output Filename and directory in the Advanced Export tab.

  4. In the Auxiliary Export tab, enable the Export Processing Report check box to create a report that summarizes the segmentation options, rules, and attributes that you used to classify the image. Specify the filename and location in the Select Output Filename field.
  5. Click Finish. When exporting is complete, the workflow view closes. The original data and the export data display in the view.