02 — Methods / Tutorial

Extracting Features from
Drone Imagery in QGIS

Compute vegetation indices and plant height from orthoimages and DSMs, then pull out a value per polygon

Illustration of a drone image of a field divided into plots, with values in a table

Orthoimages and digital surface models (DSMs) from a drone hold a lot of information about a crop's condition. If you compute features such as vegetation indices and plant height from them, and pull out a single value for each field polygon, you can compare and analyze growth plot by plot. This page walks through the whole flow step by step in the free GIS software QGIS. You open the data, compute the features, summarize them per polygon, and export them as a CSV file.

Dr. Hoo, can we pull numbers for each plot out of drone images?
We can. QGIS calculates vegetation indices and plant height, then averages them for each plot. At the end, everything goes into one table.

What you need (all free)

  • QGIS Free GIS software, available from qgis.org.
  • Orthoimage and DSM A .tif orthoimage and digital surface model (DSM) built from drone imagery.
  • Polygons Vector data that divides the field into plots (.shp or .gpkg).
01

Open the data

You load data into QGIS from the "Data Source Manager" (the icon at the top left of the toolbar, or Ctrl + L). Switch tabs depending on the type of data you are opening.

Opening the Data Source Manager(view larger image)
Use "Open Data Source Manager" on the toolbar to load each kind of data.

Open the orthoimage and DSM (raster)

On the "Raster" tab, choose the .tif orthoimage or DSM and click "Add." If the image appears on the map, it loaded successfully.

Adding the orthoimage from the Raster tab(view larger image)
Add the orthoimage or DSM from the "Raster" tab.
Checking the loaded orthoimage on the map(view larger image)
The image appears on the map when it loads.

Open the polygons

From the "Vector" tab, add the plot polygons (.shp or .gpkg). They appear layered over the orthoimage.

Adding polygons from the Vector tab(view larger image)
Load the field plot polygons from the "Vector" tab.

Open a CSV or ground control points (GCPs)

To open a CSV that carries coordinates (such as ground control points), use the "Delimited Text" tab. Set the encoding to UTF-8 and the delimiter to comma, then check "First record has field names" and "Detect field types." If it has coordinates, choose "Point coordinates" under Geometry Definition and specify the X and Y (and Z, if any) fields.

Choosing a CSV on the Delimited Text tab(view larger image)
Choose the CSV file on the "Delimited Text" tab.
Setting the encoding and delimiter(view larger image)
Check the encoding, delimiter, and field-name settings, then set the X and Y fields.
Checking the new point layer in the Layers panel(view larger image)
When the CSV loads, a point layer appears in the Layers panel.
Setting the coordinate reference system from the right-click menu(view larger image)
If needed, right-click the layer to set the coordinate reference system (CRS).

If the coordinate reference system (CRS) of the points does not match, right-click the layer and set it with a command such as "Layer CRS → Set Project CRS from Layer" (e.g., EPSG:32653). If the points are too small to see, adjust their size and color in the layer's "Properties → Symbology."

Opening Properties from the right-click menu(view larger image)
Open "Properties" from the same right-click menu.
Adjusting the symbology of the points(view larger image)
Adjust the point size and color in Symbology for clarity.

For a CSV that has attributes only, with no coordinates (a table of variety names, replication numbers, and so on), choose "No geometry (attribute only table)" under Geometry Definition. You will join it to the polygons in the next step.

02

Join attributes to the polygons

When plot attributes (variety, replication, and so on) live in a separate CSV, join them to the polygons using a shared column (for example, fid). Right-click the polygon layer and open "Properties → Joins," then click "+". Set the attribute CSV as the "Join layer" and the shared column as both the "Join field" and "Target field." Then check only the attributes you need and click "OK."

Joining CSV attributes to the polygons on the Joins tab(view larger image)
Use "Properties → Joins" to attach attributes via a shared column.
03

Check the joined attributes on the map

After the join, confirm that the attributes are linked to the right polygons. Open the polygon layer's attribute table and you will see the joined columns (such as variety) added. Using "Select by Expression," you can enter a condition like Variety = 'Koshi' to highlight only the matching plots on the map.

Checking the join in the attribute table(view larger image)
Check that the joined columns appear in the attribute table.
Using Select by Expression to check plots(view larger image)
"Select by Expression" highlights the plots that match a condition.
Checking the plots highlighted in yellow on the map(view larger image)
The matching plots turn yellow on the map.
Clearing the selection with the button in the attribute table(view larger image)
When you are done, click the circled button in the attribute table to clear the selection.

With labels, you can display the variety name or number directly on each plot. Check on the map that the plots are laid out the way you intend.

04

Getting around the map

A few basics make the work much smoother. Drag to pan, use the mouse wheel to zoom, and toggle the checkboxes in the "Layers" panel to show or hide layers. Layers higher in the list are drawn in front, so reorder them to control what overlaps what.

Dragging a layer to reorder it in the Layers panel(view larger image)
Show, hide, and reorder layers in the Layers panel.
Toggling a layer's checkbox and choosing Remove Layer from the right-click menu(view larger image)
Use the checkbox to show or hide a layer, and choose "Remove Layer" from its right-click menu when you no longer need it.
05

Compute features (vegetation indices and plant height)

How do you work out plant height?
Subtract a DSM of the bare ground from a DSM taken when the crop has grown. The difference between the two heights is the height of the plants.

Compute features with the "Raster Calculator" ("Processing → Toolbox → Raster analysis → Raster calculator"). In the expression field, write a formula that combines the bands you want. For the simple ratio (SR) index, for example, divide the near-infrared (NIR) band by the red band.

"(NIR band)@1" / "(Red band)@1"
Computing a vegetation index in the Raster Calculator(view larger image)
In the Raster Calculator, combine bands to compute a vegetation index (e.g., SR = NIR / Red).
Setting the reference layer and the output file in the Raster Calculator(view larger image)
Below the expression field, set the reference layer and the output file.

For plant height, subtract a ground-only DSM (baseline) from the DSM taken when the crop has grown.

"(growth-stage DSM)@1" - "(ground DSM)@1"

If the result looks too dark to read, adjust the display minimum and maximum (Min / Max) in the layer's "Properties → Symbology" to make the distribution easier to see.

Adjusting the display Min and Max in Symbology(view larger image)
Adjust Min / Max in "Symbology" to make the distribution clearer.
06

Extract a value per polygon (zonal statistics)

What does zonal statistics do?
It averages the pixel values inside each plot polygon into a single number. Then the plots can be compared side by side.

Now reduce each feature to a single number per plot. Open "Processing → Toolbox → Raster analysis → Zonal statistics," then set the plot polygons as the input layer and the feature image as the raster layer. Check "Mean" among the statistics and run the tool, and you get the mean of the pixels inside each polygon, plot by plot.

You can save the output as CSV. Leave "Open output file after running algorithm" unchecked so you do not pile up extra layers, which makes the next join easier. Repeat the same step for each feature, such as vegetation indices, plant height, and texture.

07

Join the extracted features and export

Join the CSV from zonal statistics to the polygons on the same "Joins" tab as in Step 2. Each plot then has its variety, replication, vegetation index, plant height, and other values in one table. Finally, right-click the polygon layer and choose "Export → Save Features As," set the format to CSV, and write it out.

Exporting as CSV with Save Features As(view larger image)
Use "Export → Save Features As" and choose CSV as the format.

You can leave "Add saved file to map" unchecked. Open the exported CSV in Excel and resave it as .xlsx, and it is ready for statistical analysis and plotting.


At this point you have turned drone imagery into a single table of features, one row per plot. Analyze that table and you can compare growth across varieties and treatments in numbers. Start with a single feature to learn the flow, then add others as you go, such as vegetation indices, plant height, and texture.

So it's best to learn the flow with one feature first, then add more.
Exactly. Once you are comfortable, add vegetation indices, plant height, and texture, a little at a time.