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:
- Opens an RGB image of emerging cotton plants, captured by an unmanned aerial vehicle (UAV). Image courtesy of Drone Global Network.
- Runs AgCropCount Task on the green band of the image, to count the crops and to create an ENVIAgCrops object.
- Runs AgFindRowsAndRemoveOutliers Task.
- Runs AgFindAndRasterizeCropGaps Task.
- Displays the original crops raster in cyan and the missing crops in red.
e = ENVI()
File = Filepath('Cotton.dat', $
SUBDIR=['data','crop_science'], $
ROOT_DIR=e.Root_Dir)
Raster = e.OpenRaster(File)
subset = ENVISubsetRaster(Raster, BANDS=[1])
countTask = ENVITask('AgCropCount')
countTask.INPUT_RASTER = subset
countTask.INCLUDE_EDGES ='true'
countTask.MINIMUM_CROP_DIAMETER = 9
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
rowTask = ENVITask('AgFindRowsAndRemoveOutliers')
rowTask.INPUT_CROPS = countTask.OUTPUT_CROPS
rowTask.DISTANCE_THRESHOLD = 14.5
rowTask.INLIER_FRACTION = 0.7
rowTask.MINIMUM_CROPS_PER_ROW = 25
rowtask.MAXIMUM_SLOPE = 2.0
rowTask.FILLED = 'true'
rowTask.Execute
gapsTask = ENVITask('AgFindAndRasterizeCropGaps')
gapsTask.INPUT_CROPS = rowTask.OUTPUT_CROPS
gapsTask.FILLED = 'true'
gapsTask.Execute
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 parameters (Set, Get): FILLED, INPUT_CROPS, OUTPUT_CROPS_URI, OUTPUT_RASTER_URI, SEARCH_AREA_SENSITIVITY
Output parameters (Get only): OUTPUT_CROPS, OUTPUT_NCROPS, 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
FILLED (optional)
Set this parameter 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_URI (optional)
Specify a string with the fully qualified filename and path for the output JSON file that will contain the crop data.
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_CROPS
This is a reference to the output crop data that contains the missing crops.
OUTPUT_NCROPS
This is the output number of missing crops.
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.1
|
Introduced |
See Also
AgFindRowsAndRemoveOutliers Task, AgCountAndRasterizeCrops Task