5.1. Tutorial 1: Basic Land Cover Classification
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
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 before following this tutorial.
The purpose of the classification is to identify the following land cover classes:
Water;
Built-up;
Vegetation;
Soil.
The basic steps are:
the definition of input data (image bands) in a Band set;
the creation of a Training input to collect training areas to train the classification algorith;
the Classification of input data.
5.1.1.1. 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 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.
5.1.1.2. Define the Band set and create the Training Input File
We are going to use a subset of Sentinel-2 Satellite 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 clicking the button in the
SCP menu or the SCP dock.
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.

Definition of a band set
We can display a Color Composite of bands: Near-Infrared, Red, and Green.
Tip
If a Band set is defined, a temporary virtual raster (named
Virtual Band Set 1
) is created automatically, which allows for the
display of a Color Composite.
In the Working toolbar, click the list RGB= and select the
item 7-3-2
(corresponding to the band numbers in Band set).
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.

Color composite RGB=7-3-2
After Band set creation, we need to create a Training input file in order to collect Training Areas (ROIs) and calculate the Spectral Signature thereof (which are required to train the classification algorithm).
In the SCP dock select the tab Training input 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 .
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.

Definition of Training input in SCP
5.1.1.3. Create the ROIs
We are going to create ROIs defining the Classes and Macroclasses. 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.
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).
Tip
You can draw temporary polygons (the previous one will be overridden) until the shape covers the intended area.

A temporary ROI created manually
If the shape of the temporary polygon sufficiently covers the water area, we can save it to the Training input.
Open the Training input to define the Classes and Macroclasses .
In the ROI & Signature list 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.
After a few seconds, the ROI is listed in the ROI & Signature list and the
spectral signature is calculated (because Signature
is checked).

The ROI saved in the Training input
As you can see, the C ID in ROI & Signature list 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 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 set the Dist value to 0.03 .
Click the button in the Working toolbar 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.

A temporary ROI created with the automatic region growing algorithm
In the ROI & Signature list set MC ID = 2 and MC Name =
Built-up
; also set C ID = 2 (it should be already set) and
C Name = Buildings
.

The ROI saved in the Training input
Again, the C ID in ROI & Signature list 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.

Vegetation. Color composite RGB = 7-3-2

Soil. Color composite RGB = 7-3-2
Tip
It is possible to display the Spectral signatures of created
ROIs in the Spectral Signature Plot.
5.1.1.4. Create a Classification Preview
The classification process is based on collected ROIs (and spectral signatures thereof). It is useful to create a Classification preview 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, 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.

Definition of class colors
Now we need to select the classification algorithm. In this tutorial we are going to use the Maximum Likelihood.
Open the tool Classification to set the use of classes or
macroclasses.
Check Use Class ID and in
Algorithm 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.

Setting the algorithm and using C ID
In Classification preview 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.

Classification preview displayed over the image using C ID
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 check Use
MC ID and click the button
in
Classification preview.
The preview now represents the colors defined for macroclass.

Classification preview displayed over the image using MC ID
Tip
It is useful to perform a classification preview every time a ROI (or a
spectral signature) is added to the ROI & Signature list, in order to assess the
contribution thereof to the classification; if the ROI causes errors, it
can be removed from the Training input with the button
.
5.1.1.5. 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), we can perform the actual land cover classification of the whole image.
In Classification check
Use Macroclass ID.
Click the button Run
and define the
path of the classification output, which is a raster file (.tif).

Result of the land cover classification
Tip
If Play sound when finished is checked in
Calculation process 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.

Example of error: Soil classified as Built-up
In other tutorials we are going to learn about the download and preprocessing of bands, the classification algorithms, and the postprocessing of classifications.