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 / ENVIAgCropCountTask

ENVIAgCropCountTask

ENVIAgCropCountTask

This task locates and counts crops in high-resolution, single-band images.

This task 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 index raster to make the citrus trees bright against the background. A Modified Triangular Vegetation Index (MTVI) works well in this case.
  3. Tip: See the ENVISpectralIndexRaster topic in ENVI Help for a list of spectral indices. Or, run ENVIQuerySpectralIndicesTask first to see what indices are available for your particular image.

  4. Runs ENVIAgCropCountTask to count the trees and to create an ENVIAgCrops object.
  5. Prints the ENVIAgCrops object properties.
; Start the application
e = ENVI(/HEADLESS)
 
; 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.
MTVIImage = ENVISpectralIndexRaster(Raster, 'MTVI')
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('AgCropCount')
 
; Define inputs
Task.INPUT_RASTER = MTVIImage
Task.INCLUDE_EDGES = 'true'
Task.MINIMUM_CROP_DIAMETER = 2.0 ; meters
Task.MAXIMUM_CROP_DIAMETER = 5.0
Task.NUMBER_OF_INCREMENTS = 4
Task.GAUSSIAN_FACTOR = 0
Task.PERCENT_OVERLAP = 100.0
Task.INTENSITY_THRESHOLD = 0.8
 
; Run the task
Task.Execute
 
; Get the output ENVIAgCrops object
outCrops = Task.OUTPUT_CROPS
 
; Print the properties of the crop object
Print, outCrops

Syntax


Result = ENVITask('AgCropCount')

Input properties (Set, Get): GAUSSIAN_FACTOR, INCLUDE_EDGES, INPUT_RASTER, INTENSITY_THRESHOLD, MAXIMUM_CROP_DIAMETER, MINIMUM_CROP_DIAMETER, NUMBER_OF_INCREMENTS, OUTPUT_CROPS_URI, PERCENT_OVERLAP

Output properties (Get only):DESCRIPTION, NAME, OUTPUT_CROPS, OUTPUT_NCROPS

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.

GAUSSIAN_FACTOR (optional)

Specify a Gaussian smoothing factor to use before searching for crops. This is the fraction of the maximum search diameter at which smoothing should occur. To disable Gaussian smoothing, set GAUSSIAN_FACTOR to 0.

INCLUDE_EDGES (optional)

Set this property to true to count partial crops touching the edges of the image or any masked area that surrounds the area to be counted. Also set it to true when applying a mask within the area being counted, for example, when masking out non-vegetation pixels. The default is false.

INPUT_RASTER (required)

Specify a single-band raster as input.

INTENSITY_THRESHOLD (optional)

Specify the fraction of the maximum crop intensity, below which crop detections will be removed.

MAXIMUM_CROP_DIAMETER (required)

Specify the maximum crop diameter. The diameter is measured in meters if the input raster has a standard spatial reference. Otherwise, specify the number of pixels for the diameter.

MINIMUM_CROP_DIAMETER (required)

Specify the minimum crop diameter. The diameter is measured in meters if the input raster has a standard spatial reference. Otherwise, specify the number of pixels for the diameter.

ENVIAgCropCountTask works best when the minimum and maximum crop diameters do not differ greatly in size. For example, a range of 1 to 4 meters will produce better results than a range of 1 to 16 meters. If your area of interest has a wide range of crop diameters, consider splitting up the area into separate images to process, each with a similar range of crop diameters.

NAME

This property contains the name of the task.

NUMBER_OF_INCREMENTS (optional)

Specify the number of increments to use when searching crops. Use this property in conjunction with MAXIMUM_CROP_DIAMETER and MINIMUM_CROP_DIAMETER. The number of increments includes the minimum and maximum diameters. The default value is 5. For example, if the minimum crop diameter is 1 meter and the maximum crop diameter is 5 meters, setting the number of increments to 5 will search for crops of exactly 1, 2, 3, 4, and 5 meters.

OUTPUT_CROPS

This is a reference to the output crop data.

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 (optional)

This is a reference to the output number of crops.

PERCENT_OVERLAP (optional)

Specify the percentage of allowable overlap between crops before one of them is removed from consideration. The default value is 50.0. To disable the overlapping percentage, set PERCENT_OVERLAP to 100. To allow no overlapping at all, set PERCENT_OVERLAP to 0. Enter smaller values if the crops are distinctly separated from one another.

Version History


1.0

Introduced

1.0.1

Added the OUTPUT_NCROPS property

See Also


ENVIAgCrops, ENVIAgCountAndRasterizeCropsTask, ENVIAgCalculateCropMetricsTask



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