04 — 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

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.

What you need (all free)

01 Check which QGIS version OTB supports

The OTB plugin only works with certain QGIS versions. Installing the newest QGIS may leave the plugin unusable, so the reliable approach is to first check which QGIS version your OTB supports and install that version of QGIS. You can confirm the 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 call OTB, 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
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
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
The texture tools sit under OTB → Feature Extraction.
05 Run the texture analysis

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
Set the input image and parameters, then run. "Run as Batch Process" at the bottom switches to batch mode.

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
The batch window. Each row is one image, all processed with the same settings.

You can add input images one by one, but choosing "Add All Files from a Directory..." from the menu at the top of the "Input Image" column adds every image in a folder at once. Match the other columns and click "Run" to get the texture features for all images together.

Adding all files from a directory at once
"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 flow 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.