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:
- Opens an orthophoto of a citrus orchard.
- Creates a spectral subset consisting of the green band only.
- Masks out pixel values greater than 90 in the green band. These are primarily soil pixels that need to be masked out.
- Inverts the thresholded green band image to make the citrus trees appear bright.
- Displays the result.
e = ENVI()
File = Filepath('CitrusOrthophoto.dat', $
Subdir=['data','crop_science'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
GreenBand = ENVISubsetRaster(Raster, BANDS=1)
Task = ENVITask('AgEnhanceCrops')
Task.INPUT_RASTER = GreenBand
Task.INPUT_MAX = 90
Task.INVERSE='true'
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
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): OUTPUT_RASTER
Properties marked as "Init" are applied only during the initial creation of the object. Properties marked as "Set" are those that you can set to specific values after the object has been created. 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
This task inherits the following properties from ENVITask:
COMMUTE_ON_DOWNSAMPLE
COMMUTE_ON_SUBSET
DESCRIPTION
DISPLAY_NAME
NAME
REVISION
See the ENVITask topic in ENVI Help for details.
This task also contains the following properties:
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.
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:
- Opens an orthophoto of a citrus orchard.
- Creates an Iron Oxide spectral index image to highlight soil pixels.
- Masks out pixel values greater than 1.092. These are primarily soil pixels.
- Masks out pixel values lower than 0.322. These are primarily shadow pixels.
- Inverts the thresholded Iron Oxide image to make the citrus trees appear bright.
- Displays the result.
e = ENVI()
File = Filepath('CitrusOrthophoto.dat', $
Subdir=['data','crop_science'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
indexRaster = ENVISpectralIndexRaster(Raster, 'Iron Oxide')
Task = ENVITask('AgEnhanceCrops')
Task.INPUT_RASTER = indexRaster
Task.INPUT_MIN = 0.322
Task.INPUT_MAX = 1.092
Task.INVERSE = 'true'
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
Task.Execute
DataColl = e.Data
DataColl.Add, Task.OUTPUT_RASTER
View = e.GetView()
Layer = View.CreateLayer(Task.OUTPUT_RASTER)
Version History
See Also
ENVIAgEnhanceCrops, ENVIAgCrops, ENVIAgCropCount, ENVIAgCropCountTask, ENVIAgCalculateCropMetrics, ENVIAgCalculateCropMetricsTask, ENVIAgCalculateAndRasterizeCropMetricsTask, ENVIAgCalculateAndRasterizeCropMetricsWithSpectralIndexTask, ENVIAgCountAndRasterizeCropsTask, ENVIAgRasterizeCropsTask