Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / ENVI API / Crop Science / ENVIAgEnhanceCropsTask

ENVIAgEnhanceCropsTask

ENVIAgEnhanceCropsTask

This task is a preprocessing step that enhances crops in a single-band raster. The result can be passed to ENVIAgCropCount or ENVIAgCountAndRasterizeCropsTask. You can optionally set minimum and maximum pixel value thresholds on the input raster. The task then inverts the remaining pixel values, unless you choose to disable inversion.

This task is part of ENVI Crop Science, which requires a separate license and installation.

Example


This example performs the following steps:

  1. Opens an orthophoto of a citrus orchard.
  2. Creates a spectral subset consisting of the green band only.
  3. Masks out pixel values greater than 90 in the green band. These are primarily soil pixels that need to be masked out.
  4. Inverts the thresholded green band image to make the citrus trees appear bright.
  5. Displays the result.
; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('CitrusOrthophoto.dat', $
  Subdir=['data','crop_science'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Define a spectral subset consisting of
; the green band
GreenBand = ENVISubsetRaster(Raster, BANDS=1)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('AgEnhanceCrops')
 
; Define task inputs
Task.INPUT_RASTER = GreenBand
Task.INPUT_MAX = 90 ; to mask out bright soil pixels
Task.INVERSE='true'
 
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; Run the task
Task.Execute
 
; Get the collection of objects currently 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)

The resulting image still contains shadows, which have a similar brightness to the citrus trees in the inverted green band. It is difficult to remove these pixels without also removing vegetation pixels. See More Examples for a different method of isolating the citrus trees.

Syntax


Result = ENVITask('AgEnhanceCrops')

Input properties (Set, Get): INPUT_MAX, INPUT_MIN, INPUT_RASTER, INVERSE, OUTPUT_RASTER_URI

Output properties (Get only): DESCRIPTION, NAME, OUTPUT_RASTER

Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.

Methods


This task inherits the following methods from ENVITask. See the ENVITask topic in ENVI Help.

  • AddParameter
  • Execute
  • Parameter
  • ParameterNames
  • RemoveParameters

Properties


DESCRIPTION

This property describes the task.

INPUT_MAX (optional)

Specify a maximum data value. Pixels greater than this value are set to NaN and will be ignored in subsequent processing. An example is setting a maximum value to remove shadows or bright soil pixels in an inverted green band image. These features have a similar brightness value to healthy vegetation and should be removed to reduce confusion in crop-counting tasks.

INPUT_MIN (optional)

Specify a minimum data value. Pixels less than this value are set to NaN and will be ignored in subsequent processing. An example is setting a mimimum value to remove dark shadows from a spectral index image (such as NDVI) or from a single-band image where INVERSE = 'false'.

INPUT_RASTER (required)

Specify a single-band raster. If you have a multispectral dataset, you must create a spectral subset consisting of only one band.

INVERSE (optional)

Set this property to true (the default value) to invert the data. An example is to invert the values in a green band.

NAME

This property contains the name of the task.

OUTPUT_RASTER

This is a reference to the output raster of filetype ENVI.

OUTPUT_RASTER_URI (optional)

Specify a string with the fully qualified filename and path of the output raster. 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.

More Examples


This example performs the following steps:

  1. Opens an orthophoto of a citrus orchard.
  2. Creates an Iron Oxide spectral index image to highlight soil pixels.
  3. Masks out pixel values greater than 1.092. These are primarily soil pixels.
  4. Masks out pixel values lower than 0.322. These are primarily shadow pixels.
  5. Inverts the thresholded Iron Oxide image to make the citrus trees appear bright.
  6. Displays the result.
; Start the application
e = ENVI()
 
; Open an input file
  File = Filepath('CitrusOrthophoto.dat', $
  Subdir=['data','crop_science'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Create an Iron Oxide spectral index raster
indexRaster = ENVISpectralIndexRaster(Raster, 'Iron Oxide')
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('AgEnhanceCrops')
 
; Define task inputs
Task.INPUT_RASTER = indexRaster
Task.INPUT_MIN = 0.322
Task.INPUT_MAX = 1.092
Task.INVERSE = 'true'
 
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; Run the task
Task.Execute
 
; Get the collection of objects currently 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)

Version History


1.0

Introduced

See Also


ENVIAgEnhanceCrops, ENVIAgCrops, ENVIAgCropCount, ENVIAgCropCountTask, ENVIAgCalculateCropMetrics, ENVIAgCalculateCropMetricsTask, ENVIAgCalculateAndRasterizeCropMetricsTask, ENVIAgCalculateAndRasterizeCropMetricsWithSpectralIndexTask, ENVIAgCountAndRasterizeCropsTask, ENVIAgRasterizeCropsTask



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us