Tutorial: Crop Counting and Metrics Tutorial
Use the Calculate Crop Metrics with Spectral Index tool to calculate statistics for individual crops. It creates a classification image showing the relative pattern of a selected crop metric, or a grayscale image showing actual values of a selected crop metric. For example, if the input image is a vegetation index such as NDVI, the metrics would describe the health of the crops.
A common use of the Calculate Crop Metrics with Spectral Index tool is to look at crop statistics over time to assess their health at different stages in the growing season.
This tool accepts a multispectral image as input and calculates statistics from a specified spectral index (for example, Normalized Difference Vegetation Index). It also accepts a crop file (.json) created separately using the Count Crops and Calculate Crop Metrics tools. The crop file specifies the location and radius of each crop. Once you create the crop file, you can reuse it multiple times without having to recreate it.
This tool is best used with high-resolution imagery from an unmanned aerial vehicle (UAV) or other airborne sensor.
This tool requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.
You can also write a script to calculate crop metrics using the ENVIAgCalculateCropMetrics function or AgCalculateAndRasterizeCropMetricsWithSpectralIndex Task.
See the following sections:
Before You Begin
You must run the Count Crops tool before using Calculate Crop Metrics with Spectral Index. See the Count Crops topic for instructions on preprocessing your imagery, including steps to create a single-band image that highlights crops against a dark background. Be sure to specify an Output Crops File in the Count Crops tool.
Calculate Crop Metrics
Follow these steps to run the Calculate Crop Metrics with Spectral Index tool:
- From the Toolbox, select Crop Science > Calculate Crop Metrics with Spectral Index. The Data Selection dialog appears.
- Select a multispectral input image and click OK. The Calculate Crop Metrics with Spectral Index dialog appears.
Data should be in units of reflectance before creating spectral indices. See Spectral Indices for more information.
- Choose an option from the Spectral Index drop-down list.
- Select an Input Crops file (.json) that you created using the Count Crops tool.
- Select the specific metric to calculate from the Output Metric drop-down list. The choices are:
- Crop Minimum
- Crop Maximum
- Crop Mean (default)
- Crop Standard Deviation
- Radius
- Set Create Classification Raster to Yes if you want to create a classification raster where crops are colored according to relative metrics.
- Select an output filename and location for the Output Crops Raster.
- Select an output filename and location for the Output Crops file. This file contains crop locations and metrics, in JSON format.
-
Enable the Display result check box to display the output in the view when processing is complete. Otherwise, if the check box is disabled, the result can be loaded from the Data Manager.
-
To see a model-based version of this tool that shows how the tool is constructed from individual tasks, click Open in Modeler.
-
To reuse these task settings in future ENVI sessions, save them to a file. Click the down arrow next to the OK button and select Save Parameter Values, then specify the location and filename to save to. Note that some parameter types, such as rasters, vectors, and ROIs, will not be saved with the file. To apply the saved task settings, click the down arrow and select Restore Parameter Values, then select the file where you previously stored your settings.
-
To run the process in the background, click the down arrow next to the OK button and select Run Task in the Background. If an ENVI Server has been set up on the network, the Run Task on remote ENVI Server name is also available. The ENVI Server Job Console will show the progress of the job and will provide a link to display the result when processing is complete. See ENVI Servers for more information.
- Click OK.
Interpret the Results
If you set the Create Classification Raster option to No, the output image is a grayscale representation of the crop metric values. The following image shows an example:
To see the metric value of each crop, click the Cursor Value button in the main toolbar and click on a crop. You can also set any Status Bar segment to display Raster Data Values. The Status Bar displays the metric values as you move the cursor over the crops.
If you set the Create Classification Raster option to Yes, the output image is a classification raster where crops are colored according to relative metric values. For example, a dark green polygon corresponds to a crop with a higher value than light-green, yellow, and red polygons. The following image shows an example:
Example
This example shows how to compare two classification images created in the Crop Metrics with Spectral Index tool to look for changes in strawberry crop health over a two-week period.
The example uses MicaSense RedEdge® UAV reflectance imagery with a ground sample distance of 8 centimeters per pixel (at 400 feet). Spectral bands include blue, green, red, red edge, and near-infrared. Here are the two RGB images, one week apart:
The ENVI Spectral Math tool was used to divide the pixel values by 10,000 to yield reflectance values that were scaled from 0 to 1.
A Simple Ratio spectral index was calculated for Week 1 only, to make the strawberry crops bright against a dark background. This index is unrelated to the one that will be used later in the Crop Metrics with Spectral Index tool. The Simple Ratio image is only used as input to the Count Crops tool.
With some experimentation, the following parameter values ultimately produced the most accurate results in the Count Crops tool:
Input Raster: The Simple Ratio image
Minimum Crop Diameter: 0.2 meters
Maximum Crop Diameter: 0.7 meters
Number of Increments: 6
Gaussian Smoothing Factor: 0.2
Include Edges: Yes
Allowable Crop Overlap: 100
Intensity Threshold: 0.5
Fill Raster Crops: Yes
An Output Crops File (.json) was also created. Here is the result of the Crops class overlaid on the Week 1 RGB image. The final count is 219 crops:
You only have to create a crop file (.json) once. Since it contains the locations and sizes of crops, you can reuse the crop file when processing multiple images with the Calculate Crop Metrics with Spectral Index tool.
For this example, the Calculate Crop Metrics with Spectral Index tool ran twice, once with the Week 1 RGB image and again with the Week 2 RGB image.
Here are the selections used with both images:
Spectral Index: Green Difference Vegetation Index (GDVI)
Input Crops: The crop file (.json) saved from the Count Crops tool
Output Metric: Crop Mean
Create Classification Raster: Yes
The resulting classification images show the relative health of the crops, using the GDVI as the basis for the crop metrics. The classification images overlay the original RGB images:
By comparing these images, you can see variations in crop health from week to week, relative to each image. The relative health for each image has changed, so some crops may have become more or less healthy in relation to the other crops in the image.
If you were to set the Create Classification Raster option to No, the resulting image would be a grayscale representation of the actual crop metrics. Darker circles represent less healthy crops, and lighter circles represent healthier crops. You can view the mean GDVI values by using the Cursor Value tool, or by setting any Status Bar segment to Raster Data Values (as this example shows).
As you move the cursor over a crop location, the Status Bar shows the mean GDVI value.
To see the range of GDVI values in the entire image, right-click on the crop metrics image in the Layer Manager and select Quick Stats. Look for the Min and Max values under the Basic Stats column; for example:
If you have multiple crop metric images from a longer time period, you can create a Raster Series file. This allows you to animate the images over time and to create a time series profile of metrics for crops. See Spatiotemporal Analysis for details.
See Also
Calculate Crop Metrics, Count Crops, Enhance Crops