02 — Methods / Tutorial

Texture Analysis of UAV Imagery in QGIS
with Orfeo Toolbox (OTB)

Turn the texture of an image into numbers to help estimate crop growth

Illustration of turning pixel patterns into a texture matrix

A drone image carries information about a crop not only in its brightness, but also in its texture. A dense canopy and a sparse one produce different fine-grained patterns of light and shade. Texture analysis turns those patterns into numbers, giving you features that vegetation indices alone cannot capture. This page walks through adding the image-processing library Orfeo Toolbox (OTB) to the free GIS software QGIS, and computing texture features from a UAV orthoimage, step by step.

Dr. Hoo, can the texture of an image tell us about a crop?
It can. A dense canopy and a sparse one leave different fine patterns in an image. Texture analysis turns those patterns into numbers.

What you need (all free)

  • QGIS Free GIS software, available from qgis.org. Choose a version that OTB supports (see below).
  • Orfeo Toolbox (OTB) A free image-processing library from orfeo-toolbox.org that does the texture computation.
  • A UAV orthoimage The .tif orthoimage you want to analyze (RGB or multispectral).
01

Check which QGIS version OTB supports

Why not just install the newest QGIS?
That is the trap. The OTB plugin works only with certain QGIS versions. Check which version OTB supports first, then install that QGIS.

The OTB plugin only works with certain QGIS versions. Installing the newest QGIS may leave the plugin unusable. The reliable approach is to first check which QGIS version your OTB supports, then install that version of QGIS. You can check compatibility on the official OTB site.

This article uses QGIS 3.22 with OTB 8.0.0, a combination that is confirmed to work. Start with this pairing, and only try other versions if something does not work.

02

Install QGIS

Download the QGIS version you identified in Step 1 from qgis.org and install it. Run the installer and follow the prompts.

03

Install OTB (Orfeo Toolbox)

Next, download OTB from orfeo-toolbox.org and extract it somewhere convenient. Note the path of the extracted folder (for example, C:/OTB-8.0.0-Win64), since you will point QGIS to it in the next step.

04

Add OTB to QGIS

To let QGIS use the OTB tools, set up two things. First, open "Plugins → Manage and Install Plugins," go to "Settings," and under "Plugin repositories" click "Add" to register the OTB repository. Give it a clear name (for example, Orfeo Repository) and enter the URL http://orfeo-toolbox.org/qgis/plugins.xml.

Adding the Orfeo Repository under plugin repositories(view larger image)
Under "Settings → Plugin repositories," add the OTB repository.

Next, open "Settings → Options" and select "Processing → Providers → OTB." Set "OTB application folder" to (your extracted path)/lib/otb/applications and "OTB folder" to the extracted folder (for example, C:/OTB-8.0.0-Win64), then click "OK."

Setting the OTB folders in Processing options(view larger image)
Under "Processing → Providers → OTB," point QGIS to the OTB application folder and OTB folder.

When the setup is correct, an OTB entry appears in the Processing Toolbox on the right. Open it and OTB's tools, including texture analysis, become available.

OTB appears in the Processing Toolbox(view larger image)
The texture tools sit under "OTB → Feature Extraction."
05

Run the texture analysis

There are so many settings. I don't know what they mean.
The defaults are fine to start with. What matters is using the same settings for every image.

In the Processing Toolbox, open "OTB → Feature Extraction → HaralickTextureExtraction." This is a well-known way to quantify texture from the pattern of light and shade in an image (Haralick texture features). Set your orthoimage as the "Input Image," adjust the settings below as needed, and run it.

Setting the parameters of HaralickTextureExtraction(view larger image)
Set the input image and parameters, then run. "Run as Batch Process" at the bottom switches to batch mode.
  • Selected Channel is the band (channel) to analyze.
  • X Radius / Y Radius set the size of the window used to read texture. Larger windows capture broader patterns.
  • Histogram number of bin sets how many levels the brightness is divided into.
  • Texture Set Selection chooses which texture features to output (such as "simple").

Running it produces a new image holding the texture features. Try the defaults first, then adjust the window size and other settings while looking at the results.

You do not need to understand every parameter at first. The defaults are fine. What matters is using the same settings for every image. If the settings vary, you can no longer compare one field with another.

06

Process many images at once with batch mode

When you have many images across several fields, processing them one by one is tedious. Click "Run as Batch Process" at the bottom of the parameter window to process many images with the same settings at once.

Batch processing many images at once(view larger image)
The batch window. Each row is one image, all processed with the same settings.

You can add input images one by one. To add every image in a folder at once, choose "Add All Files from a Directory..." from the menu at the top of the "Input Image" column. Use the same settings in the other columns for every row, then click "Run" to get the texture features for all images together.

Adding all files from a directory at once(view larger image)
"Add All Files from a Directory..." loads every image in a folder in one step.

Combined with vegetation indices and plant height, texture features can improve the accuracy of crop growth estimation. QGIS and OTB are both free, and once you are used to them, the whole workflow takes only a few minutes. Try it on a single image first, and once it works, use batch mode to scale up to the whole field.

So try one image first, then use batch mode for the rest.
Exactly. Combined with vegetation indices and plant height, texture makes growth estimates more accurate.