Use the Create Crop Location Grid tool to estimate crop locations in an image, based on three specified points. The tool creates a classification image with circles that represent crops. It is best used in fields where crops are equally spaced and sized. You can optionally create a polygon region of interest (ROI) that defines the field of interest so that the grid of crop locations is constrained to that field only. The crop locations can be used as input to tools such as Calculate Crop Metrics.
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 estimate crop locations using AgCreateAndRasterizeCropLocationGrid Task.
See the following sections:
The Create Crop Location Grid tool estimates crop locations based on their geometry and location from one another. Here are some of the advantages of using this tool:
- It accepts any type of imagery, including RGB files in various formats (TIFF, JPEG, JPEG2000, etc.).
- No image preprocessing is necessary.
- It works well in fields where crops are equally spaced and sized.
- It performs better than the Count Crops tool when crops have significant overlap.
- It estimates crop locations independently from the brightness or spectral characteristics of the crops. By contrast, the Count Crops tool detects crops if they are bright against a dark background. If a crop is hidden beneath a tree canopy or other structure, that tool will not detect it. However, the Create Crop Location Grid tool assumes that crops exist in these regions, based on the layout of other crops in the field.
Here are some limitations to be aware of:
- The accuracy of the crop location grid depends on the quality of the polygon ROI used to define a field. The ROI should be drawn as close to the crop boundaries as possible. See Step 4 below in the Isolate the Field of Interest section.
- It should not be used in fields where the crops have mixed sizes (young and old, for example). The crops should have a relatively similar size.
- You can specify the average crop diameter if you know it, or you can let the tool automatically calculate it. The tool will use this value for every crop location. If crop sizes vary significantly in your field, or if you want to calculate the diameters of individual crops, use the Count Crops tool instead.
- It should not be used if you need precise geographic locations of each crop. It estimates the locations of each crop from grid-based geometry, not by detecting objects in the image. Use the Count Crops tool if you need more precise geographic locations for each crop.
- It should not be used if the crops turn direction. Rotated fields are okay, but they should have horizontal and vertical alignment:
How it Works
When you run the Create Crop Location Grid tool, you can choose any crop as a starting point (Point 1). You will draw a polyline annotation from that point to another crop along a straight line (Point 2), then to another crop in an orthogonal direction (Point 3). Then count the spaces between Point 1 and Point 2, and between Point 2 and Point 3.
The following example shows three spaces between Point 1 and Point 2, and six spaces between Point 2 and Point 3.
The Create Crop Location Grid tool will estimate the locations of other crops within the field, based on a grid alignment.
Follow these steps to isolate the field of interest and to run the Create Crop Location Grid tool.
Isolate the Field of Interest
For the most accurate estimate of crop locations, you should define a spatial subset or region of interest (ROI) that encompasses the field of interest. A spatial subset is a good option if the field is rectangular and not rotated. Select File > Save As > Save As (ENVI, NITF, TIFF, DTED) from the ENVI menu bar and click the Spatial Subset button. Here is an example of a field that has been subsetted:
In most cases, your field will not be rectangular or it will be rotated within the image. In these cases, you should create a polygon ROI around the field. Follow these steps:
- Display the image.
- Right-click on the image name in the Layer Manager and select New Region of Interest.
- In the Region of Interest (ROI) Tool dialog, click the Geometry tab and ensure that the Polygon option is selected.
- Click to add points that define a line along the edge of your field of interest. Keep the line as close to the crops as possible. Where gaps exist, try to draw the line in a stepwise pattern; otherwise the tool may insert crops in the gaps where none really exist.
- When finished drawing a line around the entire field, right-click and select Complete and Accept Polygon.
- From the ROI Tool menu bar, select File > Save As, and save the ROI file to disk.
- Close the ROI Tool.
Here is an example that uses High-Resolution Orthoimagery available from the U.S. Geological Survey, at 0.5-foot spatial resolution. The field of interest contains olive trees.
A polygon ROI was created to isolate the field from the rest of the image:
Run the Create Crop Location Grid Tool
- From the Toolbox, select Crop Science > Create Crop Location Grid. The Interactive Create and Rasterize Crop Location Grid dialog appears.
- In the Input Raster field, select an input image.
- Optional: If you created a polygon ROI to isolate the field of interest, select the Field ROI file. If you do not select an ROI file, you will select points to add to the Input Grid Points fields in the next steps.
- To add Input Grid Points, click the Annotations drop-down in the ENVI menu bar, and select Polyline.
- Click on the center of any crop in the image to set Point 1.
- Click on another crop that is along a straight line from Point 1 to set Point 2.
- Click on a crop that is orthogonal to, and along a straight line from, Point 2 to set Point 3.
- Right-click and select to finish drawing the polyline annotation. Here is an example of a polyline (in red) drawn between three points.
Tip: The points in this example were labeled using the Feature Counting tool, for illustration. You do not have to use the Feature Counting tool to label the points, but it may help you keep track of where they are located.
- In the Interactive Create and Rasterize Crop Location Grid dialog, click the Get Points from Polyline Annotation button . The Point 1, Point 2, and Point 3 fields will automatically populate with the file coordinates of the three points you specified.
- Count the spaces between the crop at Point 1 and the crop at Point 2. Enter that number in the Spaces between points 1 and 2 field.
- Count the spaces between the crop at Point 2 and the crop at Point 3. Enter that number in the Spaces between points 2 and 3 field.
- As mentioned in the Background section above, the Create Crop Location Grid tool is best used in agricultural fields where the crops have a relatively similar size. If you know the approximate diameter of a typical crop in your image, enter it (in meters) in the Crop Diameter field. If you will be using the output of this tool to calculate crop metrics, you should enter a diameter that covers as much of the crop as possible without extending beyond it. If you leave this field blank, the tool will estimate the diameter automatically.
- Select an output filename and location for Output Crops. This is a JSON-format text file that specifies the approximate locations of the crop centers. This can be used as input for tools such as Crop Metrics.
- Enable the Fill Raster Crops option to display filled circles instead of outlines in the classification result. The default value is No.
- Select an output filename and location for the Output Crops Raster. This is a classification raster showing circles that represent individual crops.
Enable the Preview check box to see a preview of the settings before you click OK to process the data. The preview is calculated only on the area in the view and uses the resolution level at which you are viewing the image. See Preview for details on the results. To preview a different area in your image, pan and zoom to the area of interest and re-enable the Preview option.
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 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 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.
To edit the name and color of the Crops class, right-click on the Classes folder in the Layer Manager and select Edit Class Names and Colors.
The number of crops is listed next to the Crops class in the Layer Manager. You can also right-click on the raster layer in the Layer Manager and select View Metadata. In the View Metadata dialog, click the Supplementary node to see the number of crops.
Count Crops, Calculate Crop Metrics, Crop Metrics with Spectral Index