Semi-Automatic Classification Plugin v.5.0 "Kourou" Released: Supervised Classification Tutorial

I am very glad to announce the availability of the new Semi-Automatic Classification Plugin (SCP) version 5.0, code name "Kourou" (dedicated to the Europe's Spaceport in French Guiana where Sentinel satellites are launched, see http://www.esa.int/Our_Activities/Launchers/Europe_s_Spaceport/Overview_of_Europe_s_Spaceport).
I have also updated the user manual that is available here.




In case the plugin is still not available inside QGIS Plugin Manager, you can perform a manual installation, following this guide.
Following the first basic tutorial of this new version.




The following is 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.
The purpose of the classification is to identify the following land cover classes:
  1. Water;
  2. Built-up;
  3. Vegetation;
  4. Bare soil.
Following the video of this tutorial.




1. Data

Download the image from this archive (data available from the U.S. Geological Survey) and unzip the downloaded file.
The downloaded file is actually a Landsat Satellite image (pan-sharpened) including the following bands:
  1. Blue;
  2. Green;
  3. Red;
  4. Near-Infrared;
  5. Short Wavelength Infrared 1;
  6. Short Wavelength Infrared 2.
In this tutorial we pretend this dataset is a generic multi-spectral raster in order to focus on the classification process (in the next tutorial we are going to use an image whose bands are single rasters).

2. Set the Input Image in SCP

Start QGIS. In the SCP input click the button open_file of the Input image, in order to select the file sample_image.tif. Once selected, sample_image.tif is set as Input image, the image is displayed in the map and bands are loaded in the Band set.
We can display a Color Composite of bands: Near-Infrared, Red, and Green: in the Working toolbar, click the list RGB= and select the item 4-3-2 (corresponding to the band numbers in Band set). You can see that image colors in the map change according to the selected bands, and vegetation is highlighted in red (if the item 3-2-1 was selected, natural colors would be displayed).

Color composite RGB=4-3-2

3. Create the Training Input File

Now we need to create the Training input in order to collect Training Areas (ROIs) and calculate the Spectral Signature thereof (which are used in classification).
In the SCP dock click the button new_file and define a name (e.g. training.scp ) in order to create the Training input. The path of the file is displayed in Training input. A vector is added to QGIS layers with the same name as the Training input (in order to prevent data loss, you should not edit this layer using QGIS functions).


Definition of Training input in SCP

4. Create the ROIs

We are going to create ROIs defining the Classes and Macroclasses. Each ROI identifies a land cover class through a Class ID. The Class ID codes used in this tutorial are illustrated in the following table (for now we assign the same code to Class ID and Macroclass ID).
Macroclasses
Class nameClass ID
Water1
Built-up2
Vegetation3
Bare soil4
ROIs can be created by manually drawing a polygon or with an automatic region growing algorithm.
Zoom in the map over the dark area (it is a lake) in the lower right region of the image. In order to create manually a ROI inside the dark area, click the button manual_ROI in the Working toolbar (you can ignore a message about wavelength unit not provided). 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 is good we can save it to the Training input.
Open the Classification dock to define the Classes and Macroclasses . In the ROI creation set MC ID = 1 and MC Info = Water; also set C ID = 1 and C Info = Lake. Now click save_roi 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 checkbox Calculate sig. was checked).

The ROI saved in the Training input

As you can see, the C ID in ROI creation 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 theType is B, 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 in the map over the blue area in the upper left region of the image.
In Working toolbar set the Dist value to 0.08 . Click the button roi_single in the Working toolbar and click over the 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 creation set MC ID = 2 and MC Info = Built-up ; also set C ID = 2 (it should be already set) and C Info = Buildings.


The ROI saved in the Training input

Again, the C ID in ROI creation is automatically increased by 1.

Create a ROI for the class Vegetation (red pixels in color composite RGB=4-3-2) and a ROI for the class Bare soil (green pixels in color composite RGB=4-3-2) following the same steps described previously. The following images show a few examples of these classes identified in the map.

Vegetation


Bare soil

5. 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 more 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.


Definition of class colors

Now we need to select the classification algorithm. In this tutorial we are going to select the Spectral Angle Mapping.
In Classification algorithm select the Spectral Angle Mapping Algorithm. In Classification preview set Size = 500; click the button preview 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 clicked point.

Classification preview displayed over the image

Previews are temporary rasters (deleted after QGIS is closed) placed in a group named Class_temp_group in the QGIS panel Layers.
TIP : When loading a previously saved QGIS project, a message could ask to handle missing layers, which are temporary layers that SCP creates during each session and are deleted afterwards; you can clickCancel and ignore these layers.
In general, it is good to perform a classification preview every time a ROI (or a spectral signature) is added to the ROI Signature list. Therefore, the phases Create the ROIs and Create a Classification Preview should be iterative and concurrent processes.

6. Create the Classification Output

Assuming that the results of classification previews were good (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 the Classification output click the button run and define the path of the classification output, which is a raster file (.tif). If checkbox Play sound when finished is checked in Classification process settings, a sound is played when the process is finished.

Result of the land cover classification

Well done! You have just performed your first land cover classification.
Water and vegetation are correctly identified. However, you can see that there are several classification errors (especially soil classified as built-up and vice versa), because the number of ROIs (spectral signatures) is insufficient.

Example of error: Bare soil classified as Built-up

We can improve the classification using some of the tools described in the next tutorial.

For any comment or question, join the Facebook group and the Google+ Community about the Semi-Automatic Classification Plugin.


Newer posts Older posts