Segmentation Algorithms Background

The segmentation process in Feature Extraction is based on a patented technology invented by Jin (2012). Image segmentation involves the following steps:

  • Computing a gradient map or intensity map from the image
  • Computing a cumulative distribution function from the map
  • Modifying the map using the selected Scale Level value
  • Segmenting the modified map using a watershed transform.

The watershed transform is based on the concept of hydrologic watersheds. Basins fill up with water starting at the lowest points, and dams are built where water coming from different basins would meet. When the water level has reached the highest peak in the landscape, the process stops. The landscape is thus divided into regions separated by dams, called watersheds (Roerdink and Meijster 2001).

A similar process occurs in digital imagery. The darker a pixel, the lower its "elevation"; this type of pixel is called a minimum. A watershed algorithm sorts pixels by increasing greyscale value, then begins with the minimum pixels and "floods" the image, partitioning the image into basins (regions with similar pixel intensities) based on the computed watersheds. The result is a segmentation image, where each region is assigned the mean spectral values of all the pixels that belong to that region.

Tip: The segmentation image appears in the display after you click Next in the Object Creation panel of the Feature Extraction workflow.

Since the watershed algorithm groups pixels based on a single value, multispectral images need to be converted to a single-band image for processing. Two different methods are used for this process: Edge and Intensity.

Edge Method

Use the Edge method for identifying features with distinct boundaries such as buildings or vehicles. Objects of interest often have clear boundaries represented by relatively large gradient magnitudes, while the internal part of the objects may have a more uniform intensity (with little or no gradient magnitude).

With the Edge method, ENVI computes a gradient image using a Sobel edge detection method, where the highest pixel values represent areas with the highest pixel contrast. The watershed algorithm is applied to the gradient image rather than the original image. The watershed algorithm floods the image starting with the lowest gradient values (the uniform part of the objects) to the highest gradient values (the edges).

Intensity Method

With the Intensity method, each pixel is converted to an intensity value by averaging it across the bands that you select in the Object Creation panel.

The most common case for using this method is with images that represent a potential surface where particles are drawn to minimum points. Examples include digital elevation models (DEMs), images of electromagnetic fields, or images of gravitational potential. The watershed algorithm floods the image starting with the lowest intensity values and continuing to the highest intensity values.

Here are two examples that illustrate when you might want to use the Intensity method:


The most common use of the Intensity method is to extract watershed boundaries from DEMs. The watershed algorithm begins with the pixels with the lowest elevation values and "floods" the image, computing watershed boundaries and creating regions based on separate catchment basins. Hydrologists may want to use the Intensity method with DEMs to evaluate different flooding scenarios and to create shapefiles of segments that represent specific watersheds.

Performing Segmentation on a Gradient Image

Suppose you already created an effective gradient image outside of Feature Extraction that shows strong boundaries between features of interest. For example, you used a Sobel filter to enhance layers of tissue in medical imagery. You can use the resulting image as input into segmentation by following these general steps:

  1. Create a layer stack that consists of the original image's spectral bands plus the gradient image.
  2. Click Select Segment Bands. From the layer stack, choose only the band representing the gradient image, then click OK. You will perform segmentation on just the gradient image.
  3. Click Select Merge Bands. From the layer stack, choose only the spectral bands from the original image. You will perform merging only on the spectral attributes.
  4. Select the Intensity method under Segment Settings. (You do not want to use the Gradient method on a gradient image.)

Scale Level

The Scale Level is computed from a normalized cumulative distribution function (CDF) of the pixel values in the image. For example, if you select Edge and choose a Scale Level of 20, the lowest 20 percent of gradient magnitude values are discarded from the gradient image. Increasing the Scale Level keeps objects with the most distinct edges.

With the Intensity method, choosing a Scale Level of 20 with a DEM begins watershed flooding from the lowest 20% elevation, continuing upward. Flooding the lowest elevations first provides a more accurate analysis of the watersheds at higher elevations.


Jin, X. 2012. Segmentation-based image processing system. U.S. Patent 8,260,048, filed Nov. 14, 2007, and issued Sept. 4, 2012.

Roerdink, Jos B.T.M., and A. Meijster. "The watershed transform: definitions, algorithms, and parallelization strategies," Fundamenta Informaticae 41 (2001): 187-228.