ENVIAgEnhanceCrops

This is a reference to an ENVIRaster where crops have been enhanced. The result can be passed to ENVIAgCropCount or ENVIAgCountAndRasterizeCrops. You can optionally set minimum and maximum pixel value thresholds on the input raster. ENVIAgEnhanceCrops then inverts the remaining pixel values, unless you choose to disable inversion.

This object 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)

 

; Enhance the crops

enhancedRaster = ENVIAgEnhanceCrops(greenBand, $

  INPUT_MAX=90, /INVERSE)

 

; Display the result

View = e.GetView()

Layer = View.CreateLayer(enhancedRaster)

Syntax

Result = ENVIAgEnhanceCrops(Input_Raster [, Keywords=value])

Return Value

This function returns a reference to an ENVIRaster object.

Arguments

Input_Raster

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

Methods

This function inherits the following methods from ENVIRaster.

Keywords

ERROR (optional)

Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

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 the INVERSE keyword is not set.

INVERSE (optional)

Set this keyword to invert the data. An example is to invert the values in a green band.

OUTPUT_FILENAME (optional)

Set this keyword to a string with the fully qualified URI for the output raster file path. If you do not set this keyword, an output file will be automatically created.

Version History

Crop Science 1.0

Introduced

See Also

AgEnhanceCrops Task, ENVIAgCrops, AgCropCount Task, AgCountAndRasterizeCrops Task, AgCalculateAndRasterizeCropMetrics Task, AgCalculateAndRasterizeCropMetricsWithSpectralIndex Task, AgCalculateCropMetrics Task