This task finds missing crops within each row of an associated ENVIAgCrops object.

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 AgCropCount Task on the green band of the image, to count the crops and to create an ENVIAgCrops object.
  3. Runs AgFindRowsAndRemoveOutliers Task.
  4. Runs AgFindAndRasterizeCropGaps Task.
  5. Displays the original crops raster in cyan and the missing crops in red.
; 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
countTask = ENVITask('AgCropCount')
countTask.INPUT_RASTER = subset
countTask.INCLUDE_EDGES ='true'
countTask.MINIMUM_CROP_DIAMETER = 9 ;pixels
countTask.MAXIMUM_CROP_DIAMETER = 12
countTask.NUMBER_OF_INCREMENTS= 12
countTask.GAUSSIAN_FACTOR = 0.8
countTask.PERCENT_OVERLAP = 60
countTask.INTENSITY_THRESHOLD = 0.81
countTask.Execute
 
; Find rows and remove outliers
rowTask = ENVITask('AgFindRowsAndRemoveOutliers')
rowTask.INPUT_CROPS = countTask.OUTPUT_CROPS
rowTask.DISTANCE_THRESHOLD = 14.5 ;pixels
rowTask.INLIER_FRACTION = 0.7
rowTask.MINIMUM_CROPS_PER_ROW = 25
rowtask.MAXIMUM_SLOPE = 2.0
rowTask.FILLED = 'true'
rowTask.Execute
 
; Find crop gaps
gapsTask = ENVITask('AgFindAndRasterizeCropGaps')
gapsTask.INPUT_CROPS = rowTask.OUTPUT_CROPS
gapsTask.FILLED = 'true'
gapsTask.Execute
 
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(subset)
Layer2 = View.CreateLayer(rowTask.OUTPUT_RASTER)
Layer3 = View.CreateLayer(gapsTask.OUTPUT_RASTER)
View.Zoom, /FULL_EXTENT

Syntax


Result = ENVITask('AgFindAndRasterizeCropGaps')

Input properties (Set, Get): FILLED, INPUT_CROPS, OUTPUT_CROPS_URI, OUTPUT_RASTER_URI, SEARCH_AREA_SENSITIVITY

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

FILLED (optional)

Set this property to true to create filled circles in the output crops classification raster. The default is false.

INPUT_CROPS (required)

Specify an input ENVIAgCrops object.

SEARCH_AREA_SENSITIVITY (optional)

Enter a search area sensitivity value. The default value is 0. Increasing the value in the positive direction will increase the sensitivity of the gap-finding process, which means it will fit more crops into a gap. Decreasing the value in the negative direction will decrease the sensitivity of the gap-finding process, resulting in fewer crops in a gap. A good starting point is 0, then slowly increase the value (1, 2, 3, etc.) until the desired number of crops fill the gaps.

OUTPUT_CROPS

This is a reference to the output crop data that contains the missing crops.

OUTPUT_CROPS_URI (optional)

Specify a string with the fully qualified path and filename for OUTPUT_CROPS. If you do not specify this property, the output crop file is only temporary. Once the crop file has no remaining references, ENVI deletes the temporary file.

OUTPUT_NCROPS

This is the output number of missing crops.

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.1

Introduced

See Also


AgFindRowsAndRemoveOutliers Task, AgCountAndRasterizeCrops Task