Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / ENVI API / Crop Science / ENVIAgFindAndRasterizeCropGapsTask

ENVIAgFindAndRasterizeCropGapsTask

ENVIAgFindAndRasterizeCropGapsTask

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

Example


This example performs the following steps:

  1. Opens an orthophoto of a citrus orchard.
  2. Creates a spectral index raster to make the citrus trees bright against the background. A Normalized Difference Vegetation Index (NDVI) works well in this case.
  3. Tip: See the ENVISpectralIndexRaster topic in ENVI Help for a list of spectral indices. You can run ENVIQuerySpectralIndicesTask to see what indices are available for your particular image.

  4. Runs ENVIAgCountAndRasterizeCropsTask to count the trees and to create an ENVIAgCrops object.
  5. Runs ENVIAgFindRowsAndRemoveOutliers.
  6. Runs ENVIAgFindAndRasterizeCropGapsTask.
  7. Displays the original crops raster in blue and the missing crops in red.
; 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)
 
; Preprocess the image so that crops are bright.
NDVIImage = ENVISpectralIndexRaster(Raster, 'NDVI')
 
; Count and rasterize the crops
CropCountTask = ENVITask('AgCountAndRasterizeCrops')
CropCountTask.INPUT_RASTER = NDVIImage
CropCountTask.FILLED = 'true'
CropCountTask.INCLUDE_EDGES = 'true'
CropCountTask.MINIMUM_CROP_DIAMETER = 2.5 ; meters
CropCountTask.MAXIMUM_CROP_DIAMETER = 5.0
CropCountTask.NUMBER_OF_INCREMENTS = 4
CropCountTask.GAUSSIAN_FACTOR = 0
CropCountTask.INCLUDE_EDGES = 1
CropCountTask.PERCENT_OVERLAP = 10.0
CropCountTask.INTENSITY_THRESHOLD = 0.85
CropCountTask.OUTPUT_CROPS_URI = e.GetTemporaryFilename('json')
CropCountTask.Execute
 
; Find rows and remove outliers
FindRowsTask = ENVITask('AgFindRowsAndRemoveOutliers')
FindRowsTask.INPUT_CROPS = CropCountTask.OUTPUT_CROPS
FindRowsTask.DISTANCE_THRESHOLD = 1.2
FindRowsTask.FILLED = 'true'
FindRowsTask.Execute
 
; Find crop gaps
FindGapsTask = ENVITask('AgFindAndRasterizeCropGaps')
FindGapsTask.INPUT_CROPS = FindRowsTask.OUTPUT_CROPS
FindGapsTask.FILLED = 'true'
FindGapsTask.Execute
 
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(Raster)
Layer2 = View.CreateLayer(FindRowsTask.OUTPUT_RASTER)
Layer3 = View.CreateLayer(FindGapsTask.OUTPUT_RASTER)
 
Print, 'Number of missing crops: ', FindGapsTask.OUTPUT_NCROPS

Syntax


Result = ENVITask('AgFindAndRasterizeCropGaps')

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

Output properties (Get only): DESCRIPTION, NAME, 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. See the ENVITask topic in ENVI Help.

  • AddParameter
  • Execute
  • Parameter
  • ParameterNames
  • RemoveParameters

Properties


DESCRIPTION

This property describes the task.

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.

NAME

This property contains the name of the task.

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

Version History


1.0.1

Introduced

See Also


ENVIAgFindRowsAndRemoveOutliersTask, ENVIAgCountAndRasterizeCropsTask



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us