AgRasterizeCrops Task

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 properties (Set, Get): CLASSIFICATION, CROPS, FILLED, OUTPUT_METRIC, OUTPUT_RASTER_URI

Output properties (Get only): 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:

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:

CLASSIFICATION (optional)

Set this property 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 you set the CLASSIFICATION property to false, the output will be a grayscale raster that is based on the actual mean values of the crops; for example:

This property is ignored if you set OUTPUT_METRIC to Count.

CROPS (required)

Specify an input ENVIAgCrops object.

FILLED (optional)

Set this property 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.

OUTPUT_RASTER

This is a reference to the output crops classification raster.

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.

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