This task allows you to extract segments only without performing classification. 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. Output includes a single-band label raster with an optional segmentation raster.

You must have an ENVI Feature Extraction license in order to use this routine.

Example


; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('FXSegmentation')
 
; Define inputs
Task.INPUT_RASTER = Raster
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)

Syntax


Result = ENVITask('FXSegmentation')

Input properties (Set, Get): INPUT_RASTER, KERNEL_SIZE, MERGE_ALGORITHM, MERGE_BANDS, MERGE_VALUE, OUTPUT_MEANS_RASTER_URI, OUTPUT_RASTER_URI, SEGMENT_ALGORITHM, SEGMENT_BANDS, SEGMENT_VALUE

Output properties (Get only): OUTPUT_MEANS_RASTER, OUTPUT_RASTER

Properties marked as (Init) can be set during the initial creation of the object. Properties marked as (Get) can be retrieved. Properties marked as (Set) can be set after initial creation.

Methods


This task inherits the following methods from ENVITask:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

INPUT_RASTER (required)

Specify a raster on which to perform segmentation and merging.

KERNEL_SIZE (optional)

Specify a texture kernel size, in pixels, around a given pixel that will be used to compute texture attributes. Use an odd number between 3 and 19 (e.g., 9 = 9x9 pixels). Specify a higher kernel size if you are segmenting large areas with little texture variance such as fields. Specify a lower size if you are segmenting smaller areas with higher variance such as urban neighborhoods. The default value is 3.0000000.

MERGE_ALGORITHM (optional)

Specify the merge method used to combine adjacent segments with similar spectral attributes.

  • 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.

MERGE_BANDS (optional)

Specify the bands for applying the merge settings.

MERGE_VALUE (optional)

Specify the merge level to combine segments with similar colors (Fast Lambda) or to merge over-segmented areas (Full Lambda Schedule). Increasing the value results in more merging. The default value is 0.000000 (no merging).

OUTPUT_MEANS_RASTER

This is a reference to the output for a multispectral image in ENVI raster format that shows the regions defined by segmentation.

OUTPUT_MEANS_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, the associated OUTPUT_RASTER will not be created. To force the creation of a temporary file set the property to an exclamation symbol (!).

OUTPUT_RASTER

This is a reference to the output for a single band label raster in ENVI format.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the associated OUTPUT_RASTER. If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.

If you do not specify this property, the output raster is only temporary. Once the raster has no remaining references, ENVI deletes the temporary file.

SEGMENT_ALGORITHM (optional)

Specify the segmentation method to use:

  • Edge (default): Best for detecting edges of features where objects of interest have sharp edges. Set an appropriate SEGMENT_VALUE and MERGE_VALUE 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 set the MERGE_VALUE property. Merging is used primarily to combine segments with similar spectral information. Elevation and other related attributes are not appropriate for merging.

SEGMENT_BANDS (optional)

Specify an array of zero-based band numbers on which to apply the segmentation settings. For example, [0,1,2] indicates Band 1, Band 2, and Band 3.

SEGMENT_VALUE (optional)

Specify the scale level used to effectively delineate features of interest in segmentation. Increasing the value results in fewer segments; decreasing the value results in more segments. You should ensure that features of interest are not grouped into segments represented by other features. The default value is 50.0000.

Version History


ENVI 5.2

Introduced

API Version


4.2

See Also


ENVITask