0% found this document useful (0 votes)
27 views180 pages

Semiautomatic Classification Manual

The Semi-Automatic Classification Plugin (SCP) is an open-source tool for QGIS designed for the semi-automatic classification of remote sensing images, developed by Luca Congedo. The documentation provides detailed instructions for installation on various operating systems, interface usage, and a brief introduction to remote sensing concepts. It also includes tutorials, FAQs, and information on required dependencies for optimal functionality.

Uploaded by

deisvons
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views180 pages

Semiautomatic Classification Manual

The Semi-Automatic Classification Plugin (SCP) is an open-source tool for QGIS designed for the semi-automatic classification of remote sensing images, developed by Luca Congedo. The documentation provides detailed instructions for installation on various operating systems, interface usage, and a brief introduction to remote sensing concepts. It also includes tutorials, FAQs, and information on required dependencies for optimal functionality.

Uploaded by

deisvons
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 180

Semi-Automatic Classification Plugin

Documentation
Release 8.0.9.2

Luca Congedo

Oct 22, 2023


CONTENTS

1 Introduction 1

2 Plugin Installation 3
2.1 Installation in Windows 64 bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Installation in Debian/Ubuntu Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Installation in macOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Advanced installation using Conda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3 The Interface of SCP 21


3.1 SCP menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 SCP dock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Working toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4 Main Interface Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.5 Spectral Signature Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
3.6 Scatter Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
3.7 Integration in QGIS Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

4 Brief Introduction to Remote Sensing 113


4.1 Basic Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.2 Multispectral satellites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.3 SAR satellites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.4 Land Cover Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
4.5 Image processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
4.6 Image conversion to reflectance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
4.7 Conversion to Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
4.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

5 Basic Tutorials 147


5.1 Tutorial 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

6 Thematic Tutorials 163

7 Frequently Asked Questions 165


7.1 Plugin installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
7.2 Pre processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.3 Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7.4 Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.5 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.6 Various . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

i
ii
CHAPTER

ONE

INTRODUCTION

Developed by Luca Congedo ([email protected]), the Semi-Automatic Classification Plugin (SCP) is


a free open source plugin for QGIS that allows for the semi-automatic classification (also known as supervised clas-
sification) of remote sensing images. It provides several tools for the download of free images, the preprocessing,
the postprocessing, and the raster calculation.
The overall objective of SCP is to provide a set of intertwined tools for raster processing in order to make an
automatic workflow and ease the land cover classification, which could be performed also by people whose main
field is not remote sensing.
SCP exploits the parallel processing of the tools provided by Remotior Sensus, a Python package that allows for
the processing of remote sensing images and GIS data.
This user manual provides information about the Plugin Installation (page 3) of SPC and the The Interface of SCP
(page 21), with detailed information about all the functions. In addition, the Brief Introduction to Remote Sensing
(page 113) illustrates the basic concepts and definitions which are required for using the SCP.
For more information and tutorials visit the official site

From GIS to Remote Sensing

How to cite:
Congedo, Luca, (2021). Semi-Automatic Classification Plugin: A Python tool for the download and processing
of remote sensing images in QGIS. Journal of Open Source Software, 6(64), 3172, https://doi.org/10.21105/joss.
03172

Brief history:
The first version of the SCP was developed by Luca Congedo in 2012 for the “ACC Dar Project” in order to create
a tool for the classification of land cover in an affordable and automatic fashion; following versions of SCP were
developed as personal commitment to the remote sensing field and open source philosophy. SCP version 6 was
developed in the frame of Luca Congedo’s PhD in Landscape and Environment at Sapienza University of Rome.
SCP version 7 and version 8 as personal commitment to the remote sensing field and open source philosophy.

License:
Except where otherwise noted, content of this work is licensed under a Creative Commons Attribution-ShareAlike
4.0 International License.
Semi-Automatic Classification Plugin is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published by the Free
Software Foundation, version 3 of the License. Semi-Automatic Classification Plugin is
distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

1
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

GNU General Public License for more details. You should have received a copy of the
GNU General Public License along with Semi-Automatic Classification Plugin. If not,
see http://www.gnu.org/licenses/.

Translators:
Language: Author name

2 Chapter 1. Introduction
CHAPTER

TWO

PLUGIN INSTALLATION

The Semi-Automatic Classification Plugin requires the installation of GDAL, OGR, NumPy, SciPy and Matplotlib
.
This chapter describes the installation of the Semi-Automatic Classification Plugin for the supported Operating
Systems.

2.1 Installation in Windows 64 bit

2.1.1 QGIS download and installation

• Download the latest QGIS version 64 bit from here ;


• Execute the QGIS installer with administrative rights, accepting the default configuration.
Now, QGIS is installed.

3
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

2.1.2 Installation of required dependencies

The Semi-Automatic Classification Plugin requires Remotior Sensus, GDAL, NumPy and SciPy for most func-
tionalities. Optionally, scikit-learn and PyTorch are required for machine learning.
Therefore, we need to install the dependencies that are not included in the QGIS installation.
• Close QGIS;
• From the Start menu, open OSGeo4W Shell (administrative rights may be required);

• Enter the following command:

pip3 install --upgrade remotior-sensus scikit-learn torch

Follow the same procedure for updating the dependencies.

Tip: In case of issues please read Advanced installation using Conda (page 16).

2.1.3 Semi-Automatic Classification Plugin installation

• Run QGIS;
• From the main menu, select Plugins > Manage and Install Plugins;

• From the menu All, select the Semi-Automatic Classification Plugin and click the button Install plugin;

4 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• The SCP should be automatically activated; however, be sure that the Semi-Automatic Classification Plugin
is checked in the menu Installed (the restart of QGIS could be necessary to complete the SCP installation);

2.1.4 Configuration of the plugin

Now, the Semi-Automatic Classification Plugin is installed and a dock and a toolbar should be added to QGIS.
Also, a SCP menu is available in the Menu Bar of QGIS. It is possible to move the toolbar and the dock according
to your needs, as in the following image.

2.1. Installation in Windows 64 bit 5


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

The configuration of available RAM is recommended in order to reduce the processing time. From the SCP menu

(page 21) select Settings > Processing .

6 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

In the Settings (page 97), set the Available RAM (MB) to a value that should be half of the system RAM. For
instance, if your system has 2GB of RAM, set the value to 1024MB.

2.1.5 Update of required dependencies

The dependency Remotior Sensus is frequently updated. The Semi-Automatic Classification Plugin can check
automatically if a new version is available, and display a message in the SCP dock (page 22).

It is recommended to close QGIS and update Remotior Sensus following the same installation steps described in
Installation of required dependencies (page 4) .

2.2 Installation in Debian/Ubuntu Linux

2.2.1 QGIS download and installation

• Open a terminal and type:

sudo apt-get update

• Press Enter and type the user password;


• Type in a terminal:

sudo apt-get install qgis python3-matplotlib python3-scipy

• Press Enter and wait until the software is downloaded and installed.

2.2. Installation in Debian/Ubuntu Linux 7


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Now, QGIS is installed.

2.2.2 Installation of required dependencies

The Semi-Automatic Classification Plugin requires Remotior Sensus, GDAL, NumPy and SciPy for most func-
tionalities. Optionally, scikit-learn and PyTorch are required for machine learning.
Therefore, we need to install the dependencies that are not included in the QGIS installation.
• Close QGIS;
• Open the terminal (administrative rights may be required);
• Enter the following command:

pip3 install --upgrade remotior-sensus scikit-learn torch

Warning: In case you get an error message related to externally managed environment, you may use (at the
risk of breaking the OS or the Python installation) the option --break-system-packages; alternatively, it
is possible to create a virtual environment python3 -m venv env, install the packages in it, and start QGIS
from the activated environment.

Follow the same procedure for updating the dependencies.

Tip: In case of issues please read Advanced installation using Conda (page 16).

8 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

2.2.3 Semi-Automatic Classification Plugin installation

• Run QGIS;
• From the main menu, select Plugins > Manage and Install Plugins;

• From the menu All, select the Semi-Automatic Classification Plugin and click the button Install plugin;

• The SCP should be automatically activated; however, be sure that the Semi-Automatic Classification Plugin
is checked in the menu Installed (the restart of QGIS could be necessary to complete the SCP installation);

2.2. Installation in Debian/Ubuntu Linux 9


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

2.2.4 Configuration of the plugin

Now, the Semi-Automatic Classification Plugin is installed and a dock and a toolbar should be added to QGIS.
Also, a SCP menu is available in the Menu Bar of QGIS. It is possible to move the toolbar and the dock according
to your needs, as in the following image.

The configuration of available RAM is recommended in order to reduce the processing time. From the SCP menu

(page 21) select Settings > Processing .

10 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

In the Settings (page 97), set the Available RAM (MB) to a value that should be half of the system RAM. For
instance, if your system has 2GB of RAM, set the value to 1024MB.

2.2. Installation in Debian/Ubuntu Linux 11


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

2.2.5 Update of required dependencies

The dependency Remotior Sensus is frequently updated. The Semi-Automatic Classification Plugin can check
automatically if a new version is available, and display a message in the SCP dock (page 22).

It is recommended to close QGIS and update Remotior Sensus following the same installation steps described in
Installation of required dependencies (page 8) .

2.3 Installation in macOS

2.3.1 QGIS download and installation

• Download the latest QGIS version from here ;


• Execute the QGIS installer with administrative rights, accepting the default configuration.
Now, QGIS is installed.

12 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

2.3.2 Installation of required dependencies

The Semi-Automatic Classification Plugin requires Remotior Sensus, GDAL, NumPy and SciPy for most func-
tionalities. Optionally, scikit-learn and PyTorch are required for machine learning.
Therefore, we need to install the dependencies that are not included in the QGIS installation.
• Close QGIS;
• Open the terminal (administrative rights may be required);
• Type the following command (you may need to adapt the path /Applications/QGIS.app to the actual QGIS
installation directory):

/Applications/QGIS.app/Contents/MacOS/bin/pip3 install --upgrade remotior-sensus␣


˓→scikit-learn torch

or in case you installed QGIS LTR:

/Applications/QGIS-LTR.app/Contents/MacOS/bin/pip3 install --upgrade remotior-sensus␣


˓→scikit-learn torch

Tip: In case of error messages such as scikit-learn is already installed, you can just run /Applications/QGIS.
app/Contents/MacOS/bin/pip3 install --upgrade remotior-sensus torch

Follow the same procedure for updating the dependencies.

Tip: In case of issues please read Advanced installation using Conda (page 16).

2.3.3 Semi-Automatic Classification Plugin installation

• Run QGIS;
• From the main menu, select Plugins > Manage and Install Plugins;

• From the menu All, select the Semi-Automatic Classification Plugin and click the button Install plugin;

2.3. Installation in macOS 13


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• The SCP should be automatically activated; however, be sure that the Semi-Automatic Classification Plugin
is checked in the menu Installed (the restart of QGIS could be necessary to complete the SCP installation);

2.3.4 Configuration of the plugin

Now, the Semi-Automatic Classification Plugin is installed and a dock and a toolbar should be added to QGIS.
Also, a SCP menu is available in the Menu Bar of QGIS. It is possible to move the toolbar and the dock according
to your needs, as in the following image.

14 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

The configuration of available RAM is recommended in order to reduce the processing time. From the SCP menu

(page 21) select Settings > Processing .

2.3. Installation in macOS 15


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

In the Settings (page 97), set the Available RAM (MB) to a value that should be half of the system RAM. For
instance, if your system has 2GB of RAM, set the value to 1024MB.

2.3.5 Update of required dependencies

The dependency Remotior Sensus is frequently updated. The Semi-Automatic Classification Plugin can check
automatically if a new version is available, and display a message in the SCP dock (page 22).

It is recommended to close QGIS and update Remotior Sensus following the same installation steps described in
Installation of required dependencies (page 13) .

2.4 Advanced installation using Conda

2.4.1 QGIS download and installation with the dependencies

The Semi-Automatic Classification Plugin requires Remotior Sensus, GDAL, NumPy and SciPy for most func-
tionalities.
QGIS and the dependencies can be installed using a Conda environment (if you don’t know Conda please read
https://conda-forge.org/docs). For instance, you can use Miniforge to create a Conda environment.
Once installed conda, open the terminal and run the following commands to create a new environment:

16 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

$ conda create -c conda-forge --name environment python=3.10


Proceed ([y]/n)? y
$ conda activate environment

Now install QGIS and the dependencies (it could take some time):

$ conda install -c conda-forge qgis gdal remotior-sensus scikit-learn pytorch

Now, QGIS is installed. To launch it run in the terminal:

$ qgis

2.4.2 Semi-Automatic Classification Plugin installation

• Run QGIS;
• From the main menu, select Plugins > Manage and Install Plugins;

• From the menu All, select the Semi-Automatic Classification Plugin and click the button Install plugin;

2.4. Advanced installation using Conda 17


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• The SCP should be automatically activated; however, be sure that the Semi-Automatic Classification Plugin
is checked in the menu Installed (the restart of QGIS could be necessary to complete the SCP installation);

2.4.3 Configuration of the plugin

Now, the Semi-Automatic Classification Plugin is installed and a dock and a toolbar should be added to QGIS.
Also, a SCP menu is available in the Menu Bar of QGIS. It is possible to move the toolbar and the dock according
to your needs, as in the following image.

18 Chapter 2. Plugin Installation


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

The configuration of available RAM is recommended in order to reduce the processing time. From the SCP menu

(page 21) select Settings > Processing .

2.4. Advanced installation using Conda 19


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

In the Settings (page 97), set the Available RAM (MB) to a value that should be half of the system RAM. For
instance, if your system has 2GB of RAM, set the value to 1024MB.

2.4.4 Update of required dependencies

The dependency Remotior Sensus is frequently updated. The Semi-Automatic Classification Plugin can check
automatically if a new version is available, and display a message in the SCP dock (page 22).

It is recommended to close QGIS and update Remotior Sensus using activating the conda environment and running
the command:

$ conda update -c conda-forge remotior-sensus

20 Chapter 2. Plugin Installation


CHAPTER

THREE

THE INTERFACE OF SCP

The SCP interface is composed of several parts that are described in detail in the following paragraphs. The
following video provides a brief introduction to the tools.
https://www.youtube.com/watch?v=gvSSO5LPw8s

3.1 SCP menu

Fig. 1: SCP menu

21
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

The SCP menu allows for the selection of the main functions of the Main Interface Window (page 36), the Spectral
Signature Plot (page 103), and the Scatter Plot (page 106).

Band set (page 36)

Download products (page 39)

Basic tools (page 44)

Preprocessing (page 52)

Band processing (page 64)

Postprocessing (page 81)

Band calc (page 88)

Script (page 96)

Settings (page 97)

Spectral Signature Plot (page 103)

Scatter Plot (page 106)

User manual: open the online user manual in a web browser

Online help: open the Online help in a web browser; also, a Facebook group is available for sharing
information and asking for help about SCP
About Information about the plugin

Show plugin: show all the SCP toolbars and dock if previously hidden

3.2 SCP dock

The SCP dock allows for the the creation of ROIs (Regions Of Interest) and spectral signatures required for the
classification of a Band set (page 36). The Training input (page 24), created with SCP, stores the ROI polygons
and spectral signatures; depending on the algorithm, the training could be performed using ROI polygons (e.g.
Random Forest (page 131)) or spectral signatures (e.g. Spectral Angle Mapping (page 127)).
ROIs are polygons used for the definition of the spectral characteristics of land cover classes. Spectral signatures
of classes are calculated from the ROIs or can be imported from other sources (see Import signatures (page 45)).
It is worth pointing out that classification is always based on spectral signatures.
SCP allows for the creation of temporary ROI polygons using a region growing algorithm or drawn manually with
the tools provided in the Working toolbar (page 32). These are temporary ROI polygons because the ROI creation
is an interactive process, and one can refine the geometry according to photointerpreation. Then, one can save
temporary ROI polygons in the Training input (page 24) which is the actual input for classifications.
The Training input (page 24) is composed of a vector part that stores the geometries and a spectral signature part,
which are managed by SCP. A temporary layer is added to QGIS but the actual file is saved and modified during
the editing in SCP.
In SCP, land cover classes (and ROIs) are defined with a system of Classes (Class ID) and Macroclasses (Macro-
class ID) (see Classes and Macroclasses (page 124)) that are used for the classification process; each Macroclass ID
is related to a Macroclass Information (e.g. macroclass name) and each Class ID is related to a Class Information
(e.g. class name), but only Macroclass ID and Class ID are used for the classification process.
The use of the Macroclass ID or Class ID for classifications is defined with the option Use MC ID or C ID in the
Algorithm (page 65). Using Macroclass ID instead of Class ID is useful to group materials that belong to the same

22 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 2: SCP dock

3.2. SCP dock 23


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

land cover class but have spectral signatures that are distant enough to be considered as different materials (e.g.,
different types of vegetation).
The classification can be performed for the entire image (see Algorithm (page 65)) or for a part of it creating a
Classification preview (page 35).
The SCP dock contains the following tabs:

• Home (page 24)


– SCP news (page 24)
• Training input (page 24)
– ROI & Signature list (page 27)
• ROI options (page 32)

The left side of SCP dock contains buttons for accessing the main functions of SCP.

3.2.1 Home

The tab Home contains the buttons for accessing the main functions of SCP:

Band set (page 36)

Basic tools (page 44)

Download products (page 39)

Preprocessing (page 52)

Band processing (page 64)

Postprocessing (page 81)

Band calc (page 88)

Script (page 96)

SCP news

This section displays news about the SCP and related services. News are downloaded on startup (internet connec-
tion required). It can be enabled or disabled in the settings Settings (page 97).

3.2.2 Training input

This tool allows for the creation of the training input file (.scpx ) required for storing ROIs and spectral signa-
tures. The training input file is created according to the characteristics of the active band set defined in Band set
(page 36). A new training input file should be created for every band set, unless the band sets have the same spectral
characteristics and coordinate reference system.

24 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 3: Home

3.2. SCP dock 25


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 4: Training input

26 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool Description
sym-
bol
and
name

open a training input file; ROIs and spectral signatures are loaded in ROI & Signature list (page 27);
the vector part of the training input is loaded in QGIS

create an empty training input file (.scpx); the vector part of the training input is loaded in QGIS;
also a backup file is created (a file .scpx.backup in the same directory as the file .scpx) when the
QGIS project is saved; to use the backup file simply rename it deleting the ending .backup extension
and open it as training input
Train- it displays the path to the training input file
ing
input

remove the training input

The training input is displayed in QGIS as vector file. ROIs and spectral signatures are displayed in the ROI &
Signature list (page 27).

Warning: In order to avoid data loss, do not edit the vector Training input using the QGIS tools. Use only the
tools of SCP for managing the Training input.

ROI & Signature list

The tab ROI & Signature list displays the ROI polygons and spectral signatures contained in the training input file.
The tab ROI & Signature list is structured as tree list, where every ROI is grouped in the corresponding Macroclass.

A filter for names can be defined in Filter .


The tree list ROI & Signature list has the following fields:
• MC ID: Macroclass ID is the root of corresponding ROIs and signatures; it can be edited with a single click;
if the ID of a spectral signature is set 0, then pixels belonging to this signature are labelled as unclassified;
every listed ROIs or signatures has a selection checkbox (only the spectral signatures checked in this list are
used for the classification process);
• C ID: Class ID; it can be edited with a single click;
• Name: Macroclass and Class Name; it can be edited with a single click;
• Type: type of the item:
– R = only ROI polygon;
– S = only spectral signature;
– RS = both ROI and spectral signature;
• Color: C ID color; double click to select a color for the class that is used in the classification; if the ID of a
spectral signature is set 0, then pixels belonging to this signature are labelled as unclassified;
Changes in the ROI & Signature list are applied to the file Training input (page 24) only when the QGIS project is

saved (but there is also the option Autosave). ROIs can be edited, deleted and merged from this list.

3.2. SCP dock 27


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 5: ROI & Signature list example

Tip: According to Algorithm (page 65), classifications performed using C ID have the colors defined for classes
in the ROI & Signature list (page 27); classifications performed using MC ID have the colors defined for the
macroclasses.

If an item is a ROI polygon, double click the item to zoom to that ROI in the map. Items in the list can be highlighted
with the mouse left click.

Tip: ROIs and spectral signatures can be imported from other sources (see Import signatures (page 45)) and
exported (see Export signatures (page 44)).

The following tools are available.

Tool symbol Description


and name

merge highlighted spectral signatures or ROIs obtaining a new signature calculated as the
average of signature values for each band (covariance matrix is excluded)

calculate spectral signatures of highlighted ROIs using the active band set in Band set (page 36)

delete highlighted ROIs and signatures

show the ROI spectral signature in the Spectral Signature Plot (page 103); spectral signature
is calculated from the Band set (page 36)

add highlighted ROIs to the Scatter Plot (page 106)

open the tab Import signatures (page 45)

open the tab Export signatures (page 44) and export highlighted items

ROI & Signature list is complementary to the Working toolbar (page 32) and it allows for saving ROIs to the
Training input (page 24) defining classes and macroclasses. A Band set (page 36) must be defined before the ROI
creation, and ROI polygons must be inside the area of the Band set.

28 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool Description
symbol
and
name
MC ID ROI Macroclass ID

MC ROI Macroclass Name


Name

C ID ROI Class ID

C Name ROI Class Name

undo of ROI creation from the Training input (page 24); it is possible to undo a maximum of 10
actions

redo ROI creation in the Training input (page 24)

if checked, automatically save the ROI & Signature list to the Training input (page 24) every time
Autosave a ROI is saved

Sig- if checked, while saving a ROI, the spectral signature thereof is calculated (from Band set (page 36)
nature pixels under ROI polygon) and saved to Training input (page 24) (calculation time depends on the
band number of the active band set in Band set (page 36))

save the temporary ROI to the Training input (page 24) using the defined classes and macroclasses;
ROI is displayed in the ROI & Signature list (page 27)

Right click menu

A right click on ROI & Signature list (page 27) allows for opening a menu containing several functions to manage
ROIs and spectral signatures.

3.2. SCP dock 29


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 6: Right click menu

30 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool Description
sym-
bol and
name

zoom to highlighted items (if ROI polygons) in the map


Zoom to

check or uncheck highlighted items


Check/uncheck

clear selection of highlighted items


Clear
selection

Col- collapse or expand all macroclasses


lapse/expand
all

edit the macroclass of highlighted items (using the value MC ID displayed in ROI & Signature
Change list (page 27)); if a macroclass is selected, the function is performed to all the included items
MC ID

select a color for the highlighted items; if a macroclass is selected, the function is performed to all
Change the included items
color

merge highlighted spectral signatures or ROIs obtaining a new signature calculated as the average
Merge of signature values for each band (covariance matrix is excluded); if a macroclass is selected, the
items function is performed to all the included items

Cal- calculate spectral signatures of highlighted ROIs using the active band set in Band set (page 36);
culate sig- if a macroclass is selected, the function is performed to all the included items
natures

delete highlighted ROIs and signatures; if a macroclass is selected, the function is performed to
Delete all the included items;
items

Add show the ROI spectral signature in the Spectral Signature Plot (page 103); spectral signature is
to spectral calculated from the Band set (page 36); if a macroclass is selected, the function is performed to
plot all the included items

Add add highlighted ROIs to the Scatter Plot (page 106); if a macroclass is selected, the function is
to scatter performed to all the included items
plot

show the properties of highlighted items;


Properties

open the tab Import signatures (page 45)


Import

open the tab Export signatures (page 44) and export highlighted items
Export

3.2. SCP dock 31


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

3.2.3 ROI options

ROI options are useful for displaying pixel values or improving the creation of ROIs.

Tool Description
sym-
bol
and
name

if the ROI creation pointer is active (see Working toolbar (page 32)), the pixel value of selected veg-
Dis- etation index is displayed on the map; vegetation indices available in the combo box are: * NDVI
play (Normalized Difference Vegetation Index); NDVI requires the near-infrared and red bands; * EVI (En-
hanced Vegetation Index); EVI requires the blue, near-infrared and red bands converted to reflectance;
wavelengths must be defined in the Band set (page 36); * Custom; use the custom expression defined
in the following line
set a custom expression; expression is based on the Band set and bands such as band 1 is referred to
as “b1”, band 2 as “b2” and so on; also reference to band names such as “#NIR#” or “#RED#” can be
used

if checked, temporary ROI is created with region growing using only one Band set (page 36) band
Rapid (i.e.region growing is rapider); the band is defined by the Band set number; if unchecked, ROI is the
ROI result of the intersection between ROIs calculated on every band (i.e. region growing is slower, but
b. ROI is spectrally homogeneous in every band)

calculate automatically the temporary ROI spectral signature and display it in the Spectral Signature
Auto- Plot (page 103) (MC Name of this spectral signature is set tempo_ROI)
plot

calculate automatically a new temporary ROI while Region growing parameters in the Working toolbar
Auto- (page 32) are being changed
refresh
ROI
Maxi- defines the maximum number of action for undo and redo ROIs; the higher is the number, the more is
mum the required memory
train-
ing
buffer

3.3 Working toolbar

The Working toolbar allows for creating temporary ROIs and classification previews.

• Image control (page 34)


• Temporary ROI (page 34)
• Classification preview (page 35)

The functions are described in detail in the following paragraphs.

32 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 7: ROI options

Fig. 8: Working toolbar

3.3. Working toolbar 33


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

3.3.1 Image control

Tool Description
symbol
and
name

show the Main Interface Window (page 36)

zoom the map to the extent of the active band set in Band set (page 36);

use the button to show/hide the active band set in Band set (page 36) in the map; from the list select
RGB= a Color Composite (page 122) that is applied to the Band set (page 36); new color composites can
be entered typing the band numbers separated by - or ; or , (e.g. RGB = 4-3-2 or RGB = 4;3;2 or
RGB = 4,3,2)

display the input image stretching the minimum and maximum values according to cumulative count
of current map extent

display the input image stretching the minimum and maximum values according to standard deviation
of current map extent

3.3.2 Temporary ROI

A temporary ROI is a temporary polygon displayed in the map, which can be saved permanently in the Training
input (page 24). A temporary ROI can be drawn manually or using a Region Growing Algorithm (page 124) (i.e.
the image is segmented around a pixel seed including spectrally homogeneous pixels).

Tool Description
sym-
bol
and
name

zoom the map to the extent of temporary ROI

use the button to show/hide the temporary ROI and the Training input in the map
ROI

activate the pointer to create a temporary ROI by drawing a polygon in the map; left click on the map to
define the ROI vertices and right click to define the last vertex closing the polygon; press the keyboard
button CTRL to add a multipart polygon; press the keyboard buttons CTRL + Z for removing the last
multipart polygon

: activate the pointer to create a temporary ROI using the region growing algorithm; left click on the map
for creating the ROI; right click on the map for displaying the spectral signature of a pixel of the active
band set in the Spectral Signature Plot (page 103); press the keyboard button CTRL and left click to add
a multipart polygon (new parts are not created if overlapping to other parts); press the keyboard buttons
CTRL + Z for removing the last multipart polygon; press the keyboard button CTRL and right click to
plot spectral signatures of the same pixel for all the band sets

create a temporary ROI using the region growing algorithm at the same seed pixel as the previous one;
it is useful after changing the region growing parameters

Region growing parameters: the following parameters are required for the ROI creation using a region growing

34 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

algorithm on the Band set (page 36):

Tool Description
sym-
bol
and
name
Dist set the interval which defines the maximum spectral distance between the seed pixel and the sur-
rounding pixels (in radiometry unit)

Min set the minimum area of a ROI (in pixel unit); this setting overrides the Range radius until the
minimum ROI size is reached; if Rapid ROI on band is checked, then ROI will have at least the
size defined Min ROI size; if Rapid ROI on band is unchecked, then ROI could have a size
smaller than Min ROI size
Max set the maximum width of a ROI (i.e. the side length of a square, centred at the seed pixel, which
inscribes the ROI) in pixel unit

3.3.3 Classification preview

Classification preview allows for displaying temporary classifications (i.e. classification previews). Classification
previews are useful for testing the algorithm in a small area of the Band set (page 36), before classifying the entire
image which can be time consuming.
Classification preview is performed according to the parameters defined in Algorithm (page 65).

Warning: ROIs and previews are performed on the active Band set (page 36).

After the creation of a new preview, old previews are placed in QGIS Layers inside a layer group named
Class_temp_group and are deleted when the QGIS session is closed.

Warning: Classification previews are automatically deleted from disk when the QGIS session is closed; a
QGIS message (that can be ignored) could ask for the path of missing layers when opening a previously saved
project.

3.3. Working toolbar 35


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol Description


and name

zoom the map to the extent of the last Classification preview (page 35)

Preview use the button to show/hide the last Classification preview (page 35) in the map

activate the pointer for the creation of a Classification preview (page 35); left click the map to
start the classification process and display the classification preview

create a new Classification preview (page 35) centred at the same pixel as the previous one
T change dynamically the classification preview transparency, which is useful for comparing the
classification to other layers

S size of the preview in pixel unit (i.e. the side length of a square, centred at the clicked pixel)

create a KML file of the QGIS view

3.4 Main Interface Window

The Main Interface Window is composed of several tabs described in detail in the following paragraphs. Tabs can
be selected through the tree menu at the left side or from the SCP menu (page 21).

3.4.1 Band set

• Band set definition (page 37)


• Band quick settings (page 38)
• Band set table (page 39)
• Band set tools (page 39)

Image input in SCP is named band set. This tab allows for the definition of one or multiple band sets to be used as
input for classification and other tools.
Band sets are identified by numbers. The active band set (i.e. the one selected in Band set definition (page 37)) is
used as input for several tools in SCP dock (page 22) and the Working toolbar (page 32). Other SCP tools allow
for the selection of band set numbers.
The Band set definition is saved with the QGIS project.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Following a video tutorial about this tool.


https://www.youtube.com/watch?v=DQXfBPke2J4

36 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 9: Band set

Band set definition

A band set is basically a list of bands defined as the following table.

Band name Center wave- Multiplica- Additive Wave- Path Date


length tive Factor Factor length
unit
name of the band center of the multiplicative additive wave- relative image ac-
(it cannot be wavelength of rescaling rescaling length path of the quisition
edited) the band factor factor unit raster date

It is possible to add to the active band set one or more bands already loaded in QGIS, or select files that are not
loaded. A Date can be assigned to a band set which can be later used in other tools to select band sets by date.
Also, a Root directory for band paths can be defined, which can be useful to create projects with relative paths.
The following tools are available.

3.4. Main Interface Window 37


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and Description


name

open file explorer and add raster files (preferably single band raster) to the active band
set

open a window to select rasters already loaded in QGIS and add them to the active
band set

move highlighted bands upward

move highlighted bands downward

sort automatically bands by name, giving priority to the ending numbers of name

remove highlighted bands from the active band set

clear all bands from active band set

import a previously saved active band set from file

export the active band set to a file

It is possible to define a multiplicative rescaling factor and additive rescaling factor for each band (for instance
using the values in Landsat metadata), which are used on the fly (i.e. pixel value = original pixel value
* multiplicative rescaling factor + additive rescaling factor) during the processing.
The Center wavelength of bands should be defined in order to use several functions of SCP. If the Center wavelength
of bands is not defined, the band number is used and some SCP tools will be disabled.

Band quick settings

These tools allow for quickly set attributes of the active band set.

Tool symbol and name Description


Wavelength rapid definition of band center wavelength for the
following satellite sensors: * Band order * ASTER
* GeoEye-1 * GOES * Landsat 8 OLI * Landsat
7 ETM+ * Landsat 4-5 TM * Landsat 1, 2, and 3
MSS * MODIS * Pleiades * QuickBird * Rapid-
Eye * Sentinel-2 * Sentinel-3 * SPOT 4, 5, and 6 *
WorldView-2 and WorldView-3

open a csv file of wavelength values (center wave-


length separated by comma or new line)
Wavelength unit
select the wavelength unit among:
• Band number: no unit, only band number
• 𝜇𝑚: micrometres
• nm: nanometres

Date set the date of acquisition

38 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Band set table

The table on the left side is the Band set table. It includes the list of all the defined band sets (the names of the first
bands are displayed), which can be selected with a left click. Double click on a table item can be used to define the
Active band set.
A Filter can be used to display band sets in the table matching a name.
The following tools are available for managing band sets.

Tool symbol and Description


name

add a new empty band set

remove highlighted band sets

sort band sets by date

move highlighted band sets upward

move highlighted band sets downward

display the RGB color composite of selected band sets (a virtual raster is added in
QGIS)

Band set tools

Band set tools are tools that can be executed directly on Active band set. Multiple tools can be selected by the
corresponding check box. This can also be useful to automate the processing during image conversion.

Tool symbol and name Description

Create virtual raster of band set create a multiband virtual raster of Active band set

Create raster of band set (stack bands) stack bands in a single multiband raster

Build band overview build band overview of Active band set

Band calc expression execute the expression defined in Band calc (page 88)

execute selected tools

3.4.2 Download products

• Search (page 40)


– Search parameters (page 40)
– Product list (page 42)
– Download (page 43)
• Login data (page 43)
– Login Harmonized Landsat Sentinel-2 (page 44)

3.4. Main Interface Window 39


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 10: Download products

The tab Download products includes the tools for searching and downloading free remote sensing images.
The search and download is performed through Remotior Sensus. Also, automatic conversion to reflectance of
downloaded bands is available.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

An internet connection is required and free registration could be required depending on the download service.

Search

The Search tool allows for searching and downloading:


• Harmonized Landsat Sentinel-2 by NASA which are surface reflectance data product (generated with Landsat
8, Landsat 9, and Sentinel-2 data acquired from 2013 to present days) with observations every two to three
days at 30m spatial resolution (more information about the project);
• Copernicus Sentinel-2 images (Level-1C and Level-2A) acquired from 2015 to present days;
The download of Harmonized Landsat Sentinel-2 requires credentials defined in Login data (page 43).

Search parameters

Define the search area by entering the coordinates (longitude and latitude) of an Upper Left (UL) point and
Lower Right (LR) point and select a product to search. Optional settings are date of acquisition, maximum cloud
cover, number of results (the fewer the results, the faster is the query).
The definition of a search area is required before searching the images.

40 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol Description


and name

UL set the UL longitude X (Lon) and the UL latitude Y (Lat)

LR set the LR longitude X (Lon) and the LR latitude Y (Lat)

Show show or hide the search area in the map;

define a search area by left click to set the UL point and right click to set the LR point; the
search area is displayed in the map
Products set the search product

Date from set the starting date of acquisition

to set the ending date of acquisition


Max cloud maximum cloud cover in the product
cover (%)

Results maximum number of products returned by the search


Advanced some services (e.g. Sentinel-2) allows for entering search parameters; for instance, it is possible
search to enter the name of a granule (e.g. 33TTG)
Filter set a filter such as the Product ID (e.g. LC81910312015006LGN00); it is possible to enter
multiple Product IDs separated by comma or semicolon (e.g. LC81910312015006LGN00,
LC81910312013224LGN00 ); filter is applied to resulting products in the search area

Find find the products in the search area; results are displayed inside the table in Product list
(page 42); results are added to previous results

Add this button allows for the display of OpenStreetMap tiles ( © OpenStreetMap contributors) in
Open- the QGIS map as described in https://wiki.openstreetmap.org/wiki/QGIS . The cartography is
StreetMap to licensed as CC BY-SA (Tile Usage Policy )
the map

Tip: Search results (and the number thereof) depend on the defined area extent and the range of dates. In order
to get more results, perform multiple searches defining smaller area extent and narrow acquisition dates (from and
to).

3.4. Main Interface Window 41


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Product list

The table Product list contains the results of the search. Click on any item (highlight the item) to display the image
preview thereof (not all the products include image previews). Resulting products are saved with the QGIS project.
The table includes the following fields.

prod- im- prod- ac- cloud_cover


zone_pathrow min_latmin_lonmax_latmax_lon
col- size pre- uid
uct age uct_id qui- lec- view
si- tion
tion_date
the the the the per- the the min- min- max- max- col- prod- URL iden-
prod- im- ID ac- cent- zone or WRS i- i- i- i- lec- uct of ti-
uct age of qui- age WRS row mum mum mum mum tion size the fier
name name the si- of path lati- lon- lati- lon- code prod- of
(e.g., prod- tion cloud de- tude gi- tude gi- uct the
Sentinel- uct date cover pend- of tude of tude pre- item
2) of in the ing the of the of view
the prod- on the prod- the prod- the
prod- uct prod- uct prod- uct prod-
uct uct uct uct
type

The following tools are available.

Tool symbol Description


and name

display preview of highlighted images in the map; preview is roughly georeferenced on the
fly (not all the products include a preview)

remove highlighted images from the list

remove all images from the list

import the product list from an XML file

export the product list to an XML file

42 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Download

Download the products in the Product list (page 42). During the download it is recommended not to interact with
QGIS.
Depending on the download service, it is possible to select single bands for download.

Tool symbol and Description


name

Band X select bands for download

Ancillary data if checked, the metadata files are selected for download

select or deselect all bands

Only if preview in if checked, download only those images listed in Product list (page 42) which are also
Layers listed in the QGIS layer panel

Preprocess im- if checked, bands are automatically converted after the download
ages

Load bands in if checked, bands are loaded in QGIS after the download
QGIS

export the download links to a text file (.csv)

RUN start the download process of all the products listed in Product list (page 42)

Login data

Fig. 11: Login data

3.4. Main Interface Window 43


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Login Harmonized Landsat Sentinel-2

The download of Harmonized Landsat Sentinel-2 requires to login using EOSDIS Earthdata credentials (https:
//urs.earthdata.nasa.gov) One can register for free at https://urs.earthdata.nasa.gov/users/new .

Tool symbol and name Description

User enter the user name

Password enter the password

remember if checked, remember user name and password locally in QGIS

Warning: If remember is checked, the password is stored unencrypted in QGIS registry.

3.4.3 Basic tools

The tab Basic tools includes several tools for manipulating input data.

Export signatures

Fig. 12: Export signatures

This tool allows for exporting the signatures highlighted in the ROI & Signature list (page 27).

44 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and name Description

Export as SCP file create a new .scp file and export highlighted ROIs and spectral signatures as
SCP file (.scpx)
Export as shapefile or export highlighted ROIs (spectral signature data excluded) as a new shapefile
(.shp) or geopackage (.gpkg)
geopackage
Export spectral signatures as open a directory, and export highlighted spectral signatures as individual CSV
files (.csv) separated by semicolon ( ; )
CSV file

Import signatures

• Import library file (page 45)


• Import vector (page 46)
• Download USGS Spectral Library (page 46)

The tab Import signatures allows for importing spectral signatures from various sources.

Import library file

Fig. 13: Import library file

This tool allows for importing spectral signatures from various sources: a previously saved Training input (page 24)
(.scpx file); a USGS Spectral Library (.asc file); a previously exported .csv file. In case of USGS Spectral
Library, the library is automatically sampled according to the image band wavelengths defined in the Band set
(page 36), and added to the ROI & Signature list (page 27);

Tool symbol and name Description

Select a file open a file to be imported in the Training input (page 24)

3.4. Main Interface Window 45


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Import vector

Fig. 14: Import vector

This tool allows for importing a vector (shapefile or geopackage), selecting the corresponding fields of the Training
input (page 24).

Tool symbol and Description


name

Select a vector open a vector


MC ID field select the vector field corresponding to MC ID
MC Name field select the vector field corresponding to MC Name
C ID field select the vector field corresponding to C ID
C Name field select the vector field corresponding to C Name

Calculate sig. if checked, the spectral signature is calculated while the ROI is saved to Training input
(page 24)

Import vector import all the vector polygons as ROIs in the Training input (page 24)

Download USGS Spectral Library

The tab Download USGS Spectral Library allows for the download of the USGS spectral library (Clark, R.N.,
Swayze, G.A., Wise, R., Livo, E., Hoefen, T., Kokaly, R., Sutley, S.J., 2007, USGS digital spectral library splib06a:
U.S. Geological Survey, Digital Data Series 231).
The libraries are grouped in chapters including Minerals, Mixtures, Coatings, Volatiles, Man-Made, Plants, Vege-
tation Communities, Mixtures with Vegetation, and Microorganisms.
An internet connection is required.

46 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 15: Download USGS Spectral Library

Tool Description
symbol
and
name
Select a select one of the library chapters; after the selection, chapter libraries are shown in Select a library
chapter

Select a select one of the libraries; the library description is displayed in the frame Library description
library

Import download the library and add the sampled spectral signature to the ROI & Signature list (page 27)
spectral using the parameters defined for class and macroclass; the library is automatically sampled according
library to the image band wavelengths defined in the active band set in Band set (page 36), and added to
the ROI & Signature list (page 27)

Tip: Spectral libraries downloaded from the USGS Spectral Library can be used with Minimum Distance or
Spectral Angle Mapping algorithms, but not Maximum Likelihood because this algorithm needs the covariance
matrix that is not included in the spectral libraries.

Multiple ROI Creation

• Create random points (page 48)


• Point coordinates and ROI definition (page 49)

This tab allows for the automatic creation of ROIs, useful for the rapid classification of multi-temporal images, or
for accuracy assessment. Given a list of point coordinates and ROI options, this tool performs the region growing
of ROIs. Created ROIs are automatically saved to the Training input (page 24). The active band set in Band set
(page 36) is used for calculations.

3.4. Main Interface Window 47


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 16: Multiple ROI Creation

Create random points

Tool Description
symbol
and
name

Number set a number of points that will be created when Create points is clicked
of points

in- if checked, the band set area is divided in cells where the size thereof is defined in the combobox
side grid (image unit, usually meters); points defined in Number of random points are created randomly
within each cell

min if checked, random points have a minimum distance defined in the combobox (image unit, usually
distance meters); setting a minimum distance can result in fewer points than the number defined in Number
of points
Create create random points inside the band set area
points

if checked, create random points inside the values defined in the expression calculated for the
stratified first band of the defined band set; the expression must include the variable raster ; multiple
for the expressions can be entered separated by semicolon ( ; ) but the total number of stratified points is
values the same as the defined Number of points

of the first defines the band set in stratified for the values
band of
band set

48 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Point coordinates and ROI definition

The table Point coordinates and ROI definition contains the following fields.

X Y MC MC C C Min Max Dist Rapid ROI band


ID Name ID Name
point point ROI ROI ROI ROI the the the interval which de- if a band number is
X Y Macro-Macro- Class Class mini- maxi- fines the maximum defined, ROI is cre-
co- co- class class ID Name mum mum spectral distance be- ated only using the se-
or- or- ID Name (int) (text) area of width tween the seed pixel lected band, similarly
di- di- (int) (text) a ROI of a and the surrounding to Rapid ROI band in
nate nate (in ROI pixels (in radiometry ROI & Signature list
(float) (float) pixel (in unit) (page 27)
unit) pixel
unit)

The following tools are available.

Tool Description
symbol
and
name

add a new row to the table; all the table fields must be filled for the ROI creation

delete the highlighted rows from the table

import a point list from text file or a point shapefile to the table; in case of text file, every line must
contain values separated by tabs of X, Y, MC ID, MC Name, Class ID, C Name, Min, Max, Dist, and
optionally the Rapid ROI band; in case of shapefile, only point coordinates are imported

export the point list to text file

if checked, the spectral signature is calculated while the ROI is saved to Training input (page 24)
Calcu-
late sig.
RUN start the ROI creation process for all the points and save ROIs to the Training input (page 24)

RGB composite

• RGB composite (page 50)


• Automatic RGB (page 50)

This tab allows for managing the RGB Color Composite (page 122) used in the list RGB= of the Image control
(page 34).

3.4. Main Interface Window 49


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 17: RGB composite

RGB composite

The table RGB composite contains the field RGB that allows for entering an RGB combination.

Tool symbol and name Description

move highlighted RGB combination upward

move highlighted RGB combination downward

automatically sort RGB combinations by name

add a row to the table

remove highlighted rows from the table

clear all RGB combinations from RGB list

export the RGB list to a file (i.e. .csv)

import a previously saved RGB list from file (i.e. .csv)

Automatic RGB

Tool symbol and Description


name
Band combinations add the combinations of all bands (i.e. permutation) to the RGB composite (page 50) (e.g.
1-2-3, 1-2-4, . . . , 3-2-1)

50 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Signature threshold

• Signature threshold (page 51)


• Automatic thresholds (page 52)

Fig. 18: Signature threshold

This tab allows for the definition of a classification threshold (only for Minimum Distance, Maximum Likelihood,
and Spectral Angle Mapping algorithms) for each spectral signature. All the signatures contained in the Training
input (page 24) are listed. Thresholds defined in this tool are applied to classification only if Threshold value in
Algorithm (page 65) is 0.
This is useful for improving the classification results, especially when spectral signatures are similar. Thresholds
of signatures are saved in the Training input (page 24).
If threshold is 0 then no threshold is applied and all the image pixels are classified. Depending on the selected
Algorithm (page 65) the threshold value is evaluated differently:
• for Minimum Distance, pixels are unclassified if distance is greater than threshold value;
• for Maximum Likelihood, pixels are unclassified if probability is less than threshold value (max 100);
• for Spectral Angle Mapping, pixels are unclassified if spectral angle distance is greater than threshold value
(max 90).

Signature threshold

The table Signature threshold contains the following fields.

MC ID MC C ID C MD Threshold ML Threshold SAM Threshold


Name Name
signa- signature signa- signa- Minimum Dis- Maximum Likeli- Spectral Angle Map-
ture Macro- ture ture tance threshold; hood threshold; this ping threshold; this
Macro- class Class Class this value can be value can be edited value can be edited
class ID Name ID Name edited

• : reset all signatures thresholds to 0 (i.e. no threshold used);

3.4. Main Interface Window 51


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Automatic thresholds

Tool Description
symbol
and
name
Set set the defined value as threshold for all the highlighted signatures in the table
threshold

Set for all the highlighted signatures, set an automatic threshold calculated as the distance (or angle)
threshold between mean signature and (mean signature + ( * v)), where is the standard deviation and v is
= * the defined value; currently works for Minimum Distance and Spectral Angle Mapping

3.4.4 Preprocessing

The tab Preprocessing provides several tools for data manipulation which are useful before the actual classi-
fication process.

Clip raster bands

• Clip band set (page 53)


• Clip coordinates (page 53)

Fig. 19: Clip multiple rasters

This tab allows for cutting several image bands at once, using a rectangle defined with point coordinates or a
boundary defined with a vector.

52 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Clip band set

Tool symbol and name Description

Select input band set select the input Band set (page 36) to be clipped

Use value as NoData if checked, set the value for NoData pixels (e.g. pixels outside the clipped
area)
Output name prefix set the prefix for output file names (default is clip)

Clip coordinates

Set the Upper Left (UL) and Lower Right (LR) point coordinates of the rectangle used for clipping; it is possible
to enter the coordinates manually. Alternatively use a vector.

Tool symbol and Description


name

Use coordinates if checked, use defined coordinates for clipping bands


for clipping
UL X set the UL X coordinate
UL Y set the UL Y coordinate
LR X set the LR X coordinate
LR Y set the LR Y coordinate

Show show or hide the clip area drawn in the map

define a clip area by drawing a rectangle in the map; left click to set the UL point and
right click to set the LR point; the area is displayed in the map

Use vector for if checked, use the selected vector (already loaded in QGIS) for clipping; UL and LR
clipping coordinates are ignored

Use vector field for if checked, a vector field is selected for clipping while iterating through each vector
output name polygon and the corresponding field value is added to the output name

Use temporary if checked, use a Temporary ROI (page 34) for clipping; UL and LR coordinates are
ROI for clipping ignored

refresh layer list

Script add this function to the Script (page 96)

RUN run this function

3.4. Main Interface Window 53


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Image conversion

• Image conversion (page 54)


• Metadata (page 55)

Fig. 20: Image conversion

This tool allows for the conversion of several products to reflectance. Depending on the processing level of the
source product, the conversion can be to the physical measure of Top Of Atmosphere reflectance (TOA), or the
application of a simple atmospheric correction using the DOS1 method (Dark Object Subtraction 1), which is an
image-based technique (for more information about conversion to TOA and DOS1 correction, see Image conversion
to reflectance (page 138)). In case the source product is already provided as surface reflectance level, the rescaling
factors are applied to convert the DN to decimal values.
The following products can be processed:
• Sentinel-2 images Level-1C;
• Sentinel-2 images Level-2A;
• Landsat 1, 2, 3 MSS, 4, 5, 7, 8, 9 images Collection 2 Level-2;
• Harmonized Landsat Sentinel-2.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Image conversion

Once the input is selected, available bands are listed in the metadata table.

54 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and Description


name
Directory contain- open a directory containing product bands; names of bands must end with the correspond-
ing number; if the metadata file is included in this directory then Metadata (page 55) is
ing bands automatically filled
Select metadata file select the metadata file if not included in the Directory containing bands; for Sentinel-2,
the metadata file is a .xml file whose name contains MTD_MSIL1C.

Use value as if checked, pixels having NoData value are not counted during conversion and the DOS1
NoData calculation of DNmin; it is useful when image has a black border (usually pixel value =
0)

Apply DOS1 if checked, the DOS1 Correction (page 139) is applied to all the bands
atmospheric cor-
rection

Create Band if checked, bands are added to the active Band set after the conversion; also, the Band
set and use Band set set is processed according to the tools checked in the Band set (page 36)
tools

Add bands in a if checked, bands are added to a new empty Band set after the conversion
new Band set

Tip: For the best spectral precision one should download Surface Reflectance products (e.g., for Sentinel-2 the
Level-2A Products).

Warning: For Sentinel-2 L2A images downloaded as .zip file, all the .jp2 files must be moved inside the
same directory and renamed according to the band number in the ending (e.g. from name_02_10m.jp2 to
name_02.jp2).

Metadata

Metadata are required for the process to identify the product. If the Metadata file is not inside the input directory,
one can define the file path in Select metadata file. In the Metadata, all the bands found in are listed.
The table Metadata contains the following fields.

prod- space- pro- band_name


prod- scale off- no- date k1 k2 band_number
e_sun earth_sun_distance
uct craft cess- uct_path set data
ing_level
prod- space- pro- name path scale off- no- date k1 pa- k2 pa- band so- Earth-
uct craft cessing of of of set data of ac- rameter rameter num- lar Sun
name name level the the the of value quisi- for for ber ir- dis-
(e.g., (e.g., of the band band band the of tion Land- Land- ra- tance
Sentinel-Sentinel-product band the of the sat sat di-
2) 2) (e.g., band prod- thermal thermal ance
Level- uct conver- conver- of
2) sion sion band

It is possible to remove bands from the table, to exclude these bands from the conversion.

3.4. Main Interface Window 55


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and name Description

remove highlighted bands from the table Metadata

Bands having different spatial resolution are not resampled at this stage. However, when using these bands in a
classification process, all the bands are resampled on the fly to the highest spatial resolution with nearest neighbor.

Tool symbol and name Description

Script add this function to the Script (page 96)

RUN run this function

Tip: To reduce file size, output files are saved as data type UInt16 with scale 0.0001, which are interpreted as
Float32 type by GDAL.

Masking bands

• Mask of band set (page 57)

Fig. 21: Masking bands

This tool allows for masking bands, based on the values of a raster mask, creating an output masked band for each
band of the Band set (page 36). NoData is set in all the bands of the Band set (page 36) for pixels corresponding
to the mask.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

56 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Mask of band set

Tool symbol Description


and name
Select input select the input Band set (page 36) to be masked
band set
Select the select a classification raster (already loaded in QGIS) which contains a mask class
classification

refresh layer list


Mask class set the class values to be masked; class values must be separated by , and - can be used to
values define a range of values (e.g. 1, 3-5, 8 will select classes 1, 3, 4, 5, 8); if the text is red then
the expression contains errors

Use if checked, a buffer is created for masked area, corresponding to the defined number of pixels;
buffer of pixel this can be useful to dilate masked area
size
Output No- set the value of NoData pixels corresponding to the mask
Data value

Output name set the prefix for output file names (default is mask_)
prefix

Script add this function to the Script (page 96)

RUN run this function

Mosaic of band sets

• Mosaic of band sets (page 58)

Fig. 22: Mosaic band sets

3.4. Main Interface Window 57


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

This tool allows for the mosaic of band sets, merging the corresponding bands of two or more band sets defined in
the Band set (page 36). An output band is created for every corresponding set of bands in the band sets. NoData
values of one band set are replaced by the values of the other band sets.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Mosaic of band sets

Tool symbol and Description


name

Band set list list if band sets defined in the Band set (page 36); in case of overlapping images, the pixel
values of the first band set in the list are assigned

Use value as if checked, set the value of NoData pixels, ignored during the calculation
NoData

Create vir- if checked, output is created as virtual raster .vrt composed of as many .tif files as the
tual raster output number of threads defined in System (page 100); for large rasters this can speed up the
process

Output name pre- set the prefix for output file names (default is mosaic)
fix

Script add this function to the Script (page 96)

RUN run this function

Reproject raster bands

• Reproject raster bands (page 59)

Fig. 23: Reproject raster bands

58 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

This tab allows for reprojecting bands in a Band set (page 36) and perform other raster operations.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Reproject raster bands

Tool symbol and Description


name
Select input band set select the input Band set (page 36) to be reprojected

Align to raster if checked, use the same coordinate reference system and pixel size as the selected
reference

same extent as if checked, the output extent will be the same as the reference

reference

refresh layer list

Use EPSG code if checked, use the EPSG code for defining the output coordinate reference system

X resolution set X pixel resolution

Y resolution set Y pixel resolution

Resample pixel if checked, new pixel size will be the original size times this factor

factor
Resampling method select the resampling method; options are: nearest_neighbour, average, sum,
maximum, minimum, mode, median, first_quartile, third_quartile
Output type select the output raster type; options are: Auto (same as input), Float32, Int32,
UInt32, Int16, UInt16, Byte

Change output if checked, set a new value for NoData pixels


NoData value
Output name prefix set the prefix for output file names (default is reproj)

Compress if checked, set the compression method (e.g., LZW, DEFLATE)

Script add this function to the Script (page 96)

RUN run this function

3.4. Main Interface Window 59


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Split raster bands

• Raster list (page 60)

Fig. 24: Split raster bands

Split a multiband raster to single bands.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Raster list

Tool symbol and name Description


Select a multiband raster select the input raster

refresh layer list


Output name prefix set the prefix for output file names (default is split)

Script add this function to the Script (page 96)

RUN run this function

60 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Stack raster bands

• Stack band set (page 61)

Fig. 25: Stack raster bands

Stack all the bands in a Band set (page 36) into a multiband raster.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Stack band set

Tool symbol and name Description

Select input band set select the input Band set (page 36) to be stacked

Script add this function to the Script (page 96)

RUN run this function

Vector to raster

This tab allows for the conversion of a vector (polygon) to raster format.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

3.4. Main Interface Window 61


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 26: Vector to raster

62 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Convert vector to raster

Tool symbol and name Description


Select the vector select a vector already loaded in QGIS

refresh layer list

Use the value field of the vector if checked, the selected field is used as attribute for the
conversion; pixels of the output raster have the same
values as the vector attribute

Use constant value if checked, the polygons are converted to raster using
the selected constant value
Select the reference raster select a reference raster; pixels of the output raster have
the same size and alignment as the reference raster

refresh layer list


Pixel size set the size of pixel of output raster

Minimum extent if checked, the output raster has the minimum vector
extent; otherwise, output extent is the same as the Se-
lect the reference raster
Select the type of conversion
select the type of conversion among:
• pixel_center: during the conversion, vec-
tor is compared to the reference raster; out-
put raster pixels are attributed to a polygon
if pixel center is within that polygon
• all_touched: during the conversion, vector
is compared to the reference raster; output
raster pixels are attributed to a polygon if
pixel touches that polygon
• area_based: during the conversion, out-
put raster pixels are attributed based on
area proportion of polygons

Area precision for area_based method, the higher the value, the
higher is the precision in the calculation of area pro-
portion (and the time required for calculation)

Use value as NoData if checked, set a value for NoData pixels

Script add this function to the Script (page 96)

RUN run this function

3.4. Main Interface Window 63


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

3.4.5 Band processing

The tab Band processing provides several functions that can be applied to the Band set (page 36).

Classification

• Input (page 65)


• Algorithm (page 65)
– Maximum Likelihood (page 65)
– Minimum Distance (page 67)
– Multi-layer Perceptron (page 68)
– Random Forest (page 69)
– Spectral Angle Mapping (page 71)
– Support Vector Machine (page 72)
• Run (page 73)

Fig. 27: Classification

This tab allows for the classification of the Band set (page 36) using the spectral signatures checked in ROI &
Signature list (page 27). Several classification options are set in this tab which affect the classification process also
during the Classification preview (page 35).
This tool allows for the selection of one the following algorithms:
• Maximum Likelihood (page 65)
• Minimum Distance (page 67)

64 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• Multi-layer Perceptron (page 68)


• Random Forest (page 69)
• Spectral Angle Mapping (page 71)
• Support Vector Machine (page 72)
Also, it is possible to save and load a trained classifier.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Input

Tool symbol and name Description

Select input band set select the input Band set (page 36) to be classified

Use input normalization if checked, normalize the input based on the selected method

Z-score if checked with Use input normalized, Z-score normal-


ization of input is performed

Linear scaling if checked with Use input normalized, Linear scaling


normalization of input is performed

Use training Macroclass ID if checked, the classification is performed using

Use training Class ID the Macroclass ID if checked, the classification is performed using the Class
(code MC ID of the signature) ID (code C ID of the signature)

Algorithm

This tool allows for the selection of the classification algorithm. The algorithm tab includes the available parame-
ters.

Maximum Likelihood

Use the Maximum Likelihood (page 126) algorithm.

3.4. Main Interface Window 65


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 28: Maximum Likelihood

Tool symbol and Description


name
Use single threshold if checked, it allows for the definition of a classification threshold (applied to all the
spectral signatures); pixels are unclassified if probability is less than threshold value
(max 100)
Signature threshold if checked, thresholds Signature threshold (page 51) are evaluated

open the Signature threshold (page 51) for the definition of signature thresholds

Save signature if checked, in addition to the classification raster, for each spectral signature a raster
is saved in the same output directory, which represents the distance between pixel
raster and signature

Calculate classifi- if checked, calculate classification confidence raster


cation confidence raster

66 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Minimum Distance

Fig. 29: Minimum Distance

Use the Minimum Distance (page 126) algorithm.

Tool symbol and Description


name
Use single threshold if checked, it allows for the definition of a classification threshold (applied to all the
spectral signatures); pixels are unclassified if distance is greater than threshold value

Signature threshold if checked, thresholds Signature threshold (page 51) are evaluated

open the Signature threshold (page 51) for the definition of signature thresholds

Save signature if checked, in addition to the classification raster, for each spectral signature a raster
is saved in the same output directory, which represents the distance between pixel
raster and signature

Calculate classifi- if checked, calculate classification confidence raster


cation confidence raster

3.4. Main Interface Window 67


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Multi-layer Perceptron

Fig. 30: Multi-layer Perceptron

Use the Multi-Layer Perceptron (page 131) algorithm.

68 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and name Description

Use framework if checked, use scikit-learn framework (read this)


scikit-learn

Use framework Py- if checked, use PyTorch framework (read about this)
Torch
Hidden layer sizes list of values separated by comma, where each value defines the number of neurons
in a hidden layer (e.g.: 200, 100 for two hidden layers of 200 and 100 neurons
respectively)
Max iter set the maximum number of iterations
Activation set the activation function (default: relu)
Alpha set the weight decay (also L2 regularization term) for Adam optimizer
Training proportion set the proportion of data to be used as training and the remaining part as test

Batch size set the number of samples per batch for optimizer; if auto, the batch is the minimum
value between 200 and the number of samples
Learning rate init set initial learning rate

Cross validation if checked, perform cross validation

Find best estimator if checked, find the best estimator iteratively with a number of steps

with steps

Calculate classifi- if checked, calculate classification confidence raster


cation confidence raster

Random Forest

Use the Random Forest (page 131) algorithm.

3.4. Main Interface Window 69


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 31: Random Forest

Tool symbol and Description


name

Number of trees set the number of trees


Minimum number to set the minimum number of samples required to split an internal node
split

Max features for node splitting, if empty all features are considered; if sqrt the square root of all
the features, if integer number the number of features; if float number a fraction of
all the features

One-Vs-Rest if checked, perform One-Vs-Rest classification (read more)

Cross validation if checked, perform cross validation

Balanced class if checked, balanced weight is computed inversely proportional to class frequency

weight

Find best estimator if checked, find the best estimator iteratively with a number of steps

with steps

Calculate classifi- if checked, calculate classification confidence raster


cation confidence raster

70 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Spectral Angle Mapping

Fig. 32: Spectral Angle Mapping

Use the Spectral Angle Mapping (page 127) algorithm.

Tool symbol and Description


name
Use single threshold if checked, it allows for the definition of a classification threshold (applied to all the
spectral signatures); pixels are unclassified if spectral angle distance is greater than
threshold value (max 90)
Signature threshold if checked, thresholds Signature threshold (page 51) are evaluated

open the Signature threshold (page 51) for the definition of signature thresholds

Save signature if checked, in addition to the classification raster, for each spectral signature a raster
is saved in the same output directory, which represents the distance between pixel and
raster signature

Calculate clas- if checked, calculate classification confidence raster


sification confidence

raster

3.4. Main Interface Window 71


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Support Vector Machine

Fig. 33: Support Vector Machine

Use the Support Vector Machine (page 131) algorithm.

Tool symbol and name Description

Regularization parameter C set the regularization parameter C


Kernel set the kernel (default: rbf)
Gamma set the kernel coefficient gamma (default: scale)

Cross validation if checked, perform cross validation

Balanced class weight if checked, balanced weight is computed inversely proportional to


class frequency

Find best estimator with steps if checked, find the best estimator iteratively with a number of steps

Calculate classification confidence if checked, calculate classification confidence raster

raster

72 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Run

It is possible to run the classification, or save and load a trained classifier.


Classification raster is a file .tif (a QGIS style file .qml is saved along with the classification); also other outputs
can be optionally calculated. Outputs are loaded in QGIS after the calculation.

Tool symbol and name Description

Load classifier open an already save classifier file (.rsmo)

Save classifier save the classifier to file (.rsmo), in order to be loaded later

RUN run this function

Combination

• Combination of band values (page 74)

Fig. 34: Combination

This tab allows for the combination of bands loaded in a Band set (page 36). This tool is intended for combining
classifications in order to get a raster where each value corresponds to a combination of class values. Raster values
must be integer type. A combination raster is produced as output and the area of each combination is reported in
a .csv file.
This tool supports virtual raster output; if the output file name ends with .vrt then the output is created
as virtual raster composed of as many .tif files as the number of CPU threads defined in System (page 100); for
large rasters this can speed up the process.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

3.4. Main Interface Window 73


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Combination of band values

Tool symbol and name Description


Select input band set (of classifications) select the input Band set (page 36)

Use value as NoData if checked, set the value of NoData pixels, ignored during the cal-
culation

Script add this function to the Script (page 96)

RUN run this function

The list of combinations and the area thereof will be displayed in the tab Output.

Dilation

• Dilation (page 75)

Fig. 35: Dilation

This tab allows for dilating the border of a class patch, defining the class values to be dilated and the number of
pixels from the border. It is useful for classification refinement.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

74 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Dilation

Tool symbol and Description


name
Select input band select the input Band set (page 36)
set (of classifica-
tions)
Class values set the class values to be dilated; class values must be separated by , and - can be used
to define a range of values (e.g. 1, 3-5, 8 will select classes 1, 3, 4, 5, 8); if the text is
red then the expression contains errors
Size in pixels number of pixels to be dilated from the border

Circular if checked, the dilation will be circular, similar to a buffer

Output name set the name prefix for output files

Virtual out- if checked, the output is created as virtual raster composed of as many .tif files as the
number of CPU threads defined in System (page 100)
put

Script add this function to the Script (page 96)

RUN run this function

Erosion

• Erosion (page 76)

Fig. 36: Erosion

This tab allows for removing the border of a class patch (erosion), defining the class values to be eroded and the

3.4. Main Interface Window 75


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

number of pixels from the border. It is useful for classification refinement.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Erosion

Tool symbol and Description


name
Select input band select the input Band set (page 36)
set (of classifica-
tions)
Class values set the class values to be dilated; class values must be separated by , and - can be used
to define a range of values (e.g. 1, 3-5, 8 will select classes 1, 3, 4, 5, 8); if the text is
red then the expression contains errors
Size in pixels number of pixels to be dilated from the border

Circular if checked, the erosion will be circular, similar to a buffer

Output name set the name prefix for output files

Virtual out- if checked, the output is created as virtual raster composed of as many .tif files as the
number of CPU threads defined in System (page 100)
put

Script add this function to the Script (page 96)

RUN run this function

Sieve

• Sieve (page 77)

This tab allows for the replacement of isolated pixel values with the value of the largest neighbour patch. It is useful
for removing small patches from a classification.
It is possible to chose 4 pixel connection (in a 3x3 window, diagonal pixels are not considered connected) or
8 pixel connection (in a 3x3 window, diagonal pixels are considered connected).

Tip: Information about APIs of this tool in Remotior Sensus at this link .

76 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 37: Sieve

Sieve

Tool symbol and name Description


Select input band set (of select the input Band set (page 36)
classifications)
Size threshold size of threshold in number of pixels

Pixel connection select between 4 pixel connection or 8 pixel connection

Output name set the name prefix for output files

Virtual output if checked, the output is created as virtual raster composed of as many .tif files
as the number of CPU threads defined in System (page 100)

Script add this function to the Script (page 96)

RUN run this function

Neighbor

• Neighbor (page 79)


• Statistic (page 79)
• Run (page 79)

This tool allows for the calculation of several neighbor pixels statistics for every band of a band set defined in the
Band set (page 36).
The statistics are calculated for every pixel of the input raster considering the values of the neighbor pixels. Neigh-
bor pixels are defined through a distance or through a custom matrix.

3.4. Main Interface Window 77


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 38: Neighbor

For example, the following matrix represents the neighbor pixels within a distance of 1 pixel from a central pixel,
resulting in a 3x3 matrix.

Neighbor Neighbor Neighbor


Neighbor Center Neighbor
Neighbor Neighbor Neighbor

Several statistics are available. The statistic Sum will result in a raster convolution. For instance, this can be useful
to apply an image filter to all the bands of a band set for photointerpretation.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

78 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Neighbor

Tool symbol and Description


name
Select input band set select the input Band set (page 36)

Neighbor distance create a window defining the size based on the distance from the center (in number of
in pixels pixels)

Circular if checked, the window will be circular


Matrix file (op- select a .csv file containing the structure of the window

tional)
Output name set the name prefix for output files

Virtual output if checked, the output is created as virtual raster composed of as many .tif files as the
number of CPU threads defined in System (page 100)

Statistic

Tool symbol Description


and name
Select a statis- select a statistic among: Count, Max, Mean, Median, Min, Percentile, StandardDeviation,
tic Sum. For Percentile statistic it is possible to enter the percentile value.

Run

• – Script
– add this function to the Script (page 96)

• – RUN
– run this function

PCA

• PCA (page 80)

This tab allows for the PCA (Principal Component Analysis (page 134)) of bands loaded in the Band set.
A report .txt is saved along with the PCA bands, containing the covariance matrix, correlation matrix, eigen vectors,
and eigen values.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

3.4. Main Interface Window 79


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 39: PCA

PCA

Tool symbol and name Description

Select input band set select the input Band set (page 36)

Number of components set the number of components to be calculated

Use value as NoData if checked, set the value of NoData pixels, ignored during the calcula-
tion

Script add this function to the Script (page 96)

RUN run this function

The Output tab will display the Principal Components Analysis details (Covariance matrix, Correlation matrix,
Eigenvectors, and Eigenvalues).

80 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

3.4.6 Postprocessing

The tab Postprocessing provides several functions that can be applied to the classification output.

Accuracy

• Accuracy (page 82)

Fig. 40: Accuracy

This tab allows for the validation of a classification (read Accuracy Assessment (page 133) ).
Classification is compared to a reference raster or reference vector (which is automatically converted to raster). If
a vector is selected as reference, it is possible to choose a field describing class values.
Several statistics are calculated such as overall accuracy, user’s accuracy, producer’s accuracy, and Kappa hat. In
particular, these statistics are calculated according to the area based error matrix where each element represents
the estimated area proportion of each class. This allows for estimating the unbiased user’s accuracy and producer’s
accuracy, the unbiased area of classes according to reference data, and the standard error of area estimates.
The output is an error raster that is a .tif file showing the errors in the map, where pixel values represent
the categories of comparison (i.e. combinations identified by the ErrorMatrixCode in the error matrix) between
the classification and reference. Also, a text file containing the error matrix (i.e. a .csv file separated by tab) is
created with the same name defined for the .tif file.
This tool supports virtual raster output; if the output file name ends with .vrt then the output is created
as virtual raster composed of as many .tif files as the number of CPU threads defined in System (page 100); for
large rasters this can speed up the process.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

3.4. Main Interface Window 81


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Accuracy

Tool symbol and name Description


Select the classification to select a classification raster (already loaded in QGIS)
assess

refresh layer list


Select the reference vector select a raster or a vector (already loaded in QGIS), used as reference layer
or raster (ground truth) for the accuracy assessment

refresh layer list

Vector field if a vector is selected as reference, select a vector field containing numeric class
values

Use value as NoData if checked, set the value of NoData pixels, ignored during the calculation

Script add this function to the Script (page 96)

RUN run this function

Classification report

• Classification report (page 83)

Fig. 41: Classification report

This tab allows for the calculation of class statistics such as number of pixels, percentage and area (area unit is
defined from the image itself).

82 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Classification report

Tool symbol and name Description


Select the classification select a classification raster (already loaded in QGIS)

refresh layer list

Use value as NoData if checked, set the value of NoData pixels, ignored during the calcula-
tion

Script add this function to the Script (page 96)

RUN run this function

The tab Output will display the report.

Classification to vector

• Classification to vector (page 84)


• Symbology (page 84)
• Run (page 84)

Fig. 42: Classification to vector

This tab allows for the conversion of a classification raster to vector GeoPackage (.gpkg) . Parallel processes are
used for the conversion, resulting in a vector output which is split in as many portions as the process numbers.

3.4. Main Interface Window 83


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

The argument dissolve allows for merging these portions, but it requires additional processing time depending on
vector size.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Classification to vector

Tool symbol and name Description


Select the classification select a classification raster (already loaded in QGIS)

refresh layer list

Symbology

Tool symbol and name Description


if checked, color and class information are defined
from ROI & Signature list (page 27) * MC ID: use the
• Use code from Signature list ID of macroclasses * C ID: use the ID of classes

if checked, dissolve adjacent polygons having the same


values
• Dissolve output

Run

• – Script
– add this function to the Script (page 96)

• – RUN
– run this function

Cross classification

• Cross classification (page 85)

This tab allows for the calculation of a cross classification raster and matrix. Classification is compared to a
reference raster or reference vector (which is automatically converted to raster). This is useful for calculating the
area for every combination between reference classes and classification values. If a vector is selected as reference,
it is possible to choose a field describing class values.
The output is a cross raster that is a .tif file where pixel values represent the categories of comparison
(i.e. combinations identified by the CrossMatrixCode) between the classification and reference. Also, a text file
containing the cross matrix (i.e. a .csv file) is created with the same name defined for the .tif file.

84 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 43: Cross classification

This tool supports virtual raster output; if the output file name ends with .vrt then the output is created
as virtual raster composed of as many .tif files as the number of CPU threads defined in System (page 100); for
large rasters this can speed up the process.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Cross classification

Tool symbol and name Description


Select the classification select a classification raster (already loaded in QGIS)

refresh layer list

Use value as NoData if checked, set the value of NoData pixels, ignored during the calculation

Select the reference vector or raster select a raster or a vector (already loaded in QGIS), used as reference layer

refresh layer list

Vector field if a vector is selected as reference, select a vector field containing numeric
class values

Calculate linear regression if checked, calculate linear regression between the two input layers

Script add this function to the Script (page 96)

RUN run this function

3.4. Main Interface Window 85


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Reclassification

• Cross classification (page 86)


• Values (page 87)
• Symbology (page 87)
• Run (page 88)

Fig. 44: Reclassification

This tab allows for the reclassification (i.e. assigning a new class code to raster pixels). In particular, it eases the
conversion from C ID to MC ID values.
This tool supports virtual raster output; if the output file name ends with .vrt then the output is created
as virtual raster composed of as many .tif files as the number of CPU threads defined in System (page 100); for
large rasters this can speed up the process.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Cross classification

Tool symbol and name Description


Select the classification select a classification raster (already loaded in QGIS)

refresh layer list

86 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Values

Tool symbol Description


and name

calcu- if checked, the reclassification table is filled according to the ROI & Signature list (page 27)
late C ID
to MC ID when Calculate unique values is clicked
values
Calculate calculate unique values in the classification and fill the reclassification table
unique val-

ues
Incremental calculate a new incremental value (e.g. 1, 2, 3, . . . ) for every old value and fill the reclassifica-
new values tion table

add a row to the table

remove highlighted rows from the table

import rules from a text file .csv separated by comma having the following structure
Old_value,New_value (where Old_value cam be also an expression and New_value is an
integer value) for instance:: raster < 1,1 (raster > 1) & (raster < 3),2 raster < 3,3

export the reclassification table to a text file (.csv) that can be imported later

The reclassification table is structured with the following fields.

Old value New value


value or expression defining old values to be reclassified integer value for the corresponding Old value

Old value can be a value or an expressions defined using the variable name raster (custom names can be defined
in Variable name for expressions (page 99) ), following Python operators (e.g.:
• raster > 3 select all pixels having value > 3 ;
• (raster > 5) | (raster < 2) select all pixels having value > 5 or < 2 ;
• (raster >= 2) & (raster <= 5) select all pixel values between 2 and 5.

Symbology

Tool symbol and name Description

Use code from Signature list


if checked, color and class information are defined
from ROI & Signature list (page 27):
• MC ID: use the ID of macroclasses
• C ID: use the ID of classes

3.4. Main Interface Window 87


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Run

Tool symbol and name Description

Script add this function to the Script (page 96)

RUN run this function

3.4.7 Band calc

• Band list (page 89)


• Expression (page 89)
• Output raster (page 90)
• Input variables (page 91)
• Output variables (page 92)
• Functions (page 93)
– Conditional (page 93)
– Logical (page 94)
– Statistics (page 94)
– Operations (page 94)
– Indices (page 95)
– Variables (page 95)

Fig. 45: Band calc

88 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

The Band calc allows for the raster calculation for bands (i.e. calculation of pixel values) using NumPy func-
tions. Band calc can also work with multiple expression lines to perform multiple calculation at a time; several
iteration functions are available for Band sets allowing for performing multi-temporal calculations.
This tool supports virtual raster output; if the output file name ends with .vrt then the output is created
as virtual raster composed of as many .tif files as the number of CPU threads defined in System (page 100); for
large rasters this can speed up the process.
Raster bands must be already loaded in QGIS. Input rasters can also be in different projection, but the output will
have the projection of the reference raster.

Tip: Information about APIs of this tool in Remotior Sensus at this link .

Band list

Tool symbol and Description


name

Band list table containing a list of single band rasters (already loaded in QGIS) and Input variables
(page 91) defined from Band set
Filter filter the variable list

refresh band list

Expression

Enter a mathematical expression for raster bands. In particular, NumPy functions can be used with the prefix np.
(e.g. np.log10(raster1) ). For a list of NumPy functions see the NumPy page .
The expression can work with Variable between ". Double click on any item in the Band list (page 89) for adding
the name thereof to the expression.
If text color in the Expression is green, then the syntax is correct; if text color is red, then the syntax is incorrect
and it is not possible to execute the calculation.
It is possible to enter multiple expressions separated by newlines such as the following example:

"raster1" + "raster2"
"raster3" - "raster4"

The above example calculates two new rasters in the output directory with the suffix _1 (e.g. calc_raster_1 )
for the first expression and _2 (e.g. calc_raster_2 ) for the second expression. Also, it is possible to define the
output name using the symbol @ followed by the name, such as the following example:

"raster1" + "raster2" @calc_1


"raster3" - "raster4" @calc_2

Input variables (page 91) and Output variables (page 92) can be used in the expression.

3.4. Main Interface Window 89


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and Description


name

Input NoData if checked, input NoData pixels are replaced by NoData value and accounted in calculation

as value

Use value as if checked, selected value is used as NoData during calculation

NoData
Calculation data select the data type used during calculation as Float32 (default), Int32, Int16, UInt32,
type UInt16, Byte; for instance, if Int32 is selected, input float values will be evaluated as
integer

Functions list of Functions (page 93) names (double click to copy one in the expression) such as
mathematical, conditional, logical, statistics, indices, and custom

open a text file (.txt) containing custom expressions to be listed in Functions

A text file can be loaded for adding expressions to the Functions. The text must contain an expression for each line;
each line must be in the form expression_name; expression (separated by ;) where the expression_name is
the expression name that is displayed in the Functions. Opening an empty text file will remove custom expressions
from the Functions. Following an example of text content:

NDVI; ( "#NIR#" - "#RED#" ) / ( "#NIR#" + "#RED#" ) @NDVI


EVI; 2.5 * ( "#NIR#" - "#RED#" ) / ( "#NIR#" + 6 * "#RED#" - 7.5 * "#BLUE#" + 1) @EVI
SR; ( "#NIR#" / "#RED#" ) @SR

Output raster

The output raster is a .tif file, with the same spatial resolution and projection of input rasters; if input rasters have
different spatial resolutions, then the highest resolution (i.e. minimum pixel size) is used for output raster.

Tip: If multiple lines are entered in Expression or output name are defined in line, a directory selection instead
of a file selection is prompted for output.

90 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol and name Description


Output data type select the output data type as Float32 (default), Int32,
Int16, UInt32, UInt16, Byte; it can be different from
Calculation data type
Output NoData value set the value of NoData pixels in output raster
NoData mask manage NoData at pixel level; if True, then output is
NoData if any input is NoData; if False, then output
is NoData if all the inputs are NoData; if None, then
NoData is not applied to output

Set scale if checked, set a scale in output raster (and output val-
ues are divided by scale)

Set offset if checked, set an offset in output raster (and offset is


subtracted to output values)
Extent UL X UL Y LR X LR Y
set the extent of the output raster among:
• ‘Union’: the extent union of input rasters
• ‘Map extent’: the extent of the map cur-
rently displayed
• ‘Intersection’: the extent intersection of
input raster extents (i.e. minimum extent)
• ‘Custom’: coordinates defined in UL X UL
Y LR X LR Y
• Layer name: the extent of the selected
layer

Align align the output raster to a specific Layer name or ‘De-


fault’ for automatic alignment to input rasters
Pixel size set pixel size

RUN run this function; it is disabled if the expression syntax


is not correct

Input variables

The following variables related to the Band set (page 36) are available (please note that the character " is always
required):
• bandset#b BAND_NUMBER: bands in the active Band set can be referenced directly; the following example
refers to band 1 of the active Band set:

"bandset#b1"

• bandset BANDSET_NUMBER b BAND_NUMBER: bands in the Band set can be referenced directly; the
following example refers to band 1 of the Band set 1:

"bandset1b1"

• bandset{ BANDSET_NUMBER_LIST }b BAND_NUMBER: list of all the bands X of all the Band sets match-
ing a list between curly brackets (e.g. {1,2,3}) or range of Band sets separated by colon (e.g. {1:3}) or a
list of ranges of Band sets (e.g. {1:3, 5:8}), which is equivalent to [bandset1bX, bandset2bX, ...,
bandsetNbX]; this variable can be used in expressions that accept band lists such as the sum:

3.4. Main Interface Window 91


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

sum("bandset{1,3}b1")

• bandset#b*: list of all the bands of active Band set, which is equivalent to [bandset#b1, bandset#b2,
..., bandset#bX]; to be used in expressions that accept band lists such as the maximum value:

max("bandset#b*")

• bandset BANDSET_NUMBER b*: list of all the bands of Band set N, which is equivalent to [bandsetNb1,
bandsetNb2, ..., bandsetNbX]; to be used in expressions that accept band lists such as the minimum
value:

min("bandset1b*")

• bandset*b BAND_NUMBER: list of all the bands X of all the Band sets, which is equivalent to
[bandset1bX, bandset2bX, ..., bandsetNbX]; to be used in expressions that accept band lists such
as the mean value:

mean("bandset*b1")

• bandset{ DATE }b BAND_NUMBER: list of all the bands X of all the Band sets matching a list of dates
(format yyyy-mm-dd) between curly brackets (e.g. {2019-01-01,2019-07-31}) or range of dates separated by
colon (e.g. {2019-01-01:2019-07-31}) or a list of ranges of dates (e.g. {2019-01-01:2019-01-31, 2019-04-
01:2019-07-31}), which is equivalent to [bandset2bX, bandset5bX, ..., bandsetNbX]; Band sets
dates are defined in Band set definition (page 37); this variable can be used in expressions that accept band
lists such as the median value:

median("bandset{2019-01-01,2019-07-31}b1")

• “#BLUE#”: the band with the center wavelength closest to 0.475 𝜇𝑚;
• “#GREEN#”: the band with the center wavelength closest to 0.56 𝜇𝑚;
• “#RED#”: the band with the center wavelength closest to 0.65 𝜇𝑚;
• “#NIR#”: the band with the center wavelength closest to 0.85 𝜇𝑚; for example:

( "#NIR#" - "#RED#" ) / ( "#NIR#" + "#RED#" )

Output variables

Output names can be defined in the expression line entering the symbol @ followed by the name, such as the
following example:

"raster1" * 2 @first_calculation

If the output name is defined in the expression, an output directory will be selected after clicking the button RUN.

Warning: It is recommended to avoid the use of characters # and @ in the output raster name.

It is possible to set the output path directly by defining the output name with this structure @path@name, such as:

"raster1" * 2 @/home/user@first_calculation

The directory will be created if it does not exist.


It is possible to create a temporary output (saved in the temporary directory) with @temp@ followed by output
name, such as:

92 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

"raster1" * 2 @temp@first_calculation

The output name of calculation can be used as input variable for the following calculations; for example:

"raster1" * 2 @first_calculation
"first_calculation" + 5 @temp@second_calculation
"second_calculation" - "raster1" @/home/user@third_calculation

It is possible to add the calculation result to a Band set using the symbol % followed by the Band set number
such as:

"raster1" @first_calculation%1

It is possible to add the calculation result to the active Band set using the symbol % followed by the symbol #
such as:

"raster1" @first_calculation%#

Also, variables for output name are available:


• #BANDSET#: the name of the first band in the Band set (page 36);
• #DATE#: the current date and time (e.g. 20161110_113846527764);
Using the symbol @ followed by the variable #BANDSET# can save the raster calculation inside the directory
containing the first band of the active band set, such as:

"raster1" @#BANDSET#@first_calculation

If the output name is defined with the extension .vrt, the output will be a virtual raster referencing the single
.tif files calculated by parallel processing. For instance, the following expression will calculate the raster with
parallel processing and the output will be a .vrt:

"raster1" @first_calculation.vrt

Virtual file is useful to reduce calculation time of parallel processing by avoiding the writing of the entire output
raster.

Warning: A .vrt virtual file is a text file containing the reference to existing .tif files. Moving the .vrt
virtual file or the .tif files in different directories can make the virtual file unusable.

Functions

Conditional

• where: conditional expression according to the syntax where( condition , value if true, value
if false) for example:

where("raster1" == 1, 2, "raster1")

Parenthesis are required for multiple conditions for instance to select pixel values between 1 and 3:

where( ("raster1" > 1) & ("raster1" < 3), 2, "raster1")

Nested conditions can be defined such as:

where( ("raster1" > 1) & ("raster1" < 3), 2, "raster1")

3.4. Main Interface Window 93


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Logical

• AND: AND;
• OR: OR;
• XOR: XOR;
• NOT : NOT;

Statistics

A band list between square brackets or Input variables (page 91) are required arguments.
• max: maximum; for instance:

max(["raster1", "raster2", "raster3"])

• min: minimum; for instance:

min(["bandset#b*"])

• mean: mean; for instance:

mean("bandset*b1")

• median: median; for instance:

median("bandset{2019-01-01,2019-07-31}b1")

• percentile: percentile calculation; the expression must have this structure percentile([band_list],
percentile_value); for instance, the following expression calculates the 10th percentile of active band
set:

percentile("bandset#b*", 10)

• std: standard deviation; for instance:

std("bandset{1,3}b1")

• sum: sum; for instance:

sum("bandset{1:5}b1")

Operations

• sin: sine; for instance:

sin("raster1")

• cos: cosine;
• tan: tangent;
• asin: inverse sine;
• acos: inverse cosine;
• atan: inverse tangent;
• exp: natural exponential;

94 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• ln: natural logarithm;


• log: base 10 logarithm;

Indices

• NDVI: if selected, the NDVI calculation is entered in the Expression:

( "#NIR#" - "#RED#" ) / ( "#NIR#" + "#RED#" ) @ NDVI

• EVI: if selected, the EVI calculation is entered in the Expression:

2.5 * ( "#NIR#" - "#RED#" ) / ( "#NIR#" + 6 * "#RED#" - 7.5 * "#BLUE#" + 1) @ EVI

• NBR: if selected, the NBR calculation is entered in the Expression:

( "#NIR#" - "#SWIR2#" ) / ( "#NIR#" + "#SWIR2#" ) @NBR

Variables

• nodata: NoData value of raster (e.g. nodata("raster1")); it can be used as value in the expression:

where("raster1" == nodata("raster1"), 0, "raster1")

• forbandsets: it allows for the iteration over Band sets defined between square brackets; a range of Band sets
separated by colon (e.g. forbandsets[1:3]) or a list separated by commas (e.g. forbandsets[1,2,3];
forbandsets must be entered in the first line of expressions (not compatible with forbandsinbandset),
for instance:

forbandsets[1:3]
"bandset#b1" @#BANDSET#

During the iteration, the Input variables (page 91) related to the active Band set are replaced by the iterator, therefore
the expression:

forbandsets[1:3]
"bandset#b1" @#BANDSET#

is equivalent to:

"bandset1b1" @calc1
"bandset2b1" @calc2
"bandset3b1" @calc3

It is possible to enter a string (or a list of strings separated by comma ,) after the square bracket ] to filter Band
sets by the name of first band in Band set; for instance, the following expression will iterate the first 3 Band sets
selecting only the Band set whose name of the first band includes RT:

forbandsets[1,2,3]RT

Also, forbandsets: allows for the iteration over Band sets dates (format yyyy-mm-dd, defined in Band set definition
(page 37)) between square brackets, such as the following examples:
Iterating over a range of dates:

forbandsets[2020-01-01:2020-07-31]
"bandset#b1" @#BANDSET#

3.4. Main Interface Window 95


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Iterating over a list of dates:

forbandsets[2020-02-01,2020-03-11,2020-04-21]
"bandset#b1" @#BANDSET#

Iterating over a list of ranges of dates:

forbandsets[2010-01-01:2010-06-31, 2010-08-01:2010-08-31, 2010-10-01:2010-12-31]


"bandset#b1" @#BANDSET#

During the iteration, the Input variables (page 91) related to the active Band set are replaced by the iterator.
It is possible to enter a string (or a list of strings separated by comma ,) after the square bracket ] to filter Band
sets by the name of first band in Band set; for instance, the following expression will iterate the Band sets in the
range selecting only the Band set whose name of the first band includes RT:

forbandsets[2020-01-01:2020-07-31]RT

• forbandsinbandset: it allows for the iteration over bands in a Band set or a range of Band sets between
square brackets; forbandsinbandset must be entered in the first line of expressions (not compatible with
forbandsets); the variable #BAND# must be used to refer to the iterated band such as the following exam-
ples:
Iterating over the bands of the first Band set (note the " in the expression):

forbandsinbandset[1]
where("#BAND#" > 1, 1, 2) @#BAND#)

Iterating over all the bands of Band sets from 1 to 3:

forbandsinbandset[1:3]
where("#BAND#" > 1, 1, 2) @#BAND#)

• #BAND#:
• #BANDSET#: the name of the first band in the Band set (page 36);
• #DATE#: the current date and time (e.g. 20161110_113846527764);
• @: character @;

3.4.8 Script

• Script (page 97)

This tab displays the output of the Script buttons that are available in several tools, which ease the creation of
Python scripts using Remotior Sensus.
It is possible to edit or copy the Python code and run it in a Python shell. New code is appended to the existing
one, when using the Script buttons.

96 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 46: Script

Script

Tool symbol and name Description

clear the content of the script


Copy copy the content of the script to the clipboard

Save to file save the script to file .py

3.4.9 Settings

The tab Settings allows for the customization of SCP.

Debug

• Log file (page 98)


• Test (page 98)

This tab allows for the debug of SCP in case of issues, and the check of SCP dependencies.

3.4. Main Interface Window 97


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 47: Debug

Log file

Tool symbol and name Description

Record detailed events in a Log file if checked, start recording detailed events in a Log file

export the Log file to a .txt file

Test

Tool symbol Description


and name
Test dependen- test SCP dependencies (NumPy, SciPy, Matplotlib, GDAL, PyTorch, scikit-learn, Remotior
Sensus, Multiprocess, Internet connection)
cies

Interface

• ROI style (page 99)


• Variable name for expressions (page 99)
• Temporary group name (page 100)
• Dock (page 100)

This tab includes a few advanced settings of the SCP interface.

98 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 48: Interface

ROI style

Change ROI color and transparency for a better visualization of temporary ROIs on the map.

Tool symbol and name Description

ROI color button for changing ROI color

Transparency change ROI transparency

reset ROI color and transparency to default

Variable name for expressions

Set the variable name used in expressions of the Reclassification (page 86).

Tool symbol and name Description

Variable name set variable name (default is raster)

reset variable name to default

3.4. Main Interface Window 99


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Temporary group name

Tool symbol and name Description

Group name set group name (default is Class_temp_group)

reset group name to default

Create RGB composite of band set when if checked, a RGB composite of active band set is added to
the map when a project is loaded
a project is loaded

Dock

Tool symbol and Description


name

Download news if checked, news about the SCP and related services are downloaded on startup and
displayed in Dock; also, it checks for updates of Remotior Sensus
on startup

Processing setting

• System (page 100)


• Calculation process (page 101)
• SMTP process notification (page 102)
• Temporary directory (page 102)
• External programs (page 102)

System

Tool symbol Description


and name
Available RAM set the available RAM (in MB) that is used during the processes in order to improve the SCP
(MB) performance; this value should be half of the system RAM (e.g. 1024MB if system has 2GB
of RAM)

CPU threads set the number of threads available for processing; it is recommended to set a value lower
than the maximum number of system threads (e.g. if the system has 4 available threads set
value 3)

100 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 49: Processing

Calculation process

Tool symbol Description


and name

Play if checked, play a sound when the process is completed


sound when

finished

Raster if checked, a lossless compression (DEFLATE or PACKBITS) is applied to raster outputs


compression in order to save disk space; it is recommended to check this option to save disk space, or
uncheck to faster the calculation

3.4. Main Interface Window 101


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

SMTP process notification

Tool symbol and Description


name

SMTP server the SMTP server to login for sending a notification email when all the SCP processes
are finished (a notification is sent also in case of error, but not in case of crash)

user the SMTP server user

password the SMTP server password


Send email of com- a list of addresses (separated by comma) to send the notification email to
pleted process to

Warning: If remember is checked, the password is stored unencrypted in QGIS registry.

Temporary directory

Tool sym- Description


bol and
name

select a new temporary directory where temporary files are saved during the processing; the
path to the current temporary directory is displayed; default is a system temporary directory

reset to default temporary directory

External programs

Some tools require external programs to perform the processing.

Tool symbol and name Description


GDAL installation direc- enter the path to the GDAL directory containing tools such as gdal_translate and
gdalwarp (e.g. /usr/bin); this parameter is usually not required
tory

102 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

3.5 Spectral Signature Plot

The window Spectral Signature Plot includes several functions for displaying spectral signature values as a function
of wavelength (defined in the Band set (page 36)). Signatures can be added to the Spectral Signature Plot
through the SCP dock (page 22).
Overlapping signatures (belonging to different classes or macroclasses) are highlighted in orange in the table Sig-
nature list (page 103); the overlapping check is performed considering MC ID or C ID according to the setting Use

MC ID C ID in Classification (page 64). Overlapping signatures sharing the same ID are not highlighted.

Fig. 50: Spectral Signature Plot

3.5.1 Signature list

The Signature list is a table that includes the spectral signatures added from the SCP dock (page 22).

S MC ID MC C ID C Color
Name Name
checkbox field; if signa- signature signa- signa- signature color; also, the combina-
checked, the spectral ture Macro- ture ture tion MC ID-C ID is displayed in case
signature is displayed in Macro- class Class Class of overlap with other signatures
the plot class ID Name ID Name

The following tools are available.

3.5. Spectral Signature Plot 103


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol Description


and name

remove highlighted signatures from this list

add highlighted spectral signatures to ROI & Signature list (page 27)

calculate the spectral distances of spectral signatures displayed in the plot; distances are
reported in the tab Spectral distances (page 104)

Plot

Left click and hold inside the plot to move the view of the plot. Use the mouse wheel to zoom in and out the
view of the plot. Right click and hold inside the plot to zoom in a specific area of the plot. Legend inside the plot
can be moved using the mouse.
The following tools are available.

Tool symbol and name Description

automatically fit the plot to data

save the plot image to file (available formats are .jpg, .png, and .pdf)

Plot value range if checked, plot the value range for each signature with a semi-transparent area

Band lines if checked, display a vertical line for each band (center wavelength)

Grid if checked, display a grid


Max characters set the maximum length of text in the legend
xy display x y coordinates of mouse cursor inside the plot

Signature details

Display the details about spectral signatures (i.e. Wavelength, Values, and Standard deviation). In case of signatures
calculated from ROIs, the ROI size (number of pixels) is also displayed.

Spectral distances

Display spectral distances of signatures (see Signature list (page 103)), which are useful for assessing ROI separa-
bility (see Spectral Distance (page 131)).
The following spectral distances are calculated :
• Spectral Angle (page 132): range [0 = identical, 90 = different]; useful in particular for Spectral Angle
Mapping (page 127) classifications
• Euclidean Distance (page 132): useful in particular for Minimum Distance (page 126) classifications
• Bray-Curtis Similarity (page 133): range [0 = different, 100 = identical]; useful in general
Values are displayed in red if signatures are particularly similar.

104 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 51: Spectral Signature: Example of plot

Fig. 52: Spectral Signature: Example of signature details

3.5. Spectral Signature Plot 105


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 53: Spectral Signature: Example of spectral distances

3.6 Scatter Plot

The window Scatter plot displays pixel values for two raster bands as points in the 2D space. Scatter plots are
useful for assessing ROI separability between two bands.
The functions are described in detail in the following paragraphs.

3.6.1 Scatter list

The Scatter list is a table that includes the spectral signatures added from the SCP dock (page 22).

S MC ID MC Name C ID C Name Color


checkbox field; if checked, the spectral signature signature signature signature signa-
signature is displayed in the plot Macroclass Macroclass Class ID Class ture
ID Name Name color

The following tools are available.

106 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 54: Scatter Plot

3.6. Scatter Plot 107


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Tool symbol Description


and name

Band X X band of the plot


Band Y Y band of the plot

remove highlighted signatures from this list

add highlighted spectral signatures to ROI & Signature list (page 27)

Preci- use custom precision for calculation (precision should be selected according significant digits):
sion * 4 = 10−4 * 3 = 10−3 * 2 = 10−2 * 1 = 10−1 * 0 = 1 * -1 = 10 * -2 = 102 * -3 = 103
Calculate calculate the scatter plot for the ROIs checked in the list

remove highlighted signatures from this list

add a temporary scatter plot to the list (as MC Name = tempScatter) and start the plot calcu-
lation of the last temporary ROI (see Working toolbar (page 32))

Warning: Using a precision value that is too high can result in slow calculation or failure.

Plot

Left click and hold inside the plot to move the view of the plot. Use the mouse wheel to zoom in and out the
view of the plot. Right click and hold inside the plot to zoom in a specific area of the plot.

Tool symbol Description


and name

Colormap select a colormap that is applied to highlighted scatter plots in the list when is clicked; if
no scatter plot is highlighted then the colormap is applied to all the scatter plots

automatically fit the plot to data

save the plot image to file (available formats are .jpg, .png, and .pdf)
xy display x y coordinates of mouse cursor inside the plot

3.7 Integration in QGIS Processing

Several SCP tools can be accessed from the QGIS Processing Toolbox, and can be used to create models. The tools
are available in the menu Semi-Automatic Classification Plugin.

108 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 55: Example Scatter Plot

The functions described in the following paragraphs use these conventions:

3.7. Integration in QGIS Processing 109


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 56: Integration in QGIS Processing Toolbox

110 Chapter 3. The Interface of SCP


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Input date
Input text
List
Input number

Optional

Configuration stored in the active project of QGIS

Configuration stored in QGIS registry


Slider

Table

3.7. Integration in QGIS Processing 111


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

112 Chapter 3. The Interface of SCP


CHAPTER

FOUR

BRIEF INTRODUCTION TO REMOTE SENSING

• Basic Definitions (page 114)


– GIS definition (page 114)
– Remote Sensing definition (page 114)
– Sensors (page 116)
– Radiance and Reflectance (page 116)
– Spectral Signature (page 116)
– Land Cover (page 116)
• Multispectral satellites (page 117)
– Landsat Satellites (page 117)
– Sentinel-2 Satellite (page 118)
– Sentinel-3 Satellite (page 119)
– ASTER Satellite (page 119)
– MODIS Products (page 120)
– GOES Products (page 121)
• SAR satellites (page 121)
– Sentinel-1 Satellites (page 122)
• Land Cover Classification (page 122)
– Supervised Classification (page 122)
– Color Composite (page 122)
– Training Areas (page 124)
– Classes and Macroclasses (page 124)
– Classification Algorithms (page 126)
– Machine Learning (page 130)
– Spectral Distance (page 131)
– Classification Result (page 133)
– Accuracy Assessment (page 133)
• Image processing (page 134)
– Principal Component Analysis (page 134)
– Pan-sharpening (page 135)

113
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

– Spectral Indices (page 135)


– Clustering (page 136)
• Image conversion to reflectance (page 138)
– Radiance at the Sensor’s Aperture (page 138)
– Top Of Atmosphere (TOA) Reflectance (page 138)
– Surface Reflectance (page 139)
– DOS1 Correction (page 139)
• Conversion to Temperature (page 142)
– Conversion to At-Satellite Brightness Temperature (page 142)
– Estimation of Land Surface Temperature (page 143)
• References (page 143)

4.1 Basic Definitions

This chapter provides basic definitions about GIS and remote sensing.

4.1.1 GIS definition

There are several definitions of GIS (Geographic Information Systems), which is not simply a program. In general,
GIS are systems that allow for the use of geographic information (data have spatial coordinates). In particular, GIS
allow for the view, query, calculation and analysis of spatial data, which are mainly distinguished in raster or vector
data structures. Vector is made of objects that can be points, lines or polygons, and each object can have one or
more attribute values; a raster is a grid (or image) where each cell has an attribute value (Fisher and Unwin, 2005).
Several GIS applications use raster images that are derived from remote sensing.

4.1.2 Remote Sensing definition

A general definition of Remote Sensing is “the science and technology by which the characteristics of objects of
interest can be identified, measured or analyzed the characteristics without direct contact” (JARS, 1993).
Usually, remote sensing is the measurement of the energy that is emanated from the Earth’s surface. If the source
of the measured energy is the sun, then it is called passive remote sensing, and the result of this measurement can
be a digital image (Richards and Jia, 2006). If the measured energy is not emitted by the Sun but from the sensor
platform then it is defined as active remote sensing, such as radar sensors which work in the microwave range
(Richards and Jia, 2006).
The electromagnetic spectrum is “the system that classifies, according to wavelength, all energy (from short
cosmic to long radio) that moves, harmonically, at the constant velocity of light” (NASA, 2013). Passive sensors
measure energy from the optical regions of the electromagnetic spectrum: visible, near infrared (i.e. IR), short-
wave IR, and thermal IR (see Figure Electromagnetic-Spectrum (page 115)).

The interaction between solar energy and materials depends on the wavelength; solar energy goes from the Sun to
the Earth and then to the sensor. Along this path, solar energy is (NASA, 2013):
• Transmitted - The energy passes through with a change in velocity as determined by the index of refraction
for the two media in question.
• Absorbed - The energy is given up to the object through electron or molecular reactions.

114 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 1: Electromagnetic-Spectrum
by Victor Blacus (SVG version of File:Electromagnetic-Spectrum.png)
[CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)]
via Wikimedia Commons
http://commons.wikimedia.org/wiki/File%3AElectromagnetic-Spectrum.svg

4.1. Basic Definitions 115


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• Reflected - The energy is returned unchanged with the angle of incidence equal to the angle of reflection.
Reflectance is the ratio of reflected energy to that incident on a body. The wavelength reflected (not absorbed)
determines the color of an object.
• Scattered - The direction of energy propagation is randomly changed. Rayleigh and Mie scatter are the two
most important types of scatter in the atmosphere.
• Emitted - Actually, the energy is first absorbed, then re-emitted, usually at longer wavelengths. The object
heats up.

4.1.3 Sensors

Sensors can be on board of airplanes or on board of satellites, measuring the electromagnetic radiation at specific
ranges (usually called bands). As a result, the measures are quantized and converted into a digital image, where
each picture elements (i.e. pixel) has a discrete value in units of Digital Number (DN) (NASA, 2013). The resulting
images have different characteristics (resolutions) depending on the sensor. There are several kinds of resolutions:
• Spatial resolution, usually measured in pixel size, “is the resolving power of an instrument needed for the
discrimination of features and is based on detector size, focal length, and sensor altitude” (NASA, 2013);
spatial resolution is also referred to as geometric resolution or IFOV;
• Spectral resolution, is the number and location in the electromagnetic spectrum (defined by two wave-
lengths) of the spectral bands (NASA, 2013) in multispectral sensors, for each band corresponds an image;
• Radiometric resolution, usually measured in bits (binary digits), is the range of available brightness values,
which in the image correspond to the maximum range of DNs; for example an image with 8 bit resolution
has 256 levels of brightness (Richards and Jia, 2006);
• For satellites sensors, there is also the temporal resolution, which is the time required for revisiting the
same area of the Earth (NASA, 2013).

4.1.4 Radiance and Reflectance

Sensors measure the radiance, which corresponds to the brightness in a given direction toward the sensor; it useful
to define also the reflectance as the ratio of reflected versus total power energy.

4.1.5 Spectral Signature

The spectral signature is the reflectance as a function of wavelength (see Figure Spectral Reflectance Curves
of Four Different Targets (page 117)); each material has a unique signature, therefore it can be used for material
classification (NASA, 2013).

4.1.6 Land Cover

Land cover is the material at the ground, such as soil, vegetation, water, asphalt, etc. (Fisher and Unwin, 2005).
Depending on the sensor resolutions, the number and kind of land cover classes that can be identified in the image
can vary significantly.

116 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 2: Spectral Reflectance Curves of Four Different Targets


(from NASA, 2013)

4.2 Multispectral satellites

There are several satellites with different characteristics that acquire multispectral images of earth surface. The
following satellites are particularly useful for land cover monitoring because images are provided for free and can
be downloaded directly from SCP; data have been acquired for the past few decades and the archive is continuously
growing with recent images.

4.2.1 Landsat Satellites

Landsat is a set of multispectral satellites developed by the NASA (National Aeronautics and Space Administration
of USA), since the early 1970’s.
Landsat images are very used for environmental research. The resolutions of Landsat 4 and Landsat 5 sensors
are reported in the following table (from http://landsat.usgs.gov/band_designations_landsat_satellites.php); also,
Landsat temporal resolution is 16 days (NASA, 2013).
Landsat 4 and Landsat 5 Bands

Landsat 4, Landsat 5 Bands Wavelength [micrometers] Resolution [meters]


Band 1 - Blue 0.45 - 0.52 30
Band 2 - Green 0.52 - 0.60 30
Band 3 - Red 0.63 - 0.69 30
Band 4 - Near Infrared (NIR) 0.76 - 0.90 30
Band 5 - SWIR 1.55 - 1.75 30
Band 6 - Thermal Infrared 10.40 - 12.50 120 (resampled to 30)
Band 7 - SWIR 2.08 - 2.35 30

The resolutions of Landsat 7 sensor are reported in the following table (from http://landsat.usgs.gov/band_
designations_landsat_satellites.php); also, Landsat temporal resolution is 16 days (NASA, 2013).
Landsat 7 Bands

4.2. Multispectral satellites 117


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Landsat 7 Bands Wavelength [micrometers] Resolution [meters]


Band 1 - Blue 0.45 - 0.52 30
Band 2 - Green 0.52 - 0.60 30
Band 3 - Red 0.63 - 0.69 30
Band 4 - Near Infrared (NIR) 0.77 - 0.90 30
Band 5 - SWIR 1.57 - 1.75 30
Band 6 - Thermal Infrared 10.40 - 12.50 60 (resampled to 30)
Band 7 - SWIR 2.09 - 2.35 30
Band 8 - Panchromatic 0.52 - 0.90 15

The resolutions of Landsat 8 sensor are reported in the following table (from http://landsat.usgs.gov/band_
designations_landsat_satellites.php); also, Landsat temporal resolution is 16 days (NASA, 2013).
Landsat 8 Bands

Landsat 8 Bands Wavelength [micrometers] Resolution [meters]


Band 1 - Coastal aerosol 0.43 - 0.45 30
Band 2 - Blue 0.45 - 0.51 30
Band 3 - Green 0.53 - 0.59 30
Band 4 - Red 0.64 - 0.67 30
Band 5 - Near Infrared (NIR) 0.85 - 0.88 30
Band 6 - SWIR 1 1.57 - 1.65 30
Band 7 - SWIR 2 2.11 - 2.29 30
Band 8 - Panchromatic 0.50 - 0.68 15
Band 9 - Cirrus 1.36 - 1.38 30
Band 10 - Thermal Infrared (TIRS) 1 10.60 - 11.19 100 (resampled to 30)
Band 11 - Thermal Infrared (TIRS) 2 11.50 - 12.51 100 (resampled to 30)

A vast archive of images is freely available from the U.S. Geological Survey . For more information about how to
freely download Landsat images read this .
Images are identified with the paths and rows of the WRS (Worldwide Reference System for Landsat ).

4.2.2 Sentinel-2 Satellite

Sentinel-2 is a multispectral satellite developed by the European Space Agency (ESA) in the frame of Copernicus
land monitoring services. Sentinel-2 acquires 13 spectral bands with the spatial resolution of 10m, 20m and 60m
depending on the band, as illustrated in the following table (ESA, 2015).
Sentinel-2 Bands

Sentinel-2 Bands Central Wavelength [micrometers] Resolution [meters]


Band 1 - Coastal aerosol 0.443 60
Band 2 - Blue 0.490 10
Band 3 - Green 0.560 10
Band 4 - Red 0.665 10
Band 5 - Vegetation Red Edge 0.705 20
Band 6 - Vegetation Red Edge 0.740 20
Band 7 - Vegetation Red Edge 0.783 20
Band 8 - NIR 0.842 10
Band 8A - Vegetation Red Edge 0.865 20
Band 9 - Water vapour 0.945 60
Band 10 - SWIR - Cirrus 1.375 60
Band 11 - SWIR 1.610 20
Band 12 - SWIR 2.190 20

118 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Sentinel-2 images are freely available from the ESA website https://scihub.copernicus.eu.

4.2.3 Sentinel-3 Satellite

Sentinel-3 is a satellite developed by the European Space Agency (ESA) in the frame of Copernicus land mon-
itoring services. It carries several instruments, in particular the Ocean and Land Colour Instrument (OLCI) is a
push-broom imaging spectrometer acquiring 21 bands in the range 0.4-1.02 m with a swath width of 1,270km and
300m spatial resolution (ESA, 2013). The revisit time is about 2 days.
Sentinel-3 Bands

Sentinel-3 Bands Central Wavelength [micrometers]


Oa1 0.400
Oa2 0.4125
Oa3 0.4425
Oa4 0.490
Oa5 0.510
Oa6 0.560
Oa7 0.620
Oa8 0.665
Oa9 0.67375
Oa10 0.68125
Oa11 0.70875
Oa12 0.75375
Oa13 0.76125
Oa14 0.764375
Oa15 0.7675
Oa16 0.77875
Oa17 0.865
Oa18 0.885
Oa19 0.900
Oa20 0.940
Oa21 1.020

4.2.4 ASTER Satellite

The ASTER (Advanced Spaceborne Thermal Emission and Reflection Radiometer) satellite was launched in 1999
by a collaboration between the Japanese Ministry of International Trade and Industry (MITI) and the NASA.
ASTER has 14 bands whose spatial resolution varies with wavelength: 15m in the visible and near-infrared, 30m
in the short wave infrared, and 90m in the thermal infrared (USGS, 2015). ASTER bands are illustrated in the
following table (due to a sensor failure SWIR data acquired since April 1, 2008 is not available ). An additional
band 3B (backwardlooking near-infrared) provides stereo coverage.
ASTER Bands

4.2. Multispectral satellites 119


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

ASTER Bands Wavelength [micrometers] Resolution [meters]


Band 1 - Green 0.52 - 0.60 15
Band 2 - Red 0.63 - 0.69 15
Band 3N - Near Infrared (NIR) 0.78 - 0.86 15
Band 4 - SWIR 1 1.60 - 1.70 30
Band 5 - SWIR 2 2.145 - 2.185 30
Band 6 - SWIR 3 2.185 - 2.225 30
Band 7 - SWIR 4 2.235 - 2.285 30
Band 8 - SWIR 5 2.295 - 2.365 30
Band 9 - SWIR 6 2.360 - 2.430 30
Band 10 - TIR 1 8.125 - 8.475 90
Band 11 - TIR 2 8.475 - 8.825 90
Band 12 - TIR 3 8.925 - 9.275 90
Band 13 - TIR 4 10.25 - 10.95 90
Band 14 - TIR 5 10.95 - 11.65 90

4.2.5 MODIS Products

The MODIS (Moderate Resolution Imaging Spectroradiometer) is an instrument operating on the Terra and Aqua
satellites launched by NASA in 1999 and 2002 respectively. Its temporal resolutions allows for viewing the entire
Earth surface every one to two days, with a swath width of 2,330km. Its sensors measure 36 spectral bands at three
spatial resolutions: 250m, 500m, and 1,000m (see https://lpdaac.usgs.gov/dataset_discovery/modis).
Several products are available, such as surface reflectance and vegetation indices. In this manual we are considering
the surface reflectance bands available at 250m and 500m spatial resolution (Vermote, Roger, & Ray, 2015).
MODIS Bands

MODIS Bands Wavelength [micrometers] Resolution [meters]


Band 1 - Red 0.62 - 0.67 250 - 500
Band 2 - Near Infrared (NIR) 0.841 - 0.876 250 - 500
Band 3 - Blue 0.459 - 0.479 500
Band 4 - Green 0.545 - 0.565 500
Band 5 - SWIR 1 1.230 - 1.250 500
Band 6 - SWIR 2 1.628 - 1.652 500
Band 7 - SWIR 3 2.105 - 2.155 500

The following products (Version 6, see https://lpdaac.usgs.gov/dataset_discovery/modis/modis_products_table)


are available for download (Vermote, Roger, & Ray, 2015):
• MOD09GQ: daily reflectance at 250m spatial resolution from Terra MODIS;
• MYD09GQ: daily reflectance at 250m spatial resolution from Aqua MODIS;
• MOD09GA: daily reflectance at 500m spatial resolution from Terra MODIS;
• MYD09GA: daily reflectance at 500m spatial resolution from Aqua MODIS;
• MOD09Q1: reflectance at 250m spatial resolution, which is a composite of MOD09GQ (each pixel contains
the best possible observation during an 8-day period);
• MYD09Q1: reflectance at 250m spatial resolution, which is a composite of MYD09GQ (each pixel contains
the best possible observation during an 8-day period);
• MOD09A1: reflectance at 250m spatial resolution, which is a composite of MOD09GA (each pixel contains
the best possible observation during an 8-day period);
• MYD09A1: reflectance at 250m spatial resolution, which is a composite of MYD09GA (each pixel contains
the best possible observation during an 8-day period);

120 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

4.2.6 GOES Products

The Geostationary Operational Environmental Satellite-R Series (GOES-R) are geostationary satellites de-
veloped for weather monitoring by the National Oceanic and Atmospheric Administration (NOAA) and the NASA
(NOAA, 2020).
GOES constellation is composed of GOES-R satellite (also known as GOES-16 that replaced GOES-13 on
December 2017), and GOES-S satellite (also known as GOES-17, operational since February 2019). Other
satellites (GOES-T and GOES-U) are planned to be launched in the future. For more information please visit
https://www.goes-r.gov/mission/mission.html .
GOES geostationary satellites monitor continuously the same area, a very large portion of Earth surface with three
geographic coverage regions: Full Disk, Continental United States (CONUS), and Mesoscale. In particular, Full
Disk products have hemispheric coverage of 83° local zenith angle, and images are acquired every 5-15 minutes.
GOES-16 monitors from 75.2 degrees west longitude, including America, the Atlantic Ocean, and the west coast
of Africa. GOES-17 monitors from 137.2 degrees west longitude, including the Pacific Ocean.
GOES sensors include several spectral bands.
GOES Bands

GOES Bands Central Wavelength [micrometers] Resolution [meters]


Band 1 - Blue 0.47 1000
Band 2 - Red 0.64 500
Band 3 - Near Infrared (NIR) 0.87 1000
Band 4 - SWIR - Cirrus 1.38 2000
Band 5 - SWIR 1.61 1000
Band 6 - SWIR 2.25 2000

4.3 SAR satellites

Synthetic Aperture Radar (SAR) is a technique of active remote sensing that is the sensor platform emits mi-
crowaves in order to acquire images of the ground (Richards and Jia, 2006). In fact, the sensor platform emits the
radiation (at a specific wavelength) and measures the magnitude and the phase of radiation that bounces back from
the ground to the sensor.
Unlike passive sensors, SAR systems can work day and night and can penetrate clouds allowing for the monitoring
of surface also with adverse meteorological conditions; depending on the microwave wavelength, the radiation can
penetrate different types of materials allowing for different applications (NASA, 2020).
The main SAR systems can be divided according to the wavelength as illustrated in the following table (NASA,
2020):
Main SAR Bands

Band Wavelength [cen- Application


timeters]
X 3.8 – 2.4 High Resolution SAR, urban monitoring, ice and snow, little penetration into
vegetation cover
C 7.5 – 3.8 global mapping, change detection, ice, low penetration into vegetation cover
S 15 – 7.5 global mapping, agriculture monitoring, medium penetration into vegetation
cover
L 30 – 15 Medium resolution SAR, biomass and vegetation mapping, high penetration
into vegetation cover

Usually, SAR sensors can emit and measure different polarizations (i.e. orientation of the microwaves of the electric
field), for instance vertical (i.e. polarization oriented in the vertical direction in antenna coordinates) and horizontal

4.3. SAR satellites 121


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

(i.e. polarization oriented in the horizontal direction in antenna coordinates) (ESA, 2020).
SAR systems can acquire in both ascending and descending orbits, however the acquired images are affected by
the different acquisition geometries, which should be considered when mixing ascending and descending images.
Acquisitions are called swaths and usually they are composed of sub-swaths. With particular acquisition modes,
the resolution of pixels along track (the side parallel to the flight direction) can be different than slant-range (the
side perpendicular to the flight direction).
SAR phase information is used to perform interferometry (also InSAR) to measure the distance from the sensor to
the target (NASA, 2020).
For more information, please read the ESA introduction to SAR and the NASA definition of SAR .

4.3.1 Sentinel-1 Satellites

Sentinel-1 is a Copernicus mission of satellites that operate at C-band to provide SAR imagery at medium resolu-
tion (about 10m).
The Sentinel-1 constellation provides high revisit time (about 5 days), a wide swath (250 km), and acquires images
in different operational modes. The primary operation mode on land is the Interferometric Wide swath (IW),
which is data is acquired in three swaths using the Terrain Observation with Progressive Scanning SAR (TOPSAR)
imaging technique (ESA, 2020b).
The Level-1 products systematically delivered by Copernicus are Single Look Complex (SLC, data comprising
complex imagery with amplitude and phase) and Ground Range Detected (GRD, Level-1 data with multi-looked
intensity only).
Sentinel-1 supports dual polarization, which are horizontal (H) or vertical (V); VV and VH polarimetric channels
are available to classify and analyze land cover such as built-up areas or vegetation.

4.4 Land Cover Classification

This chapter provides basic definitions about land cover classifications.

4.4.1 Supervised Classification

A semi-automatic classification (also supervised classification) is an image processing technique that allows for
the identification of materials in an image, according to their spectral signatures. There are several kinds of clas-
sification algorithms, but the general purpose is to produce a thematic map of the land cover.
Image processing and GIS spatial analyses require specific software such as the Semi-Automatic Classification
Plugin for QGIS.

4.4.2 Color Composite

Often, a combination is created of three individual monochrome images, in which each is assigned a given color;
this is defined color composite and is useful for photo interpretation (NASA, 2013). Color composites are usually
expressed as:
“R G B = Br Bg Bb”
where:
• R stands for Red;
• G stands for Green;
• B stands for Blue;
• Br is the band number associated to the Red color;

122 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 3: A multispectral image processed to produce a land cover classification


(Landsat image provided by USGS)

• Bg is the band number associated to the Green color;


• Bb is the band number associated to the Blue color.
The following Figure Color composite of a Landsat 8 image (page 123) shows a color composite “R G B = 4 3 2”
of a Landsat 8 image (for Landsat 7 the same color composite is R G B = 3 2 1; for Sentinel-2 is R G B = 4 3 2) and
a color composite “R G B = 5 4 3” (for Landsat 7 the same color composite is R G B = 4 3 2; for Sentinel-2 is R G
B = 8 4 3). The composite “R G B = 5 4 3” is useful for the interpretation of the image because vegetation pixels
appear red (healthy vegetation reflects a large part of the incident light in the near-infrared wavelength, resulting
in higher reflectance values for band 5, thus higher values for the associated color red).

Fig. 4: Color composite of a Landsat 8 image


Data available from the U.S. Geological Survey

4.4. Land Cover Classification 123


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

4.4.3 Training Areas

Usually, supervised classifications require the user to select one or more Regions of Interest (ROIs, also Training
Areas) for each land cover class identified in the image. ROIs are polygons drawn over homogeneous areas of the
image that overlay pixels belonging to the same land cover class.

Region Growing Algorithm

The Region Growing Algorithm allows to select pixels similar to a seed one, considering the spectral similarity
(i.e. spectral distance) of adjacent pixels. In SCP the Region Growing Algorithm is available for the training area
creation. The parameter distance is related to the similarity of pixel values (the lower the value, the more similar
are selected pixels) to the seed one (i.e. selected clicking on a pixel). An additional parameter is the maximum
width, which is the side length of a square, centred at the seed pixel, which inscribes the training area (if all the
pixels had the same value, the training area would be this square). The minimum size is used a constraint (for
every single band), selecting at least the pixels that are more similar to the seed one until the number of selected
pixels equals the minimum size.
In figure Region growing example (page 124) the central pixel is used as seed (image a) for the region growing of
one band (image b) with the parameter spectral distance = 0.1; similar pixels are selected to create the training area
(image c and image d).

Fig. 5: Region growing example

4.4.4 Classes and Macroclasses

Land cover classes are identified with an arbitrary ID code (i.e. Identifier). SCP allows for the definition of
Macroclass ID (i.e. MC ID) and Class ID (i.e. C ID), which are the identification codes of land cover classes.
A Macroclass is a group of ROIs having different Class ID, which is useful when one needs to classify materials
that have different spectral signatures in the same land cover class. For instance, one can identify grass (e.g. ID
class = 1 and Macroclass ID = 1 ) and trees (e.g. ID class = 2 and Macroclass ID = 1 ) as vegetation
class (e.g. Macroclass ID = 1 ). Multiple Class IDs can be assigned to the same Macroclass ID, but the same
Class ID cannot be assigned to multiple Macroclass IDs, as shown in the following table.
Example of Macroclasses

124 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Macroclass name Macroclass ID Class name Class ID


Vegetation 1 Grass 1
Vegetation 1 Trees 2
Built-up 2 Buildings 3
Built-up 2 Roads 4

Therefore, Classes are subsets of a Macroclass as illustrated in Figure Macroclass example (page 125).

Fig. 6: Macroclass example

If the use of Macroclass is not required for the study purpose, then the same Macroclass ID can be defined for all
the ROIs (e.g. Macroclass ID = 1) and Macroclass values are ignored in the classification process.

4.4. Land Cover Classification 125


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

4.4.5 Classification Algorithms

The spectral signatures (spectral characteristics) of reference land cover classes are calculated considering the val-
ues of pixels under each ROI having the same Class ID (or Macroclass ID). Therefore, the classification algorithm
classifies the whole image by comparing the spectral characteristics of each pixel to the spectral characteristics of
reference land cover classes. SCP implements the following classification algorithms.

Minimum Distance

Minimum Distance algorithm calculates the Euclidean distance 𝑑(𝑥, 𝑦) between spectral signatures of image pixels
and training spectral signatures, according to the following equation:

⎸ 𝑛
⎸∑︁
𝑑(𝑥, 𝑦) = ⎷ (𝑥𝑖 − 𝑦𝑖 )2
𝑖=1

where:
• 𝑥 = spectral signature vector of an image pixel;
• 𝑦 = spectral signature vector of a training area;
• 𝑛 = number of image bands.
Therefore, the distance is calculated for every pixel in the image, assigning the class of the spectral signature that
is closer, according to the following discriminant function (adapted from Richards and Jia, 2006):

𝑥 ∈ 𝐶𝑘 ⇐⇒ 𝑑(𝑥, 𝑦𝑘 ) < 𝑑(𝑥, 𝑦𝑗 )∀𝑘 ̸= 𝑗

where:
• 𝐶𝑘 = land cover class 𝑘;
• 𝑦𝑘 = spectral signature of class 𝑘;
• 𝑦𝑗 = spectral signature of class 𝑗.
It is possible to define a threshold 𝑇𝑖 in order to exclude pixels below this value from the classification:

𝑥 ∈ 𝐶𝑘 ⇐⇒ 𝑑(𝑥, 𝑦𝑘 ) < 𝑑(𝑥, 𝑦𝑗 )∀𝑘 ̸= 𝑗


𝑎𝑛𝑑
𝑑(𝑥, 𝑦𝑘 ) < 𝑇𝑖

Maximum Likelihood

Maximum Likelihood algorithm calculates the probability distributions for the classes, related to Bayes’ theorem,
estimating if a pixel belongs to a land cover class. In particular, the probability distributions for the classes are
assumed the of form of multivariate normal models (Richards & Jia, 2006). In order to use this algorithm, a
sufficient number of pixels is required for each training area allowing for the calculation of the covariance matrix.
The discriminant function, described by Richards and Jia (2006), is calculated for every pixel as:
1 1
𝑔𝑘 (𝑥) = ln 𝑝(𝐶𝑘 ) − ln |Σ𝑘 | − (𝑥 − 𝑦𝑘 )𝑡 Σ−1
𝑘 (𝑥 − 𝑦𝑘 )
2 2
where:
• 𝐶𝑘 = land cover class 𝑘;
• 𝑥 = spectral signature vector of a image pixel;
• 𝑝(𝐶𝑘 ) = probability that the correct class is 𝐶𝑘 ;
• |Σ𝑘 | = determinant of the covariance matrix of the data in class 𝐶𝑘 ;
• Σ−1
𝑘 = inverse of the covariance matrix;

126 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• 𝑦𝑘 = spectral signature vector of class 𝑘.


Therefore:
𝑥 ∈ 𝐶𝑘 ⇐⇒ 𝑔𝑘 (𝑥) > 𝑔𝑗 (𝑥)∀𝑘 ̸= 𝑗

Fig. 7: Maximum Likelihood example

In addition, it is possible to define a threshold to the discriminant function in order to exclude pixels below this
value from the classification. Considering a threshold 𝑇𝑖 the classification condition becomes:
𝑥 ∈ 𝐶𝑘 ⇐⇒ 𝑔𝑘 (𝑥) > 𝑔𝑗 (𝑥)∀𝑘 ̸= 𝑗
𝑎𝑛𝑑
𝑔𝑘 (𝑥) > 𝑇𝑖
Maximum likelihood is one of the most common supervised classifications, however the classification process can
be slower than Minimum Distance (page 126).

Spectral Angle Mapping

The Spectral Angle Mapping calculates the spectral angle between spectral signatures of image pixels and training
spectral signatures. The spectral angle 𝜃 is defined as (Kruse et al., 1993):
(︃ ∑︀𝑛 )︃
𝑥 𝑖 𝑦 𝑖
𝜃(𝑥, 𝑦) = cos−1 ∑︀𝑛
𝑖=1
1 ∑︀𝑛 1
( 𝑖=1 𝑥2𝑖 ) 2 * ( 𝑖=1 𝑦𝑖2 ) 2
Where:
• 𝑥 = spectral signature vector of an image pixel;
• 𝑦 = spectral signature vector of a training area;
• 𝑛 = number of image bands.
Therefore a pixel belongs to the class having the lowest angle, that is:
𝑥 ∈ 𝐶𝑘 ⇐⇒ 𝜃(𝑥, 𝑦𝑘 ) < 𝜃(𝑥, 𝑦𝑗 )∀𝑘 ̸= 𝑗
where:

4.4. Land Cover Classification 127


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• 𝐶𝑘 = land cover class 𝑘;


• 𝑦𝑘 = spectral signature of class 𝑘;
• 𝑦𝑗 = spectral signature of class 𝑗.

Fig. 8: Spectral Angle Mapping example

In order to exclude pixels below this value from the classification it is possible to define a threshold 𝑇𝑖 :

𝑥 ∈ 𝐶𝑘 ⇐⇒ 𝜃(𝑥, 𝑦𝑘 ) < 𝜃(𝑥, 𝑦𝑗 )∀𝑘 ̸= 𝑗


𝑎𝑛𝑑
𝜃(𝑥, 𝑦𝑘 ) < 𝑇𝑖

Spectral Angle Mapping is largely used, especially with hyperspectral data.

Parallelepiped Classification

Parallelepiped classification is an algorithm that considers a range of values for each band, forming a multidi-
mensional parallelepiped that defines a land cover class. A pixel is classified if the values thereof are inside a
parallelepiped. One of the major drawbacks is that pixels whose signatures lie in the overlapping area of two or
more parallelepipeds cannot be classified (Richards and Jia, 2006).

Land Cover Signature Classification

This classification allows for the definition of spectral thresholds for each training input signature (a minimum
value and a maximum value for each band). The thresholds of each training input signature define a spectral region
belonging to a certain land cover class.
Spectral signatures of image pixels are compared to the training spectral signatures; a pixel belongs to class X
if pixel spectral signature is completely contained in the spectral region defined by class X. In case of pixels
falling inside overlapping regions or outside any spectral region, it is possible to use additional classification algo-
rithms (i.e. Minimum Distance (page 126), Maximum Likelihood (page 126), Spectral Angle Mapping (page 127))
considering the spectral characteristics of the original input signature.

128 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

In the following image, a scheme illustrates the Land Cover Signature Classification for a simple case of two spectral
bands 𝑥 and 𝑦. User defined spectral regions define three classes (𝑔𝑎 , 𝑔𝑏 , and 𝑔𝑐 ). Point 𝑝1 belongs to class 𝑔𝑎 and
point 𝑝2 belongs to class 𝑔𝑏 . However, point 𝑝3 is inside the spectral regions of both classes 𝑔𝑏 and 𝑔𝑐 (overlapping
regions); in this case, point 𝑝3 will be unclassified or classified according to an additional classification algorithm.
Point 𝑝4 is outside any spectral region, therefore it will be unclassified or classified according to an additional
classification algorithm. Given that point 𝑝4 belongs to class 𝑔𝑐 , the spectral region thereof could be extended to
include point 𝑝4 .

Fig. 9: Land cover signature classification

This is similar to Parallelepiped Classification (page 128), with the exception that spectral regions are defined by
user, and can be assigned independently for the upper and lower bounds. One can imagine spectral regions as the
set of all the spectral signatures of pixels belonging to one class.
In figure Plot of spectral ranges (page 130) the spectral ranges of three classes (𝑔𝑎 , 𝑔𝑏 , and 𝑔𝑐 ) are displayed; the
colored lines inside the ranges (i.e. semi-transparent area) represent the spectral signatures of pixels that defined
the upper and lower bounds of the respective ranges. Pixel 𝑝1 (dotted line) belongs to class 𝑔𝑏 because the spectral
signature thereof is completely inside the range of class 𝑔𝑏 (in the upper limit); pixel 𝑝2 (dashed line) is unclassified
because the spectral signature does not fall completely inside any range; pixel 𝑝3 (dotted line) belongs to class 𝑔𝑎 .
It is worth noticing that these spectral thresholds can be applied to any spectral signature, regardless of spectral
characteristics thereof; this function can be very useful for separating similar spectral signatures that differ only in
one band, defining thresholds that include or exclude specific signatures. In fact, classes are correctly separated
if the spectral ranges thereof are not overlapping at least in one band. Of course, even if spectral regions are
overlapping, chances are that no pixel will fall inside the overlapping region and be misclassified; which is the
upper (or lower) bound of a range do not imply the existence, in the image, of any spectral signature having the
maximum (or minimum) range values for all the bands (for instance pixel 𝑝1 of figure Plot of spectral ranges
(page 130) could not exist).
One of the main benefit of the Land Cover Signature Classification is that it is possible to select pixels and and
include the signature thereof in a spectral range; therefore, the classification should be the direct representation of
the class expected for every spectral signature. This is very suitable for the classification of a single land cover
class (defined by specific spectral thresholds), and leave unclassified the rest of the image that is of no interest for
the purpose of the classification.

4.4. Land Cover Classification 129


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 10: Plot of spectral ranges

Algorithm raster

An algorithm raster represents the “distance” (according to the definition of the classification algorithm) of an
image pixel to a specific spectral signature.
In general, an algorithm raster is produced for every spectral signature used as training input. The value of ev-
ery pixel is the result of the algorithm calculation for a specific spectral signature. Therefore, a pixel belongs to
class X if the value of the algorithm raster corresponding to class X is the lowest in case of Minimum Distance
(page 126) or Spectral Angle Mapping (page 127) (or highest in case of Maximum Likelihood (page 126)).
Given a classification, a combination of algorithm rasters can be produced, in order to create a raster with the
lowest “distances” (i.e. pixels have the value of the algorithm raster corresponding to the class they belong in the
classification). Therefore, this raster can be useful to identify pixels that require the collection of more similar
spectral signatures (see Classification preview (page 35)).

4.4.6 Machine Learning

Machine Learning is a broad set of classification techniques that aim to build mathematical models based on training
data.
In general, Machine Learning algorithms split the data in (ESA, 2019):
• Training Dataset: the sample data used to fit the model;
• Validation Dataset: the sample data used to tune the model parameters to fit on the training dataset;
• Test Dataset: the sample data used to provide an evaluation of the final model;
Usually, the training and model evaluation are performed iteratively.

130 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Random Forest

Random Forest is a particular machine learning technique, based on the iterative and random creation of decision
trees (i.e. a set of rules and conditions that define a class).
First, the input features should be defined, which can be spectral bands or ancillary rasters. Training Areas
(page 124) should be created to define the classes used for training the model.
Random Forest calculates several random decision trees, based on the following parameters:
• number of training samples: is the number of training data (pixels) randomly used to train the model; it
should be set lower than total training input pixels;
• number of trees: is the number of decision trees; the more the number of trees, the more is the model
accuracy, but it also increases the calculation time.
For instance, a decision tree could be defined as:
• class 1 = band 1 > 0.1 –> band 2 < 0.3 –> band 3 > 0.4
• class 2 = band 1 > 0.4 –> band 2 > 0.6 –> band 3 < 0.1
• class 3 = band 1 < 0.7 –> band 2 > 0.1 –> band 3 < 0.5
Random Forest creates several decision trees randomly. Usually, the Gini coefficient is calculated to split the trees.
Therefore, a model based on the decision trees is created and used to classify all the pixels.
A pixel is classified according to the majority vote of decision trees, for example a pixel is classified as class 1 if
most decision trees evaluated it as class 1. Also, a confidence layer is produced, which measures the uncertainty
of the model based on training data.
Random Forest can be used to evaluate the importance of input features, according to the contribution thereof to
the model.

Multi-Layer Perceptron

Multi-Layer Perceptron is a supervised classification algorithm that is based on the definition of an artificial neural
network. A Multi-Layer Perceptron is made of an input layer, one or more hidden layers (made of a defined
number of neurons that are fully connected by non-linear activation functions), and the output layer (also read this
documentation
Several parameters can be defined as described here

Support Vector Machine

Support Vector Machine is a supervised classification algorithm that is based on the calculation of hyperplanes in
order to separate input data values.
Several parameters can be defined as described at this link

4.4.7 Spectral Distance

It is useful to evaluate the spectral distance (or separability) between training signatures or pixels, in order to
assess if different classes that are too similar could cause classification errors. The SCP implements the following
algorithms for assessing similarity of spectral signatures.

4.4. Land Cover Classification 131


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Jeffries-Matusita Distance

Jeffries-Matusita Distance calculates the separability of a pair of probability distributions. This can be particularly
meaningful for evaluating the results of Maximum Likelihood (page 126) classifications.
The Jeffries-Matusita Distance 𝐽𝑥𝑦 is calculated as (Richards and Jia, 2006):

𝐽𝑥𝑦 = 2 1 − 𝑒−𝐵
(︀ )︀

where:
)︂−1 (︃ Σ𝑥 +Σ𝑦
)︃
| |
(︂
1 Σ𝑥 + Σ 𝑦 1
𝐵 = (𝑥 − 𝑦)𝑡 (𝑥 − 𝑦) + ln 1
2
1
8 2 2 |Σ𝑥 | 2 |Σ𝑦 | 2

where:
• 𝑥 = first spectral signature vector;
• 𝑦 = second spectral signature vector;
• Σ𝑥 = covariance matrix of sample 𝑥;
• Σ𝑦 = covariance matrix of sample 𝑦;
The Jeffries-Matusita Distance is asymptotic to 2 when signatures are completely different, and tends to 0 when
signatures are identical.

Spectral Angle

The Spectral Angle is the most appropriate for assessing the Spectral Angle Mapping (page 127) algorithm. The
spectral angle 𝜃 is defined as (Kruse et al., 1993):
(︃ ∑︀𝑛 )︃
−1 𝑖=1 𝑥𝑖 𝑦𝑖
𝜃(𝑥, 𝑦) = cos ∑︀𝑛 1 ∑︀𝑛 1
( 𝑖=1 𝑥2𝑖 ) 2 * ( 𝑖=1 𝑦𝑖2 ) 2

Where:
• 𝑥 = spectral signature vector of an image pixel;
• 𝑦 = spectral signature vector of a training area;
• 𝑛 = number of image bands.
Spectral angle goes from 0 when signatures are identical to 90 when signatures are completely different.

Euclidean Distance

The Euclidean Distance is particularly useful for the evaluating the result of Minimum Distance (page 126) classi-
fications. In fact, the distance is defined as:

⎸ 𝑛
⎸∑︁
𝑑(𝑥, 𝑦) = ⎷ (𝑥𝑖 − 𝑦𝑖 )2
𝑖=1

where:
• 𝑥 = first spectral signature vector;
• 𝑦 = second spectral signature vector;
• 𝑛 = number of image bands.
The Euclidean Distance is 0 when signatures are identical and tends to increase according to the spectral distance
of signatures.

132 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Bray-Curtis Similarity

The Bray-Curtis Similarity is a statistic used for assessing the relationship between two samples (read this). It is
useful in general for assessing the similarity of spectral signatures, and Bray-Curtis Similarity 𝑆(𝑥, 𝑦) is calculated
as:
(︂ ∑︀𝑛 )︂
𝑖=1 |(𝑥𝑖∑︀
− 𝑦𝑖 )|
𝑆(𝑥, 𝑦) = 100 − ∑︀ 𝑛 𝑛 * 100
𝑖=1 𝑥𝑖 + 𝑖=1 𝑦𝑖

where:
• 𝑥 = first spectral signature vector;
• 𝑦 = second spectral signature vector;
• 𝑛 = number of image bands.
The Bray-Curtis similarity is calculated as percentage and ranges from 0 when signatures are completely different
to 100 when spectral signatures are identical.

4.4.8 Classification Result

The result of the classification process is a raster (see an example of Landsat classification in Figure Landsat
classification (page 133)), where pixel values correspond to class IDs and each color represent a land cover class.

Fig. 11: Landsat classification


Data available from the U.S. Geological Survey

A certain amount of errors can occur in the land cover classification (i.e. pixels assigned to a wrong land cover
class), due to spectral similarity of classes, or wrong class definition during the ROI collection.

4.4.9 Accuracy Assessment

After the classification process, it is useful to assess the accuracy of land cover classification, in order to identify
and measure map errors. Usually, accuracy assessment is performed with the calculation of an error matrix, which
is a table that compares map information with reference data (i.e. ground truth data) for a number of sample areas
(Congalton and Green, 2009).
The following table is a scheme of error matrix, where k is the number of classes identified in the land cover
classification, and n is the total number of collected sample units. The items in the major diagonal (aii) are the
number of samples correctly identified, while the other items are classification error.
Scheme of Error Matrix

4.4. Land Cover Classification 133


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Ground truth 1 Ground truth 2 ... Ground truth k Total


Class 1 𝑎11 𝑎12 ... 𝑎1𝑘 𝑎1+
Class 2 𝑎21 𝑎22 ... 𝑎2𝑘 𝑎2+
... ... ... ... ... ...
Class k 𝑎𝑘1 𝑎𝑘2 ... 𝑎𝑘𝑘 𝑎𝑘+
Total 𝑎+1 𝑎+2 ... 𝑎+𝑘 𝑛

Therefore, it is possible to calculate the overall accuracy as the ratio between the number of samples that are
correctly classified (the sum of the major diagonal), and the total number of sample units n (Congalton and Green,
2009).
The overall accuracy (also expressed in percentage) is defined as:
𝑘
∑︁
𝑂= 𝑎𝑖𝑖 /𝑛
𝑖=1

The user’s accuracy for each class is defined as the ratio (also expressed in percentage) between correct samples
and the row total:

𝑈𝑖 = 𝑎𝑖𝑖 /𝑎𝑖+

The commission error 𝐶𝐸𝑖 = 1 − 𝑈𝑖 corresponds to pixels classified as class 𝑖 that actually belong to a different
class.
The producer’s accuracy for each class is calculated as the ratio (also expressed in percentage) between correct
samples and the column total:

𝑃𝑖 = 𝑎𝑖𝑖 /𝑎+𝑖

The omission error 𝑂𝐸𝑖 = 1−𝑃𝑖 corresponds to pixels actually belonging to class 𝑖 that were classified erroneously
as a different class.
It is recommended to calculate the area based error matrix (Olofsson et al., 2014) where each element represents
the estimated area proportion of each class. This allows for estimating the unbiased user’s accuracy and producer’s
accuracy, the unbiased area of classes according to reference data, and the standard error of area estimates.
For further information, the following documentation is freely available: Landsat Data Users Handbook.

4.5 Image processing

Remote sensing images can be processed in various ways in order to obtain classification, indices, or other derived
information that can be useful for land cover characterization.

4.5.1 Principal Component Analysis

Principal Component Analysis (PCA) is a method for reducing the dimensions of measured variables (bands) to
the principal components (JARS, 1993).
Th principal component transformation provides a new set of bands (principal components) having the following
characteristic: principal components are uncorrelated; each component has variance less than the previous com-
ponent. Therefore, this is an efficient method for extracting information and data compression (Ready and Wintz,
1973).
Given an image with N spectral bands, the principal components are obtained by matrix calculation (Ready and
Wintz, 1973; Richards and Jia, 2006):

𝑌 = 𝐷𝑡 𝑋

where:

134 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• 𝑌 = vector of principal components


• 𝐷 = matrix of eigenvectors of the covariance matrix 𝐶𝑥 in X space
• 𝑡 denotes vector transpose
And 𝑋 is calculated as:
𝑋 =𝑃 −𝑀
• 𝑃 = vector of spectral values associated with each pixel
• 𝑀 = vector of the mean associated with each band
Thus, the mean of 𝑋 associated with each band is 0. 𝐷 is formed by the eigenvectors (of the covariance matrix
𝐶𝑥 ) ordered as the eigenvalues from maximum to minimum, in order to have the maximum variance in the first
component. This way, the principal components are uncorrelated and each component has variance less than the
previous component(Ready and Wintz, 1973).
Usually the first two components contain more than the 90% of the variance. For example, the first principal
components can be displayed in a Color Composite (page 122) for highlighting Land Cover (page 116) classes, or
used as input for Supervised Classification (page 122).

4.5.2 Pan-sharpening

Pan-sharpening is the combination of the spectral information of multispectral bands (MS), which have lower
spatial resolution (for Landsat bands, spatial resolution is 30m), with the spatial resolution of a panchromatic band
(PAN), which for Landsat 7 and 8 it is 15m. The result is a multispectral image with the spatial resolution of the
panchromatic band (e.g. 15m). In SCP, a Brovey Transform is applied, where the pan-sharpened values of each
multispectral band are calculated as (Johnson, Tateishi and Hoan, 2012):
𝑀 𝑆𝑝𝑎𝑛 = 𝑀 𝑆 * 𝑃 𝐴𝑁/𝐼
where 𝐼 is Intensity, which is a function of multispectral bands.
The following weights for I are defined, basing on several tests performed using the SCP. For Landsat 8, Intensity
is calculated as:
𝐼 = (0.42 * 𝐵𝑙𝑢𝑒 + 0.98 * 𝐺𝑟𝑒𝑒𝑛 + 0.6 * 𝑅𝑒𝑑)/2
For Landsat 7, Intensity is calculated as:
𝐼 = (0.42 * 𝐵𝑙𝑢𝑒 + 0.98 * 𝐺𝑟𝑒𝑒𝑛 + 0.6 * 𝑅𝑒𝑑 + 𝑁 𝐼𝑅)/3

4.5.3 Spectral Indices

Spectral indices are operations between spectral bands that are useful for extracting information such as vegetation
cover (JARS, 1993). One of the most popular spectral indices is the Normalized Difference Vegetation Index
(NDVI), defined as (JARS, 1993):
𝑁 𝐷𝑉 𝐼 = (𝑁 𝐼𝑅 − 𝑅𝑒𝑑)/(𝑁 𝐼𝑅 + 𝑅𝑒𝑑)
NDVI values range from -1 to 1. Dense and healthy vegetation show higher values, while non-vegetated areas show
low NDVI values.
Another index is the Enhanced Vegetation Index (EVI) which attempts to account for atmospheric effects such
as path radiance calculating the difference between the blue and the red bands (Didan,et al., 2015). EVI is defined
as:
𝐸𝑉 𝐼 = 𝐺(𝑁 𝐼𝑅 − 𝑅𝑒𝑑)/(𝑁 𝐼𝑅 + 𝐶1 𝑅𝑒𝑑 − 𝐶2 𝐵𝑙𝑢𝑒 + 𝐿)
where: 𝐺 is a scaling factor, 𝐶1 and 𝐶2 are coefficients for the atmospheric effects, and 𝐿 is a factor for accounting
the differential NIR and Red radiant transfer through the canopy. Typical coefficient values are: 𝐺 = 2.5, 𝐿 = 1,
𝐶1 = 6, 𝐶2 = 7.5 (Didan,et al., 2015).

4.5. Image processing 135


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 12: Example of pan-sharpening of a Landsat 8 image. Left, original multispectral bands (30m); right, pan-
sharpened bands (15m)
Data available from the U.S. Geological Survey

4.5.4 Clustering

Clustering is the grouping of pixels based on spectral similarity (e.g. Euclidean Distance (page 132) or Spectral
Angle (page 132)) calculated for a multispectral image (Richards and Jia, 2006).
Clustering can be used for unsupervised classification or for the automatic selection of spectral signatures. It is
worth noticing that, while Supervised Classification (page 122) produces a classification whit the classes identified
during the training process, the classes produced by clustering (i.e. clusters) have no definition and consequently
the user must assign a land cover label to each class.
The main advantage of clustering resides in automation. Of course, clusters do not necessarily represent a particular
land cover type and additional processing could be required for producing an accurate classification.
There are several types of clustering, mainly based on iterative methods; the following are the algorithms provided
in SCP.

K-means

The K-means method is based on the calculation of the average spectral signature of clusters (Wikipedia, 2017;
JARS, 1993).
At first, the user defines the number of clusters expected in the image, which correspond to as many spectral
signatures (i.e. seeds). Starting spectral signatures can be selected in various ways (e.g. randomly, provided by the
user, calculated automatically from image values).
During the first iteration clusters are produced calculating the pixel spectral distance with initial spectral signatures.
The algorithms Euclidean Distance (page 132) or Spectral Angle (page 132) can be used for distance calculation.
Pixels are assigned according to the most similar spectral signature, therefore producing clusters.
Then, the average spectral signature is calculated for each cluster of pixels, resulting in the spectral signatures that
will be used in the following iteration.
This process continues iteratively producing clusters and mean spectral signatures, until one of the following con-
dition is verified:
• the spectral distance between the spectral signatures produced in this iteration with the corresponding ones
produced in the previous iteration is lower than a certain threshold;

136 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• the maximum number of iterations is reached.


After the last iteration, a raster of clusters is produced using the spectral signatures derived from the last iteration.

ISODATA

The ISODATA (Iterative Self-Organizing Data Analysis Technique) method is similar to K-means but with the
additional steps of merging clusters having similar spectral signatures and splitting clusters having too high vari-
ability (i.e. standard deviation) of spectral signatures (Ball & Hall, 1965). Following, the SCP implementation of
ISODATA is described.
At first, the user defines the number of clusters expected in the image, which correspond to as many spectral
signatures (i.e. seeds). Starting spectral signatures can be selected in various ways (e.g. randomly, provided by the
user, calculated automatically from image values). Initial parameters provided by user are:
• 𝐶 = number of desired clusters
• 𝑁𝑚𝑖𝑛 = minimum number of pixels for a cluster
• 𝜎𝑡 = maximum standard deviation threshold for splitting
• 𝐷𝑡 = distance threshold for merging
During the first iteration clusters are produced calculating the Euclidean Distance (page 132) of pixels with ini-
tial spectral signatures. Pixels are assigned according to the most similar spectral signature, therefore producing
clusters.
Therefore, the following parameters are calculated:
• 𝑁𝑖 = number of pixels of cluster 𝑖
• 𝑆𝑖 = average spectral signature of cluster 𝑖
• 𝐴𝑉 𝐸𝑅𝐴𝐺𝐸𝐷𝐼𝑆𝑇𝑖 = average distance of cluster 𝑖 with the seed spectral signature
• 𝐴𝑉 𝐸𝑅𝐴𝐺𝐸𝐷𝐼𝑆𝑇 𝐴𝑁 𝐶𝐸 = overall average distance of all clusters
• 𝜎𝑖𝑗 = standard deviation of cluster 𝑖 in band 𝑗
• 𝜎𝑚𝑎𝑥𝑖 = maximum standard deviation of cluster 𝑖 (i.e. 𝑚𝑎𝑥(𝜎𝑖𝑗 ))
• 𝑘𝑖 = band where 𝜎𝑚𝑎𝑥𝑖 occurred
• 𝑆𝑘𝑖 = value of 𝑆𝑖 at band 𝑘𝑖
• 𝑃 = number of clusters
Then, for each cluster 𝑖, if 𝑁𝑖 < 𝑁𝑚𝑖𝑛 , then the cluster 𝑖 is discarded.
If 𝑃 <= 𝐶 then try to split clusters. For each cluster 𝑖:
• If 𝜎𝑚𝑎𝑥𝑖 > 𝜎𝑡 :
– If ((𝐴𝑉 𝐸𝑅𝐴𝐺𝐸𝐷𝐼𝑆𝑇𝑖 > 𝐴𝑉 𝐸𝑅𝐴𝐺𝐸𝐷𝐼𝑆𝑇 𝐴𝑁 𝐶𝐸) AND (𝑁𝑖 > (2 * 𝑁𝑚𝑖𝑛 + 2) )) OR (𝐶 > 2 *
𝑃 ):
∗ create a new spectral signature 𝑆𝑝+1 = 𝑆𝑖
∗ in 𝑆𝑖 set the value 𝑆𝑘𝑖 = 𝑆𝑘𝑖 + 𝜎𝑚𝑎𝑥𝑖
∗ in 𝑆𝑝+1 set the value 𝑆𝑘𝑝+1 = 𝑆𝑘𝑖 - 𝜎𝑚𝑎𝑥𝑖
∗ 𝑃 =𝑃 +1
∗ start a new iteration
If 𝑃 > (2 * 𝐶) then try to merge clusters.
• For each combination 𝑥𝑦 of spectral signatures calculate 𝐷𝑥𝑦 = Euclidean Distance (page 132) of spectral
signatures 𝑆𝑥 and 𝑆𝑦 .
• If the minimum 𝐷𝑥𝑦 is greater than 𝐷𝑡 :

4.5. Image processing 137


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

– S_{i} = (𝑁𝑖 * S_{i} + 𝑁𝑗 * S_{j})/(𝑁𝑖 + 𝑁𝑗 )


– discard S_{j}
– 𝑃 =𝑃 -1
– start a new iteration
After the last iteration, a raster of clusters is produced using the spectral signatures derived from the last iteration.
The number of clusters can vary according to the processes of splitting and merging.

4.6 Image conversion to reflectance

This chapter provides information about the conversion to reflectance implemented in SCP.

4.6.1 Radiance at the Sensor’s Aperture

Radiance is the “flux of energy (primarily irradiant or incident energy) per solid angle leaving a unit surface area
in a given direction”, “Radiance is what is measured at the sensor and is somewhat dependent on reflectance”
(NASA, 2011, p. 47).
Images such as Landsat or Sentinel-2 are composed of several bands and a metadata file which contains information
required for the conversion to reflectance.
Landsat images are provided in radiance, scaled prior to output. For Landsat images Spectral Radiance at the
sensor’s aperture (𝐿𝜆 , measured in [watts/(meter squared * ster * 𝜇𝑚)]) is given by (https://www.usgs.gov/
core-science-systems/nli/landsat/using-usgs-landsat-level-1-data-product):

𝐿𝜆 = 𝑀𝐿 * 𝑄𝑐𝑎𝑙 + 𝐴𝐿

where:
• 𝑀𝐿 = Band-specific multiplicative rescaling factor from Landsat metadata (RADIANCE_MULT_BAND_x,
where x is the band number)
• 𝐴𝐿 = Band-specific additive rescaling factor from Landsat metadata (RADIANCE_ADD_BAND_x, where
x is the band number)
• 𝑄𝑐𝑎𝑙 = Quantized and calibrated standard product pixel values (DN)
Sentinel-2 images (Level-1C) are already provided in Top Of Atmosphere (TOA) Reflectance (page 138), scaled
prior to output (ESA, 2015).

4.6.2 Top Of Atmosphere (TOA) Reflectance

Images in radiance can be converted to Top Of Atmosphere (TOA) Reflectance (combined surface and atmospheric
reflectance) in order to reduce the in between-scene variability through a normalization for solar irradiance. This
TOA reflectance (𝜌𝑝 ), which is the unitless ratio of reflected versus total power energy (NASA, 2011), is calculated
by:

𝜌𝑝 = (𝜋 * 𝐿𝜆 * 𝑑2 )/(𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 )

where:
• 𝐿𝜆 = Spectral radiance at the sensor’s aperture (at-satellite radiance)
• 𝑑 = Earth-Sun distance in astronomical units (provided with Landsat 8 metadata file, and an excel file is
available from http://landsathandbook.gsfc.nasa.gov/excel_docs/d.xls )
• 𝐸𝑆𝑈 𝑁𝜆 = Mean solar exo-atmospheric irradiances

138 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• 𝜃𝑠 = Solar zenith angle in degrees, which is equal to 𝜃𝑠 = 90° - 𝜃𝑒 where 𝜃𝑒 is the Sun elevation
It is worth pointing out that Landsat 8 images are provided with band-specific rescaling factors that allow for the
direct conversion from DN to TOA reflectance.
Sentinel-2 images are already provided in scaled TOA reflectance, which can be converted to TOA reflectance
with a simple calculation using the Quantification Value provided in the metadata (see https://sentinel.esa.int/
documents/247904/349490/S2_MSI_Product_Specification.pdf ).
Sentinel-3 images are already provided in scaled TOA radiance. Conversion to reflectance is performed apply-
ing the coefficients scale_factor and add_offset provided in the metadata of each band. The ancillary raster
tie_geometries.nc provides the value of sun zenith angle and the ancillary raster instrument_data pro-
vides information about the solar flux for each band, which are used for the conversion to reflectance with the
correction for sun angle. In addition, the georeferencing of the bands is performed using the ancillary raster
geo_coordinates.nc which provides coordinates of every pixel.

4.6.3 Surface Reflectance

The effects of the atmosphere (i.e. a disturbance on the reflectance that varies with the wavelength) should be
considered in order to measure the reflectance at the ground.
As described by Moran et al. (1992), the land surface reflectance (𝜌) is:

𝜌 = [𝜋 * (𝐿𝜆 − 𝐿𝑝 ) * 𝑑2 ]/[𝑇𝑣 * ((𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 * 𝑇𝑧 ) + 𝐸𝑑𝑜𝑤𝑛 )]

where:
• 𝐿𝑝 is the path radiance
• 𝑇𝑣 is the atmospheric transmittance in the viewing direction
• 𝑇𝑧 is the atmospheric transmittance in the illumination direction
• 𝐸𝑑𝑜𝑤𝑛 is the downwelling diffuse irradiance
Therefore, we need several atmospheric measurements in order to calculate 𝜌 (physically-based corrections). Al-
ternatively, it is possible to use image-based techniques for the calculation of these parameters, without in-situ
measurements during image acquisition. It is worth mentioning that Landsat Surface Reflectance High Level
Data Products for Landsat 8 are available (for more information read http://landsat.usgs.gov/CDR_LSR.php).

4.6.4 DOS1 Correction

The Dark Object Subtraction (DOS) is a family of image-based atmospheric corrections. Chavez (1996) explains
that “the basic assumption is that within the image some pixels are in complete shadow and their radiances received
at the satellite are due to atmospheric scattering (path radiance). This assumption is combined with the fact that
very few targets on the Earth’s surface are absolute black, so an assumed one-percent minimum reflectance is better
than zero percent”. It is worth pointing out that the accuracy of image-based techniques is generally lower than
physically-based corrections, but they are very useful when no atmospheric measurements are available as they can
improve the estimation of land surface reflectance. The path radiance is given by (Sobrino et al., 2004):

𝐿𝑝 = 𝐿𝑚𝑖𝑛 − 𝐿𝐷𝑂1%

where:
• 𝐿𝑚𝑖𝑛 = “radiance that corresponds to a digital count value for which the sum of all the pixels with digital
counts lower or equal to this value is equal to the 0.01% of all the pixels from the image considered” (Sobrino
et al., 2004, p. 437), therefore the radiance obtained with that digital count value (𝐷𝑁𝑚𝑖𝑛 )
• 𝐿𝐷𝑂1% = radiance of Dark Object, assumed to have a reflectance value of 0.01
In particular for Landsat images:

𝐿𝑚𝑖𝑛 = 𝑀𝐿 * 𝐷𝑁𝑚𝑖𝑛 + 𝐴𝐿

4.6. Image conversion to reflectance 139


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Sentinel-2 images are converted to radiance prior to DOS1 calculation.


The radiance of Dark Object is given by (Sobrino et al., 2004):

𝐿𝐷𝑂1% = 0.01 * [(𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 * 𝑇𝑧 ) + 𝐸𝑑𝑜𝑤𝑛 ] * 𝑇𝑣 /(𝜋 * 𝑑2 )

Therefore the path radiance is:

𝐿𝑝 = 𝑀𝐿 * 𝐷𝑁𝑚𝑖𝑛 + 𝐴𝐿 − 0.01 * [(𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 * 𝑇𝑧 ) + 𝐸𝑑𝑜𝑤𝑛 ] * 𝑇𝑣 /(𝜋 * 𝑑2 )

There are several DOS techniques (e.g. DOS1, DOS2, DOS3, DOS4), based on different assumption about 𝑇𝑣 ,
𝑇𝑧 , and 𝐸𝑑𝑜𝑤𝑛 . The simplest technique is the DOS1, where the following assumptions are made (Moran et al.,
1992):
• 𝑇𝑣 = 1
• 𝑇𝑧 = 1
• 𝐸𝑑𝑜𝑤𝑛 = 0
Therefore the path radiance is:

𝐿𝑝 = 𝑀𝐿 * 𝐷𝑁𝑚𝑖𝑛 + 𝐴𝐿 − 0.01 * 𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 /(𝜋 * 𝑑2 )

And the resulting land surface reflectance is given by:

𝜌 = [𝜋 * (𝐿𝜆 − 𝐿𝑝 ) * 𝑑2 ]/(𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 )

ESUN [W /(m2 * 𝜇𝑚)] values for Landsat sensors are provided in the following table.
ESUN values for Landsat bands

Band Landsat 1 Landsat 2 Landsat 3 Landsat 4 Landsat 5 Landsat 7


MSS* MSS* MSS* TM* TM* ETM+**
1 1983 1983 1970
2 1795 1796 1842
3 1539 1536 1547
4 1823 1829 1839 1028 1031 1044
5 1559 1539 1555 219.8 220 225.7
6 1276 1268 1291
7 880.1 886.6 887.9 83.49 83.44 82.06
8 1369

* from Chander, Markham, & Helder (2009)


** from http://landsathandbook.gsfc.nasa.gov/data_prod/prog_sect11_3.html

For Landsat 8, 𝐸𝑆𝑈 𝑁 can be calculated as (from http://grass.osgeo.org/grass65/manuals/i.landsat.toar.html ):

𝐸𝑆𝑈 𝑁 = (𝜋 * 𝑑2 ) * 𝑅𝐴𝐷𝐼𝐴𝑁 𝐶𝐸_𝑀 𝐴𝑋𝐼𝑀 𝑈 𝑀/𝑅𝐸𝐹 𝐿𝐸𝐶𝑇 𝐴𝑁 𝐶𝐸_𝑀 𝐴𝑋𝐼𝑀 𝑈 𝑀

where RADIANCE_MAXIMUM and REFLECTANCE_MAXIMUM are provided by image metadata.


ESUN [W /(m2 * 𝜇𝑚)] values for Sentinel-2 sensor (provided in image metadata) are illustrated in the following
table.
ESUN values for Sentinel-2 bands

140 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Band Sentinel-2
1 1913.57
2 1941.63
3 1822.61
4 1512.79
5 1425.56
6 1288.32
7 1163.19
8 1036.39
8A 955.19
9 813.04
10 367.15
11 245.59
12 85.25

ESUN [W /(m2 * 𝜇𝑚)] values for ASTER sensor are illustrated in the following table (from Finn et al., 2012).
ESUN values for ASTER bands

Band ASTER
1 1848
2 1549
3 1114
4 225.4
5 86.63
6 81.85
7 74.85
8 66.49
9 59.85

An example of comparison of to TOA reflectance, DOS1 corrected reflectance and the Landsat Surface Reflectance
High Level Data Products (ground truth) is provided in Figure Spectral signatures of a built-up pixel (page 141).

Fig. 13: Spectral signatures of a built-up pixel


Comparison of TOA reflectance, DOS1 corrected reflectance and Landsat Surface Reflectance High
Level Data Products

4.6. Image conversion to reflectance 141


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

4.7 Conversion to Temperature

This chapter provides the basic information about the conversion to At-Satellite Brightness Temperature imple-
mented in SCP and the estimation of Land Surface Temperature.

4.7.1 Conversion to At-Satellite Brightness Temperature

For thermal bands, the conversion of DN to At-Satellite Brightness Temperature is given by (from https://www.
usgs.gov/core-science-systems/nli/landsat/using-usgs-landsat-level-1-data-product ):

𝑇𝐵 = 𝐾2 /𝑙𝑛[(𝐾1 /𝐿𝜆 ) + 1]

where:
• 𝐾1 = Band-specific thermal conversion constant (in watts/meter squared * ster * 𝜇𝑚)
• 𝐾2 = Band-specific thermal conversion constant (in kelvin)
and 𝐿𝜆 is the Spectral Radiance at the sensor’s aperture, measured in watts/(meter squared * ster * 𝜇𝑚).
The 𝐾1 and 𝐾2 constants for Landsat sensors are provided in the following table.
Thermal Conversion Constants for Landsat

Constant Landsat 4* Landsat 5* Landsat 7**


𝐾1 671.62 607.76 666.09
𝐾2 1284.30 1260.56 1282.71

* from Chander & Markham (2003)


** from NASA (2011)

For Landsat 8, the 𝐾1 and 𝐾2 values are provided in the image metadata file.

𝐾1 and 𝐾2 are calculated as (Jimenez-Munoz & Sobrino, 2010):

𝐾1 = 𝑐1 /𝜆5

𝐾2 = 𝑐2 /𝜆
where (Mohr, Newell, & Taylor, 2015):
• 𝑐1 = first radiation constant = 1.191 * 10−16 𝑊 𝑚2 𝑠𝑟−1
• 𝑐2 = second radiation constant = 1.4388 * 10−2 𝑚𝐾
Therefore, for ASTER bands 𝐾1 and 𝐾2 are provided in the following table.
Thermal Conversion Constants for ASTER

Constant Band 10 Band 11 Band 12 Band 13 Band 14


3 3 3 2
𝐾1 3.024 * 10 2.460 * 10 1.909 * 10 8.900 * 10 6.464 * 102
𝐾2 1.733 * 103 1.663 * 103 1.581 * 103 1.357 * 103 1.273 * 103

142 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

4.7.2 Estimation of Land Surface Temperature

Several studies have described the estimation of Land Surface Temperature. Land Surface Temperature can be
calculated from At-Satellite Brightness Temperature 𝑇𝐵 as (Weng et al., 2004):

𝑇 = 𝑇𝐵 /[1 + (𝜆 * 𝑇𝐵 /𝑐2 ) * 𝑙𝑛(𝑒)]

where:
• 𝜆 = wavelength of emitted radiance
• 𝑐2 = ℎ * 𝑐/𝑠 = 1.4388 * 10−2 m K
• ℎ = Planck’s constant = 6.626 * 10−34 J s
• 𝑠 = Boltzmann constant = 1.38 * 10−23 J/K
• 𝑐 = velocity of light = 2.998 * 108 m/s
The values of 𝜆 for the thermal bands of Landsat and ASTER satellites can be calculated from the tables in Landsat
Satellites (page 117) and ASTER Satellite (page 119).
Several studies used NDVI for the estimation of land surface emissivity (Sobrino et al., 2004); other studies used
a land cover classification for the definition of the land surface emissivity of each class (Weng et al. 2004). For
instance, the emissivity (𝑒) values of various land cover types are provided in the following table (from Mallick et
al., 2012).
Emissivity values

Land surface Emissivity e


Soil 0.928
Grass 0.982
Asphalt 0.942
Concrete 0.937

4.8 References

• Ball, G. H. & Hall, D. J., 1965. ISODATA. A novel method of data analysis and pattern classification. Menlo
Park: Stanford Research Institute.
• Chander, G. & Markham, B., 2003. Revised Landsat-5 TM radiometric calibration procedures and postcal-
ibration dynamic ranges Geoscience and Remote Sensing, IEEE Transactions on, 41, 2674 - 2677
• Chavez, P. S., 1996. Image-Based Atmospheric Corrections - Revisited and Improved Photogrammetric
Engineering and Remote Sensing, [Falls Church, Va.] American Society of Photogrammetry, 62, 1025-
1036
• Congalton, R. and Green, K., 2009. Assessing the Accuracy of Remotely Sensed Data: Principles and
Practices. Boca Raton, FL: CRC Press
• Didan, K.; Barreto Munoz, A.; Solano, R. & Huete, A., 2015. MODIS Vegetation Index User’s Guide.
Collection 6, NASA
• ESA, 2020. Sentinel-1 SAR Definitions. Available at https://sentinel.esa.int/web/sentinel/user-guides/
sentinel-1-sar/definitions
• ESA, 2020b. Sentinel-1 SAR Definitions. Available at https://sentinel.esa.int/web/sentinel/user-guides/
sentinel-1-sar/overview
• ESA, 2019. A machine learning glossary. Available at https://blogs.esa.int/philab/2019/03/29/
a-machine-learning-glossary/

4.8. References 143


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• ESA, 2015. Sentinel-2 User Handbook. Available at https://sentinels.copernicus.eu/documents/247904/


685211/Sentinel-2_User_Handbook
• ESA, 2013. Sentinel-3 User Handbook. Available at https://sentinels.copernicus.eu/documents/247904/
685236/Sentinel-3_User_Handbook
• Finn, M.P., Reed, M.D, and Yamamoto, K.H., 2012. A Straight Forward Guide for Process-
ing Radiance and Reflectance for EO-1 ALI, Landsat 5 TM, Landsat 7 ETM+, and ASTER.
Unpublished Report from USGS/Center of Excellence for Geospatial Information Science, 8 p,
http://cegis.usgs.gov/soil_moisture/pdf/A%20Straight%20Forward%20guide%20for%20Processing%
20Radiance%20and%20Reflectance_V_24Jul12.pdf
• Fisher, P. F. and Unwin, D. J., eds., 2005. Representing GIS. Chichester, England: John Wiley & Sons
• JARS, 1993. Remote Sensing Note. Japan Association on Remote Sensing. Available at http://www.
jars1974.net/pdf/rsnote_e.html
• Jimenez-Munoz, J. C. & Sobrino, J. A., 2010. A Single-Channel Algorithm for Land-Surface Temperature
Retrieval From ASTER Data IEEE Geoscience and Remote Sensing Letters, 7, 176-179
• Johnson, B. A., Tateishi, R. and Hoan, N. T., 2012. Satellite Image Pansharpening Using a Hybrid Approach
for Object-Based Image Analysis ISPRS International Journal of Geo-Information, 1, 228. Available at
http://www.mdpi.com/2220-9964/1/3/228)
• Kruse, F. A., et al., 1993. The Spectral Image Processing System (SIPS) - Interactive Visualization and
Analysis of Imaging spectrometer. Data Remote Sensing of Environment
• Mallick, J.; Singh, C. K.; Shashtri, S.; Rahman, A. & Mukherjee, S., 2012. Land surface emissivity re-
trieval based on moisture index from LANDSAT TM satellite data over heterogeneous surfaces of Delhi city
International Journal of Applied Earth Observation and Geoinformation, 19, 348 - 358
• Mohr, P. J.; Newell, D. B. & Taylor, B. N., 2015. CODATA Recommended Values of the Fundamental
Physical Constants: 2014 National Institute of Standards and Technology, Committee on Data for Science
and Technology
• Moran, M.; Jackson, R.; Slater, P. & Teillet, P., 1992. Evaluation of simplified procedures for retrieval of
land surface reflectance factors from satellite sensor output Remote Sensing of Environment, 41, 169-184
• NASA, 2020. What is Synthetic Aperture Radar?. Available at https://earthdata.nasa.gov/learn/what-is-sar
• NASA, 2013. Landsat 7 Science Data User’s Handbook. Available at https://www.usgs.gov/land-resources/
nli/landsat/landsat-7-data-users-handbook
• NASA, 2011. Landsat 7 Science Data Users Handbook Landsat Project Science Office at NASA’s Goddard
Space Flight Center in Greenbelt, 186 http://landsathandbook.gsfc.nasa.gov/pdfs/Landsat7_Handbook.pdf
• NOAA, 2020. GOES-R Series. Available at https://www.ncdc.noaa.gov/data-access/satellite-data/
goes-r-series-satellites
• Olofsson, P.; Foody, G. M.; Herold, M.; Stehman, S. V.; Woodcock, C. E. & Wulder, M. A., 2014. Good
practices for estimating area and assessing accuracy of land change. Remote Sensing of Environment, 148,
42 – 57
• Ready, P. and Wintz, P., 1973. Information Extraction, SNR Improvement, and Data Compression in Multi-
spectral Imagery. IEEE Transactions on Communications, 21, 1123-1131
• Richards, J. A. and Jia, X., 2006. Remote Sensing Digital Image Analysis: An Introduction. Berlin, Ger-
many: Springer
• Sobrino, J.; Jiménez-Muñoz, J. C. & Paolini, L., 2004. Land surface temperature retrieval from LANDSAT
TM 5 Remote Sensing of Environment, Elsevier, 90, 434-440
• USGS, 2015. Advanced Spaceborne Thermal Emission and Reflection Radiometer (ASTER) Level 1 Pre-
cision Terrain Corrected Registered At-Sensor Radiance Product (AST_L1T). AST_L1T Product User’s
Guide. USGS EROS Data Center.
• Vermote, E. F.; Roger, J. C. & Ray, J. P., 2015. MODIS Surface Reflectance User’s Guide. Collection 6,
NASA

144 Chapter 4. Brief Introduction to Remote Sensing


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• Weng, Q.; Lu, D. & Schubring, J., 2004. Estimation of land surface temperature–vegetation abundance
relationship for urban heat island studies. Remote Sensing of Environment, Elsevier Science Inc., Box 882
New York NY 10159 USA, 89, 467-483
• Wikipedia, 2017. k-means clustering. Available at https://en.wikipedia.org/wiki/K-means_clustering

4.8. References 145


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

146 Chapter 4. Brief Introduction to Remote Sensing


CHAPTER

FIVE

BASIC TUTORIALS

The following are very basic tutorials for land cover classification using the Semi-Automatic Classification Plugin
(SCP). It is assumed that you have a basic knowledge of QGIS (you can find a guide to QGIS interface at this page).

5.1 Tutorial 1

The following is a basic tutorial about the land cover classification using the Semi-Automatic Classification Plugin
(SCP). It is assumed that you have a basic knowledge of QGIS. Following the video of the tutorial.
https://www.youtube.com/watch?v=7SZDCFXjIbA

• Tutorial 1: Basic Land Cover Classification (page 147)


– Download the Data (page 148)
– Define the Band set and create the Training Input File (page 148)
– Create the ROIs (page 150)
– Create a Classification Preview (page 154)
– Create the Classification Output (page 160)

5.1.1 Tutorial 1: Basic Land Cover Classification

This is a basic tutorial about the use of SCP for the classification of a multispectral image. It is recommended to
read the Brief Introduction to Remote Sensing (page 113) before following this tutorial.
The purpose of the classification is to identify the following land cover classes:
1. Water;
2. Built-up;
3. Vegetation;
4. Soil.
The basic steps are:
1. the definition of input data (image bands) in a Band set (page 36);
2. the creation of a Training input (page 24) to collect training areas to train the classification algorith;
3. the Classification (page 64) of input data.

147
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Download the Data

Other tutorials will show how to search and download satellite images within SCP. In this tutorial we are going
to use a Sentinel-2 Satellite (page 118) image, already converted to reflectance and clipped to the study area,
downloading a .zip file (which contains modified Copernicus Sentinel data 2023).
The study area of this tutorial covers part of the Lake Garda in the Northern Italy. Download the .zip file from
this link and extract the directory containing the image bands.

Define the Band set and create the Training Input File

We are going to use a subset of Sentinel-2 Satellite (page 118) image (Copernicus land monitoring services) and
use the bands illustrated in the following table.

Sentinel-2 Bands Central Wavelength [micrometers] Resolution [meters]


Band 2 - Blue 0.490 10
Band 3 - Green 0.560 10
Band 4 - Red 0.665 10
Band 5 - Vegetation Red Edge 0.705 20
Band 6 - Vegetation Red Edge 0.740 20
Band 7 - Vegetation Red Edge 0.783 20
Band 8 - NIR 0.842 10
Band 8A - Vegetation Red Edge 0.865 20
Band 11 - SWIR 1.610 20
Band 12 - SWIR 2.190 20

First, we need to define the Band set which is the input image for SCP classification. Open the tab Band set

(page 36) clicking the button in the SCP menu (page 21) or the SCP dock (page 22).

Click the button to select the .tif files from the extracted directory to the Band set tab.

Tip: It is possible to define multiple Band sets. It is also possible to add to a Band set bands that are already
loaded in QGIS. Each Band set definition is saved with the QGIS project.

In the table Band set definition, we need to order the band names in ascending order and assign the center wavelength
to each bands (required for spectral signature calculation). We can do this in one step by selecting Sentinel-2 in the
Wavelength list of the Band quick settings (page 38).
We can display a Color Composite (page 122) of bands: Near-Infrared, Red, and Green.

Tip: If a Band set (page 36) is defined, a temporary virtual raster (named Virtual Band Set 1) is created
automatically, which allows for the display of a Color Composite (page 122).

In the Working toolbar (page 32), click the list RGB= and select the item 7-3-2 (corresponding to the band numbers
in Band set (page 36)). You can see that Virtual Band Set 1 is added to QGIS Layers as multiband image, and
the displayed bands correspond to the selected color composite.
Because we selected Near-Infrared, Red, and Green bands, in the map, vegetation is highlighted in red. Selecting
the color composite 3-2-1, natural colors would be displayed.
After Band set (page 36) creation, we need to create a Training input (page 24) file in order to collect Training
Areas (page 124) (ROIs) and calculate the Spectral Signature (page 116) thereof (which are required to train the
classification algorithm).

148 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 1: Definition of a band set

Fig. 2: Color composite RGB=7-3-2

5.1. Tutorial 1 149


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

In the SCP dock (page 22) select the tab Training input (page 24) and click the button to create the Training
input (define a name such as training.scpx).

Tip: A Training input is a .scpx file which stores the geometries and the spectral signatures. Once it is created,
it is configured with the wavelength properties of the corresponding Band set. To use a Training input create with

a different Band set, one should create a new Training input, and then import the existing Training input with
Import library file (page 45) .

The path of the file is displayed and a vector is added to QGIS layers with the same name as the Training input.

Warning: In order to prevent data loss, one should not edit the Training input using QGIS vector tools.

Create the ROIs

We are going to create ROIs defining the Classes and Macroclasses (page 124). Each ROI is identified by a Class
ID (i.e. C ID), and each ROI is assigned to a land cover class through a Macroclass ID (i.e. MC ID).
Macroclasses are composed of several materials having different spectral signatures; in order to achieve good
classification results we should separate spectral signatures of different materials, even if belonging to the same
macroclass. Thus, we are going to create several ROIs for each macroclass (setting the same MC ID, but assigning
a different C ID to every ROI).
We are going to use the Macroclass IDs defined in the following table.

Macroclass name Macroclass ID


Water 1
Built-up 2
Vegetation 3
Soil 4

Tip: ROIs can be created by manually drawing a polygon or with an automatic region growing algorithm.

In the map zoom over the dark blue area in the upper left corner of the image which is a water body. To manually

create a ROI inside the dark area, click the button in the Working toolbar (page 32). Left click on the map
to define the ROI vertices and right click to define the last vertex closing the polygon. An orange semi-transparent
polygon is displayed over the image, which is a temporary polygon (i.e., it is not saved in the Training input
(page 24)).

Tip: You can draw temporary polygons (the previous one will be overridden) until the shape covers the intended
area.

If the shape of the temporary polygon sufficiently covers the water area, we can save it to the Training input
(page 24).
Open the Training input (page 24) to define the Classes and Macroclasses (page 124) . In the ROI & Signature list

(page 27) set MC ID = 1 and MC Name = Water; also set C ID = 1 and C Name = Lake. Now click to save
the ROI in the Training input.

150 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 3: Definition of Training input in SCP

5.1. Tutorial 1 151


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 4: A temporary ROI created manually

After a few seconds, the ROI is listed in the ROI & Signature list (page 27) and the spectral signature is calculated

(because Signature is checked).


As you can see, the C ID in ROI & Signature list (page 27) is automatically increased by 1. Saved ROI is displayed
as a dark polygon in the map and the temporary ROI is removed. Also, in the ROI & Signature list (page 27)
you can notice that the Type is RS (i.e., ROI and spectral signature), meaning that the ROI spectral signature was
calculated and saved in the Training input.
Now we are going to create a second ROI for the built-up class using the automatic region growing algorithm.
Zoom near the center of the image. In Working toolbar (page 32) set the Dist value to 0.03 . Click the button

in the Working toolbar (page 32) and click over the light blue area of the map. After a while the orange
semi-transparent polygon is displayed over the image.

Tip: Dist value should be set according to the range of pixel values; in general, increasing this value creates larger
ROIs.

In the ROI & Signature list (page 27) set MC ID = 2 and MC Name = Built-up ; also set C ID = 2 (it should be
already set) and C Name = Buildings.
Again, the C ID in ROI & Signature list (page 27) is automatically increased by 1.
Create a ROI for the class Vegetation (red pixels in color composite RGB=7-3-2) and a ROI for the class Soil
(bare soil or low vegetation) (yellow pixels in color composite RGB=7-3-2) following the same steps
described previously. The following images show a few examples of these classes identified in the map.

Tip: It is possible to display the Spectral signatures of created ROIs in the Spectral Signature Plot (page 103).

152 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 5: The ROI saved in the Training input

5.1. Tutorial 1 153


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 6: A temporary ROI created with the automatic region growing algorithm

Create a Classification Preview

The classification process is based on collected ROIs (and spectral signatures thereof). It is useful to create a
Classification preview (page 35) in order to assess the results (influenced by spectral signatures) before the final
classification. In case the results are not good, we can collect additional ROIs to better classify land cover.
Before running a classification (or a preview), set the color of land cover classes that will be displayed in the
classification raster. In the ROI & Signature list (page 27), double click the color (in the column Color) of each
ROI to choose a representative color of each class. Also, we need to set the color for macroclasses in ROI &
Signature list (page 27).
Now we need to select the classification algorithm. In this tutorial we are going to use the Maximum Likelihood
(page 126).

Open the tool Classification (page 64) to set the use of classes or macroclasses. Check Use Class ID and in
Algorithm (page 65) select the Maximum Likelihood. The input band set is 1 because it is the number of the band
set containing the image (bands) that we want to classify.

In Classification preview (page 35) set Size = 300; click the button and then left click a point of the image
in the map. The classification process should be rapid, and the result is a classified square centered in the clicked
coordinates.
Previews are temporary rasters (deleted after QGIS is closed) placed in a group named Class_temp_group in the

QGIS panel Layers. Now in Classification (page 64) check Use MC ID and click the button in Classi-
fication preview (page 35). The preview now represents the colors defined for macroclass.

Tip: It is useful to perform a classification preview every time a ROI (or a spectral signature) is added to the ROI
& Signature list (page 27), in order to assess the contribution thereof to the classification; if the ROI causes errors,

154 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 7: The ROI saved in the Training input

5.1. Tutorial 1 155


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 8: Vegetation. Color composite RGB = 7-3-2

156 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 9: Soil. Color composite RGB = 7-3-2

5.1. Tutorial 1 157


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 10: Definition of class colors

158 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 11: Setting the algorithm and using C ID

Fig. 12: Classification preview displayed over the image using C ID

5.1. Tutorial 1 159


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 13: Classification preview displayed over the image using MC ID

it can be removed from the Training input with the button .

Create the Classification Output

Assuming that the results of classification previews show a good agreement with the image (i.e. pixels are assigned
to the correct class defined in the ROI & Signature list (page 27)), we can perform the actual land cover classification
of the whole image.

In Classification (page 64) check Use Macroclass ID. Click the button Run (page 73) and define the
path of the classification output, which is a raster file (.tif).

Tip: If Play sound when finished is checked in Calculation process (page 101) settings, a sound is played
when the process is finished.

Well done! You have just performed your first land cover classification.
However, you can see that there are several classification errors, because the number of ROIs (spectral signatures)
is insufficient.
In other tutorials we are going to learn about the download and preprocessing of bands, the classification algorithms,
and the postprocessing of classifications.

160 Chapter 5. Basic Tutorials


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 14: Result of the land cover classification

Fig. 15: Example of error: Soil classified as Built-up

5.1. Tutorial 1 161


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

162 Chapter 5. Basic Tutorials


CHAPTER

SIX

THEMATIC TUTORIALS

The following are thematic tutorials. Before these tutorials, it is recommended to read the Basic Tutorials
(page 147).

163
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

164 Chapter 6. Thematic Tutorials


CHAPTER

SEVEN

FREQUENTLY ASKED QUESTIONS

If you have comments or questions please join the Facebook group .


Before asking, please check the official site From GIS to Remote Sensing and the following Frequently Asked
Questions.

• Plugin installation (page 166)


– How to install the plugin manually? (page 166)
– How to install the plugin from the official SCP repository? (page 166)
– Can I use the previous version 7 of SCP? (page 168)
• Pre processing (page 170)
– Which image bands should I use for a semi-automatic classification? (page 170)
– Which Landsat bands can be converted to reflectance by the SCP? (page 171)
– Can I apply the conversion to Sentinel-2 images downloaded from the web? (page 171)
– Can I apply the conversion to Sentinel-2 L2A downloaded from the web? (page 171)
– Can I apply the Landsat conversion and DOS correction to clipped bands? (page 171)
– Can I apply the DOS correction to bands with black border (i.e. with NoData value)? (page 171)
– How to remove cloud cover from images? (page 171)
• Processing (page 171)
– I get classification errors. How can I improve the accuracy? (page 171)
– Is it possible to use the same training input for multiple images? (page 172)
– What is the difference between classes and macroclasses? (page 172)
– Can I use SCP with images from drones or aerial photographs? (page 172)
– Why using only Landsat 8 band 10 in the estimation of surface temperature? (page 172)
– How can I speed up the processing? (page 172)
– How do I perform accuracy assessment and how to design the number of samples? (page 172)
• Warnings (page 173)
– Warning [12]: The following signature will be excluded if using Maximum Likelihood. Why?
(page 173)
• Errors (page 173)
– How can I report an error? (page 173)
• Various (page 175)
– What can I do with the SCP? (page 175)

165
Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

– How to contribute to SCP (page 175)


– How can I translate this user manual to another language? (page 176)
– Where is the source code of SCP? (page 176)

7.1 Plugin installation

7.1.1 How to install the plugin manually?

The SCP can be installed manually (this can be useful when an internet connection is not available, or the installation
is required on multiple computers), following a few steps:
1. download the SCP zip archive from https://github.com/semiautomaticgit/
SemiAutomaticClassificationPlugin/archive/master.zip ;
2. extract the content of the archive (several files such as COPYING.txt and folders such as ui) in a new folder
named SemiAutomaticClassificationPlugin (without -master);
3. open the QGIS plugins directory (in Windows usually C:\Users\username\AppData\Roaming\
QGIS\QGIS3\profiles\default\python\plugins, in Linux and Mac usually /home/username/
.local/share/QGIS/QGIS3/profiles/default/python/plugins) and delete the folder
SemiAutomaticClassificationPlugin if present;
4. copy the folder SemiAutomaticClassificationPlugin inside the QGIS plugins directory;
5. the plugin should be installed; start QGIS, open the Plugin Manager and be sure that Semi-Automatic
Classification Plugin is checked.

7.1.2 How to install the plugin from the official SCP repository?

It is possible to install the SCP using the official repository. This repository allows for the installation of the latest
version of SCP (master), in some cases also before the availability thereof in the QGIS repository. Therefore, this
can be useful if you need a fix or a new function that is still not available in the QGIS repository. Moreover, the
master version in the SCP repository can be installed along with the version available in the QGIS repository.
In order to install the SCP repository follow these steps:
• Run QGIS;
• From the main menu, select Plugins > Manage and Install Plugins;

• Click Settings then click the button Add;

166 Chapter 7. Frequently Asked Questions


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• Inside the Repository details enter:


Name:

SCP

URL:

https://semiautomaticgit.github.io/SemiAutomaticClassificationPlugin/repository.xml

and click OK;

• After the repository update, the item Semi-Automatic Classification Plugin - master should be
listed with the other plugins;

7.1. Plugin installation 167


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• From the menu All, select the Semi-Automatic Classification Plugin - master and click the but-
ton Install plugin; the latest version of SCP should be automatically activated (ignore errors, the restart
of QGIS could be necessary to complete the SCP installation); it is possible to deactivate the other SCP
installed in the QGIS repository;

7.1.3 Can I use the previous version 7 of SCP?

It is possible to install the previous version 7 of SCP using the official repository. Also, this version can be installed
along with the SCP version 8.
In order to install the SCP repository follow these steps:
• Run QGIS;
• From the main menu, select Plugins > Manage and Install Plugins;

• Click Settings then click the button Add;

168 Chapter 7. Frequently Asked Questions


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• Inside the Repository details enter:


Name:

SCP

URL:

https://semiautomaticgit.github.io/SemiAutomaticClassificationPlugin_v7/repository.xml

and click OK;

• After the repository update, the item Semi-Automatic Classification Plugin - master should be
listed with the other plugins;

7.1. Plugin installation 169


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• From the menu All, select the Semi-Automatic Classification Plugin - master and click the but-
ton Install plugin; the latest version of SCP should be automatically activated (ignore errors, the restart
of QGIS could be necessary to complete the SCP installation); it is possible to deactivate the other SCP
installed in the QGIS repository;

7.2 Pre processing

7.2.1 Which image bands should I use for a semi-automatic classification?

In general, it is preferable to avoid thermal infrared bands. If you are using Landsat 4, 5 or 7 you should select
bands: 1, 2, 3, 4, 5, 7 avoiding band 6 that is thermal infrared; for Landsat 8 you should select bands: 2, 3, 4, 5, 6,
7. Landsat 8 band 1 is generally avoided because it is very similar to the blue band and it is mainly used for coastal
aerosol study. Landsat thermal infrared band is excluded from classifications because values are mainly related to
object temperature.
For Sentinel-2 images you can use bands: 2, 3, 4, 5, 6, 7, 8, 8A, 11, 12.

170 Chapter 7. Frequently Asked Questions


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

7.2.2 Which Landsat bands can be converted to reflectance by the SCP?

All Landsat 1,2, and 3 MSS and Landsat 4, 5, 7, and 8 images downloaded from http://earthexplorer.usgs.gov/ and
processed with the Level 1 Product Generation System (LPGS) can be converted to reflectance automatically by
the SCP; products generated by the LPGS have a MTL file included that is required for the conversion.

7.2.3 Can I apply the conversion to Sentinel-2 images downloaded from the web?

Yes, you can convert also images downloaded from the web (actually the conversion is recommended). You should
move all the bands (.jp2 files) and if available the .xml file whose name contains MDT_SAFL1C in the same directory.
Then select this directory in Image conversion (page 54). Images are converted to reflectance.

7.2.4 Can I apply the conversion to Sentinel-2 L2A downloaded from the web?

Yes, you should move all the .jp2 files inside the same directory and rename the files with the band number in the
ending of the name (e.g. from name_02_10m.jp2 to name_02.jp2) Then select this directory in Image conversion
(page 54). Images are converted to reflectance.

7.2.5 Can I apply the Landsat conversion and DOS correction to clipped bands?

Yes, you can clip the images before the conversion to reflectance and then copy the MTL file (contained in the
Landsat dataset) inside the directory with the clipped bands. If you want to apply the DOS correction (which
is an image based technique) you should convert the original Landsat bands (the entire image) and then clip the
conversion output (i.e. bands converted to reflectance).

7.2.6 Can I apply the DOS correction to bands with black border (i.e. with NoData
value)?

If you want to apply the DOS correction to an entire band which has NoData values (the black border with value
= 0) then you have to check the checkbox Use value as NoData and set the value to 0. This is because DOS is
an image based technique, and NoData values must be excluded from the calculation.

7.2.7 How to remove cloud cover from images?

DOS1 correction does not remove clouds from the image. However, Landsat 8 images include Band 9 that identifies
clouds (see this NASA site). You can use this band for the creation of a mask.

7.3 Processing

7.3.1 I get classification errors. How can I improve the accuracy?

Several materials have similar spectral signatures (e.g. soil and built-up, or forest and other types of dense low
vegetation), which can cause classification errors if ROIs, and spectral signatures thereof, are not acquired correctly.
In order to improve the results, you can try to collect more ROIs over these areas, in order to train the algorithm for
these very similar areas, also, display the spectral signatures of these areas in Spectral Signature Plot (page 103)
to assess their similarity. You can also use a Signature threshold (page 51) for these signatures in order to reduce
the variability thereof (only pixels very similar to the input signatures will be classified).

7.3. Processing 171


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

7.3.2 Is it possible to use the same training input for multiple images?

Yes, it is possible if all the images have the same number of bands. However, if images are acquired in different
months, land cover changes (especially of vegetation state) will affect the spectral signature (i.e. the same pixel has
different spectral signature in different periods). Atmospheric effects could also affect the images differently. That
could reduce classification accuracy. Therefore, it is suggested to collect always the ROIs and spectral signatures
for every image.

7.3.3 What is the difference between classes and macroclasses?

Please see Classes and Macroclasses (page 124).

7.3.4 Can I use SCP with images from drones or aerial photographs?

Yes, you can use them if they have at least 4 bands. With less than 4 bands, semi-automatic classification algorithms
are unable to classify the land cover correctly. Alternative classification methods exist, such as object oriented
classification, which is not implemented in SCP.

7.3.5 Why using only Landsat 8 band 10 in the estimation of surface tempera-
ture?

Several methods were developed for estimating surface temperature. The method described in the tutorial for
temperature estimation requires only one band. Moreover, USGS recommends that users refrain from relying on
Landsat 8 Band 11 data in quantitative analysis of the Thermal Infrared Sensor data (see Changes to Thermal
Infrared Sensor (TIRS) data by USGS).

7.3.6 How can I speed up the processing?

In order to speed up the processing you should set the available RAM and the number of threads available in System
(page 100). Available RAM (MB) should be half of the system RAM (e.g. 1024MB if system has 2GB of RAM) or
more if the system has a large amount of RAM (e.g. 10240MB if system has 16GB of RAM). CPU threads should
be a value lower than the maximum number of system threads (e.g. if the system has 4 available threads set value
3).
Also, several tools allow for selecting the output format .vrt avoiding the time required to create a unique .tif
raster (after multiprocess), especially useful for large rasters.

7.3.7 How do I perform accuracy assessment and how to design the number of
samples?

Accuracy assessment is described in this tutorial .


Sample design is required to provide an adequate number of samples for each class, as described in “Olofsson, et al.,
2014. Good practices for estimating area and assessing accuracy of land change. Remote Sensing of Environment,
148, 42 – 57”.
The number of samples (𝑁 ) should be calculated as (Olofsson, et al., 2014):
𝑐
∑︁
𝑁 = ( (𝑊𝑖 − 𝑆𝑖 )/𝑆𝑜 )2
𝑖=1

where:
• 𝑊𝑖 = mapped area proportion of class i;
• 𝑆𝑖 = standard deviation of stratum i;

172 Chapter 7. Frequently Asked Questions


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

• 𝑆𝑜 = expected standard deviation of overall accuracy;


• 𝑐 = total number of classes;
To stratify the sample we should conjecture user’s accuracy and standard deviations of strata (Olofsson, et al.,
2014). One can hypothesize that user’s accuracy is lower and standard deviations 𝑆𝑖 is higher for classes having
low area proportion, but of course these values should be carefully evaluated.
This requires some conjectures about overall accuracy and user’s accuracy of each class. We should base these
conjectures on previous studies.
As starting values, we could assume 𝑆𝑜 = 0.01 and perform a rough accuracy assessment with random samples,
and eventually calculate the 𝑆𝑖 to perform the sampling design. Alternatively, one could start with Si = 0.5 for all
the classes. Basically the higher is Si, the larger is the number of samples for that class.

7.4 Warnings

7.4.1 Warning [12]: The following signature will be excluded if using Maximum
Likelihood. Why?

The ROI is too small (or too homogeneous) for the Maximum Likelihood (page 126) algorithm because that ROI
has a singular covariance matrix. You should create larger ROIs or don’t use the Maximum Likelihood algorithm
in the classification process.

7.5 Errors

7.5.1 How can I report an error?

If you found an error of the Semi-Automatic Classification Plugin please follow these steps in order to collect the
required information (log file):
1. close QGIS if already open;

2. open QGIS, open the Plugin tab Debug (page 97) and check the checkbox Records detailed events in a
log file ;

3. click the button Test dependencies in the tab Debug (page 97) ;
4. load the data in QGIS (or open a previously saved QGIS project) and repeat all the steps that cause
the error in the Plugin;
• if the issue could be related to the image data, please use this sample dataset ;
5. if an error message appears (like the one in the following image), copy the whole content of the message in
a text file;

6. open the tab Debug (page 97) and uncheck the checkbox Records events in a log file, then click the

button and save the log file (which is a text file containing information about the Plugin processes);
7. open the log file and copy the whole content of the file;
8. join the Facebook group , create a new post and copy the error message and the log file (or attach them).

7.4. Warnings 173


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

Fig. 1: Debug

Fig. 2: Error message

174 Chapter 7. Frequently Asked Questions


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

7.6 Various

7.6.1 What can I do with the SCP?

SCP allows for the land cover classification of remote sensing images through Supervised Classification
(page 122). You can produce a land cover raster using one of the Classification Algorithms (page 126) available in
SCP. These algorithms require spectral signatures or ROIs as input (for definitions please read Brief Introduction
to Remote Sensing (page 113)) that define the land cover classes to be identified in the image.

Fig. 3: A multispectral image processed to produce a land cover classification


(Landsat image provided by USGS)

SCP can work with multispectral images acquired by satellites, airplanes, or drones. Also, SCP allows for the
direct search and download of free images (see Download products (page 39)). You cannot use orthophotos with
less than 4 bands and LIDAR data with SCP.
Input image in SCP is called Band set (page 36), which is used as input for the classification. SCP provides several
tools for the Preprocessing (page 52) of downloaded images, such as the conversion to reflectance and manipulation
of bands.
The Spectral Signature Plot (page 103) and Scatter Plot (page 106) allow for the analysis of spectral signatures
and ROIs. Also, several Basic tools (page 44) are available for easing the ROI creation and editing spectral
signatures.
Raster calculation is available through the seamless integration of the tool Band calc (page 88) with bands in the
Band set (page 36), calculating mathematical expressions and spectral indices.
See the Basic Tutorials (page 147) for more information and examples.

7.6.2 How to contribute to SCP

You can contribute to SCP by fixing and adding functionalities (see Where is the source code of SCP? (page 176)),
or translating the user manual (see How can I translate this user manual to another language? (page 176)).

7.6. Various 175


Semi-Automatic Classification Plugin Documentation, Release 8.0.9.2

7.6.3 How can I translate this user manual to another language?

It is possible to easily translate the user manual to any language, because it is written in reStructuredText as markup
language (using Sphinx). Therefore, your contribution is fundamental for the translation of the manual to your
language. The following guide illustrates the main steps for the translation, which can be performed:
• using the free online service Transifex;
• using the gettext .po files.
Before translating, please read this document from the QGIS translation guide, which helps you understand the
reStructuredText.
Method 1. Translation using the free online service Transifex
This is probably the easiest way to translate the manual using an online service.
1. Join the Semi-automatic Classification Manual project
Go to the page https://www.transifex.com/semi-automatic-classification/
semi-automatic-classification-plugin-manual and click the button Help translate. You
can sign in using your Google or Facebook account, or with a free registration.
2. Select your language
Select your language and click the button Join team. If your language is not listed, click the
button Request language.
3. Translation
There are several files to be translated, which refer to the sections of the SCP documentation. To
translate the SCP interface you should select the file semiautomaticclassificationplugin.
ts .
Method 2. Translation using the gettext .po files
In order to use this method, you should be familiar with GitHub. This translation method allows for the translation
of the PO files locally.
1. Download the translation files
Go to the GitHub project https://github.com/semiautomaticgit/
SemiAutomaticClassificationManual_v4/tree/master/locale and download the .po files of
your language (you can add your language, if it is not listed), or you can fork the repository.
Every file .po is a text file that refers to a section of the User Manual.
2. Edit the translation files
Now you can edit the .po files. It is convenient to edit those file using one of the following
programs: for instance Poedit for Windows and Mac OS X, or Gtranslator for Linux or OmegaT
(Java based) for Windows, Linux and Mac OS X. These editors allow for an easy translation of
every sentence in the User Manual.

7.6.4 Where is the source code of SCP?

The source code of SPC is available at the following link https://github.com/semiautomaticgit/


SemiAutomaticClassificationPlugin

176 Chapter 7. Frequently Asked Questions

You might also like