This task creates a classification raster from an ENVIAgCrops object. The Crops class consists of circle outlines at the crop locations.

This task requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.

Example


This example performs the following steps:

  1. Opens an RGB image of emerging cotton plants, captured by an unmanned aerial vehicle (UAV). Image courtesy of Drone Global Network.
  2. Runs ENVIAgCropCount on the green band to count the crops and to create an ENVIAgCrops object.
  3. Creates a classification raster showing the locations of the crops.
  4. Displays the classification raster over the green band of the source image.

Note: The resulting crop count includes several outliers. You can use AgFindRowsAndRemoveOutliers Task to remove these.

; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('Cotton.dat', $
  SUBDIR=['data','crop_science'], $
  ROOT_DIR=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Process the green band
subset = ENVISubsetRaster(Raster, BANDS=[1])
 
; Count the crops and output an ENVIAgCrops object
outCrops = ENVIAgCropCount(subset, 9, 12, $
  GAUSSIAN_FACTOR=0.8, $
  /INCLUDE_EDGES, $
  INTENSITY_THRESHOLD=0.81, $
  NUMBER_OF_INCREMENTS=12, $
  OUTPUT_NCROPS=outputNumCrops, $
  PERCENT_OVERLAP=60)
 
; Get the rasterize task from the catalog of ENVITasks
Task = ENVITask('AgRasterizeCrops')
 
; Define the task inputs
Task.CROPS = outCrops
Task.FILLED = 'true'
 
; Run the task
Task.Execute
 
; Get the collection of objects currently in the Data Manager
DataColl = e.Data
 
; Add the output to the data collection
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(subset)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER)
View.Zoom, /FULL_EXTENT

Syntax


Result = ENVITask('AgRasterizeCrops')

Input parameters (Set, Get): CLASSIFICATION, CROPS, FILLED, OUTPUT_METRIC, OUTPUT_RASTER_URI

Output parameters (Get only): OUTPUT_RASTER

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

Input Parameters


CLASSIFICATION (optional)

Set this parameter to true (the default value) to create a classification raster where crops are colored according to relative means. For example, a dark green polygon corresponds to a crop with a higher mean value than light-green, yellow, and red polygons. The resulting raster will look similar to the following:

If set to false, the output will be a grayscale raster that is based on the actual mean values of the crops; for example:

This parameter is ignored if you set OUTPUT_METRIC to Count.

CROPS (required)

Specify an input ENVIAgCrops object.

FILLED (optional)

Set this parameter to true to create filled circles. The default is false.

OUTPUT_METRIC (optional)

Specify one of the following strings indicating the metric or count that the output raster will be based on. The default is Count.

  • Count
  • Crop Minimum
  • Crop Maximum
  • Crop Mean
  • Crop Standard Deviation
  • Radius

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 parameter, or set it to an exclamation symbol (!), ENVI creates a temporary file.
  • If you set it to the hash symbol (#), ENVI creates a file in the temporary directory, but this file will not be deleted when ENVI closes.

Output Parameters


OUTPUT_RASTER

This is a reference to the output crops classification raster.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


Crop Science 1.0

Introduced

Crop Science 1.1

Radius was added as an option to OUTPUT_METRIC.

See Also


ENVIAgCropCount, AgCropCount Task, AgCountAndRasterizeCrops Task, ENVIAgCalculateCropMetrics, AgCalculateCropMetrics Task