Texture analysis of orthoimages created from UAV aerial images using QGIS(UAV空撮画像から作成したオルソ画像をQGISを用いてテクスチャ解析する)

Overview
概要

Texture analysis, which can quantify the texture of an image, is used to estimate crop growth from images, along with vegetation indices. Here, the Orfeo Toolbox (OTB) is implemented in QGIS, a free GIS software, to create texture orthoimages from orthoimages (RGB, multispectral) created from UAV aerial images.
画像の質感を数値化できるテクスチャ解析は,植生指数などとともに画像からの作物の生育推定に用いられています.ここでは,無料の地理情報システムソフトであるQGISにOrfeo Toolbox(OTB)を導入し,UAV空撮画像から作成したオルソ画像(RGB,マルチスペクトル)から様々なテクスチャ指標のオルソ画像を作成します.

Check version compatibility
バージョンの対応関係を確認

This is important for setups. First, check the correspondence between the version of QGIS and OTB that you will be using. According to this page, OTB 8.0.0 can be used with QGIS >= 3.18.
環境構築において非常に重要です.まず,今回使うQGISとOTBのバージョンの対応関係を確認しましょう. こちらによると,OTB 8.0.0はQGIS >= 3.18で使用可能とのこと.

QGIS interface — Orfeo ToolBox 8.1.1 documentation (orfeo-toolbox.org)

The operation has been confirmed with QGIS = 3.22.5 and OTB = 8.0.0.
QGIS = 3.22.5, OTB = 8.0.0で動作確認済.

Download QGIS

QGIS is free software that allows users to browse and analyze geographic information systems. Because it is open source, development of useful plug-ins has been active, and OTB is one of such plug-ins used here. The latest version can be downloaded from the official QGIS website.
QGISとは,地理情報システムの閲覧や分析ができる無料のソフトウェアです.オープンソースであるため,便利なプラグインの開発が盛んにおこなわれており,今回用いるOTBもそうしたプラグインの1つです. QGISの公式サイトから最新版がダウンロードできます.

QGISプロジェクトへようこそ!

However, in this case, we want to download the version we just checked, so let's download the appropriate version from this archive.
しかし,今回は先ほど確認したバージョンをダウンロードしたいので,こちらのアーカイブから該当するバージョンのものをダウンロードしましょう.

https://download.qgis.org/downloads/

The QGIS Documentation is available here.
ちなみに,QGISのDocumentation(説明書)はこちらにあります.

https://docs.qgis.org/3.22/ja/docs/index.html

Download OTB

OTB is an open source project for processing remote sensing images. This time, texture analysis is performed using OTB. Similarly, download the appropriate version of OTB from this archive.
OTBとは,リモートセンシング画像にさまざまな処理を施すためのオープンソースプロジェクトです.今回はこのOTBを使ってテクスチャ解析を行います. 同様に,OTBについてもこちらのアーカイブから該当するバージョンのものをダウンロードしましょう.

Index of /packages/archives/OTB (orfeo-toolbox.org)

Although not used in this project, the latest version can be downloaded from the official OTB website.
なお,OTBの公式サイトからは最新版がダウンロードできます.

Orfeo ToolBox – Orfeo ToolBox is not a black box (orfeo-toolbox.org)

Introducing OTB into QGIS
OTBをQGISに導入する

Place the downloaded OTB file in C:.
Open QGIS. At the top, click on the
Plugins
→Manage and Install Plugins
→Settings
→Plugin Repositories
→Add
name it Orfeo Repository,
set URL to http://orfeo-toolbox.org/qgis/plugins.xml,
check the "Enabled" checkbox,
and OK.

ダウンロードしたOTBのファイルはC: に配置しておきましょう.
QGISを開きます.
上のほうにある
プラグイン
プラグインの管理とインストール
→設定
プラグインリポジトリ
→追加
で名前をOrfeo Repository
URLをhttp://orfeo-toolbox.org/qgis/plugins.xmlとし,
有効化にチェックを入れてOK

Plugins
→Manage and Install Plugins
→All
→check "Orfeo Toolbox provider" checkbox
プラグインプラグインの管理とインストール
→すべて
→Orfeo Toolbox providerにチェック

Settings
→Options
→Processing
→Providers
→OTB
OTB application folder: C:/OTB-8.0.0-Win64/lib/otb/applications OTB folder: C:/OTB-8.0.0-Win64
check the "Enabled" checkbox, and OK.
設定 →オプション
→プロセシング
→プロバイダ
→OTB
でOTBアプリケーションフォルダをC:/OTB-8.0.0-Win64/lib/otb/applications
OTBフォルダをC:/OTB-8.0.0-Win64とし,
有効化にチェックを入れてOK

Thereafter,
Processing
→ Toolbox
to check the processing toolbox, you can see OTB is available.
その後, プロセシング
ツールボックス
でプロセシングツールボックスを確認すると、OTBが使えるようになっている

Texture analysis using OTB
OTBを用いてテクスチャ解析をする

You can conduct texture analysis from Processing
→ Toolbox
→ OTB
→ Feature Extraction
→ HaralickTextureExtraction

parameters as below:

  • Input Image: Source image for texture analysis
  • Selected Channel: Allows you to select a channel of the source image to process.
  • X Radius, Y Radius: size of the kernel, where X is the width and Y is the height. 2 × radius + 1 is the actual size of the kernel.
  • Offset: Distance between pixels used to compute the texture.
  • Histogram number of bin: Number of dimensions after dimensionality compression.
  • Texture Set Selection: type of output texture images

プロセシング
ツールボックス
→ OTB
→ Feature Extraction
→ HaralickTextureExtraction
からテクスチャ解析ができます。

パラメータは以下の通り

  • Input Image:テクスチャ解析の元となる画像
  • Selected Channel:処理を行う元画像のチャンネルを選ぶことができる
  • X Radius, Y Radiusカーネルのサイズ.Xが横でYが縦.2 × radius + 1がカーネルのサイズになる.
  • Offset:テクスチャの計算に使われる画素間の距離
  • Histogram number of bin:次元圧縮後の次元数
  • Texture Set Selection:出力されるテクスチャ画像の種類

Multiple images can be analyzed at once in batch processing
バッチ処理で複数の画像を一括で解析できる

Some software and tools have a batch processing function that performs multiple processes on multiple inputs at once. The OTB we are using here also has a batch processing function, which can be used for efficient texture analysis. Click on Run as Batch Process...
ソフトウェアやツールには、バッチ処理という複数の入力に対して複数の処理を一括で行ってくれる機能がついてたりします。 今回扱っているorfeo toolboxにもバッチ処理の機能が付いており、これを活用することで効率的にテクスチャ解析が可能です。 以下のRun as Batch Process...から

You can move to the following window.
以下のようなウィンドウに推移できます。

Here, by clicking the + icon in the upper left corner to add a row, and setting the parameters as described before, the analysis of the set contents will be performed at once.
ここで、左上の+アイコンをクリックして行を追加し、先ほどのパラメータを設定していくことで、設定した内容の解析を一括で行ってくれます。

It has an Autofill function, which automatically adds a line for the same item, and when a Directory is selected, all file names contained in it can be automatically entered.
Autofill機能が備わっており、自動で同項目の行を追加したり、Directoryを指定するとそこに含まれるすべてのファイル名が自動で入力できたりします。

In addition, it is convenient later on to save the settings with the floppy disk icon in the upper left corner and to load them with the folder icon, in case of processing.
また、左上のフロッピーディスクのアイコンで設定した内容の保存、フォルダのアイコンからロードができるので、処理を行った場合には、一応保存をしておくと後々便利です。