Jul 27, 2014 - 18 Collection of ROIs and Spectral Signatures. 91. 19 Classification ..... Run VirtualBox and create a new Debian virtual machine;. (a) Click the ...
Semi-Automatic Classification Plugin Documentation Release 3.0.7
Luca Congedo
July 27, 2014
Contents
I
Plugin Installation
3
1
Installation in Windows 32 bit 1.1 QGIS download and installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Semi-Automatic Classification Plugin installation . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Configuration of the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7 7 7 8
2
Installation in Windows 64 bit 2.1 QGIS download and installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Semi-Automatic Classification Plugin installation . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Configuration of the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 11 11 12
3
Installation in Ubuntu Linux 3.1 QGIS download and installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Semi-Automatic Classification Plugin installation . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Configuration of the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15 15 15 17
4
Installation in Debian Linux 4.1 QGIS download and installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Semi-Automatic Classification Plugin installation . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Configuration of the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19 19 19 20
5
Installation in Mac OS 5.1 QGIS download and installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Semi-Automatic Classification Plugin installation . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Configuration of the plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23 23 23 24
II
Semi-Automatic OS
27
6
Installation in VirtualBox
31
III
The Interface
7
Toolbar
8
ROI Creation dock 8.1 Training shapefile . . . 8.2 ROI list . . . . . . . . . 8.3 ROI parameters . . . . . 8.4 ROI creation . . . . . . 8.5 ROI Signature definition
35 39
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
41 41 43 43 43 44
i
9
Classification dock 9.1 Signature list file . . . . 9.2 Signature list . . . . . . 9.3 Classification algorithm 9.4 Classification preview . 9.5 Classification style . . . 9.6 Classification output . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
45 45 45 47 47 47 48
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
49 49 53 56 59 60
11 Spectral Signature Plot 11.1 Signature list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63 63
12 Scatter Plot 12.1 ROI List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65 65
IV
67
10 Main Interface Window 10.1 Tools tab . . . . . 10.2 Pre processing tab 10.3 Post processing tab 10.4 Band set tab . . . 10.5 Settings tab . . . .
. . . . .
. . . . .
. . . . .
Brief Introduction to Remote Sensing
13 Basic Definitions
69
14 Landsat image conversion to reflectance and DOS1 atmospheric correction
75
15 Conversion to At-Satellite Brightness Temperature
79
V
81
Tutorials
16 Pre processing: Conversion of raster bands from DN to Reflectance
85
17 Definition of the classification inputs
89
18 Collection of ROIs and Spectral Signatures
91
19 Classification of the study area
97
20 Calculation of classification accuracy
99
21 Calculation of the area of classes
ii
101
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Written by Luca Congedo, the Semi-Automatic Classification Plugin is a free plugin for QGIS (open source) that allows for the semi-automatic supervised classification of remote sensing images, providing tools to expedite the creation of ROIs (training areas) through region growing or multiple ROI creation. The spectral signatures of training areas can be automatically calculated and displayed in a spectral signature plot. It is possible to import spectral signatures from external sources. Also, a tool allows for the selection and download of spectral signatures from the USGS Spectral Library . Several tools are available for the pre processing phase (image clipping, Landsat conversion to reflectance), the classification process (Minimum Distance, Maximum Likelihood, Spectral Angle Mapping algorithms, and classification previews), and the post processing phase (conversion to vector, accuracy assessment, land cover change, classification report). The first version of the Semi-Automatic Classification Plugin was written by Luca Congedo for the Adapting to Climate Change in Coastal Dar es Salaam Project. For more information and tutorials visit the official site From GIS to Remote Sensing. How to cite: Congedo Luca, Munafo’ Michele, Macchi Silvia (2013). “Investigating the Relationship between Land Cover and Vulnerability to Climate Change in Dar es Salaam”. Working Paper, Rome: Sapienza University. Available at: http://www.planning4adaptation.eu/Docs/papers/08_NWP-DoM_for_LCC_in_Dar_using_Landsat_Imagery.pdf 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 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/.
Contents
1
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
2
Contents
Part I
Plugin Installation
3
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The Semi-Automatic Classification Plugin requires the installation of GDAL, OGR, Numpy, SciPy and Matplotlib. This section describes the installation of the Semi-Automatic Classification Plugin for the supported Operating Systems.
5
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
6
CHAPTER 1
Installation in Windows 32 bit
1.1 QGIS download and installation • Download the latest QGIS version 32 bit from here (the direct download of QGIS 2.4 from this link); • Execute the QGIS installer with administrative rights, accepting the default configuration. Now, QGIS 2 is installed.
1.2 Semi-Automatic Classification Plugin installation • Run QGIS 2; • 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;
7
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 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);
1.3 Configuration of the plugin Now, the Semi-Automatic Classification Plugin is installed and two docks and a toolbar should be added to QGIS. If not, the SCP is available under the Raster menu of QGIS. It is possible to move the Toolbar (page 39) and the docks according to your needs, as in the following image.
8
Chapter 1. Installation in Windows 32 bit
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Because of 32 bit software limitations, no RAM configuration is required.
1.3. Configuration of the plugin
9
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
10
Chapter 1. Installation in Windows 32 bit
CHAPTER 2
Installation in Windows 64 bit
2.1 QGIS download and installation • Download the latest QGIS version 64 bit from here (the direct download of QGIS 2.4 from this link); • Execute the QGIS installer with administrative rights, accepting the default configuration. Now, QGIS 2 is installed.
2.2 Semi-Automatic Classification Plugin installation • Run QGIS 2; • 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;
11
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 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 Configuration of the plugin Now, the Semi-Automatic Classification Plugin is installed and two docks and a toolbar should be added to QGIS. If not, the SCP is available under the Raster menu of QGIS. It is possible to move the Toolbar (page 39) and the docks according to your needs, as in the following image.
12
Chapter 2. Installation in Windows 64 bit
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The configuration of available RAM is recommended in order to reduce the processing time. Click the button in the SCP Toolbar (page 39) to open the Settings tab (page 60), and set the Available RAM to a value that should be half of the system RAM. For instance, if your system has 2GB of RAM, set the value to 1024.
2.3. Configuration of the plugin
13
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
14
Chapter 2. Installation in Windows 64 bit
CHAPTER 3
Installation in Ubuntu Linux
3.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 python-matplotlib python-scipy
• Press Enter and wait until the software is downloaded and installed. Now, QGIS 2 is installed.
3.2 Semi-Automatic Classification Plugin installation • Run QGIS 2; • From the main menu, select Plugins > Manage and Install Plugins;
15
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 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);
16
Chapter 3. Installation in Ubuntu Linux
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
3.3 Configuration of the plugin Now, the Semi-Automatic Classification Plugin is installed and two docks and a toolbar should be added to QGIS. If not, the SCP is available under the Raster menu of QGIS. It is possible to move the Toolbar (page 39) and the docks according to your needs, as in the following image.
The configuration of available RAM is recommended in order to reduce the processing time. Click the button in the SCP Toolbar (page 39) to open the Settings tab (page 60), and set the Available RAM to a value that should be half of the system RAM. For instance, if your system has 2GB of RAM, set the value to 1024.
3.3. Configuration of the plugin
17
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
18
Chapter 3. Installation in Ubuntu Linux
CHAPTER 4
Installation in Debian Linux
4.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 python-matplotlib python-scipy
• Press Enter and wait until the software is downloaded and installed. Now, QGIS 2 is installed.
4.2 Semi-Automatic Classification Plugin installation • Run QGIS 2; • From the main menu, select Plugins > Manage and Install Plugins;
19
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 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);
4.3 Configuration of the plugin Now, the Semi-Automatic Classification Plugin is installed and two docks and a toolbar should be added to QGIS. If not, the SCP is available under the Raster menu of QGIS. It is possible to move the Toolbar (page 39) and the docks according to your needs, as in the following image.
20
Chapter 4. Installation in Debian Linux
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The configuration of available RAM is recommended in order to reduce the processing time. Click the button in the SCP Toolbar (page 39) to open the Settings tab (page 60), and set the Available RAM to a value that should be half of the system RAM. For instance, if your system has 2GB of RAM, set the value to 1024.
4.3. Configuration of the plugin
21
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
22
Chapter 4. Installation in Debian Linux
CHAPTER 5
Installation in Mac OS
5.1 QGIS download and installation • Download and install the latest version of QGIS and GDAL from here . • In addition, download and install the python modules Numpy, Scipy, and Matplotlib from this link . Now, QGIS 2 is installed.
5.2 Semi-Automatic Classification Plugin installation • Run QGIS 2; • 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;
23
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 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);
5.3 Configuration of the plugin Now, the Semi-Automatic Classification Plugin is installed and two docks and a toolbar should be added to QGIS. If not, the SCP is available under the Raster menu of QGIS. It is possible to move the Toolbar (page 39) and the docks according to your needs, as in the following image.
24
Chapter 5. Installation in Mac OS
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The configuration of available RAM is recommended in order to reduce the processing time. Click the button in the SCP Toolbar (page 39) to open the Settings tab (page 60), and set the Available RAM to a value that should be half of the system RAM. For instance, if your system has 2GB of RAM, set the value to 1024.
5.3. Configuration of the plugin
25
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
26
Chapter 5. Installation in Mac OS
Part II
Semi-Automatic OS
27
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The Semi-Automatic OS is a lightweight virtual machine for the land cover classification of remote sensing images. It includes the Semi-Automatic Classification Plugin for QGIS, already configured along with all the required dependencies.
Figure 5.1: Semi-Automatic OS desktop The Semi-Automatic OS is based on Debian 7 32-bit, and it is designed to require very little hardware resources. It uses LXDE and Openbox as main desktop environment. This virtual machine can be useful for testing the Semi-Automatic Classification Plugin, or when the installation of the required programs in the host system is problematic. The Semi-Automatic OS is available as a virtual machine that can be run in the open source VirtualBox, or any other virtualization program. The following is a guide for the installation of the Semi-Automatic OS in the open source program of virtualization VirtualBox.
29
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
30
CHAPTER 6
Installation in VirtualBox
1. Download VirtualBox open source software (select a proper version depending on your OS) and install it; at the end of the installation restart the system; 2. Download the Semi-Automatic OS virtual machine (about 600 MB) from here; 3. Extract the virtual machine content in a directory (it requires about 3 GB of disk space); the file is compressed in 7z format (if needed, download the open source extraction software from http://www.7-zip.org/); 4. Run VirtualBox and create a new Debian virtual machine; (a) Click the New button; (b) Type a name for the virtual machine (for instance Semi-Automatic OS); select Linux and Debian as Type and Version respectively; click Next;
(c) Set the memory size; the more is the better, but this parameter should not exceed a half of he host system RAM (for instance if the host system has 1 GB of RAM, type 512 MB); click Next;
31
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
(d) In the Hard drive settings select Use an existing virtual hard drive file and select the downloaded file SemiAutomaticOS.vmdk; click Create;
5. Start the Semi-Automatic OS by clicking the Start button; 6. It is recommended to install the virtualbox-guest-utils in the virtual machine, from the Menu > Preferences > Synaptic Package Manager; it allows for a better integration of the Semi-Automatic OS in the host system, such as: the resize of the system window, or the folder sharing. The Semi-Automatic OS includes a sample dataset (Landsat 8 images available from the U.S. Geological Survey) that can be used for testing purposes.
32
Chapter 6. Installation in VirtualBox
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Semi-Automatic OS 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 OS 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 GNU General Public License for more details. See http://www.gnu.org/licenses/.
33
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
34
Chapter 6. Installation in VirtualBox
Part III
The Interface
35
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The plugin is composed of a toolbar, two movable docks integrated in QGIS and a main interface window, which allow for an easy and rapid supervised classification of remote sensing images, with functions for data pre processing and post processing. Moreover, spectral signature and scatter plots are displayed in separate windows.
37
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
38
CHAPTER 7
Toolbar
Figure 7.1: Toolbar The Toolbar allows for the selection of the Input image, and includes several buttons for opening the main functions of the Main Interface Window (page 49). •
: show the Main Interface Window (page 49) and display the ROI Creation dock (page 41) and the Classification dock (page 45);
• Input image : select a multispectral image (loaded in QGIS) from the list; if a band set is defined, then the list will contain the item >; •
: refresh image list;
•
: open the Band set tab (page 59);
•
: open the Spectral Signature Plot (page 63);
•
: open the Tools tab (page 49);
•
: open the Pre processing tab (page 53);
•
: open the Post processing tab (page 56);
•
: open the Settings tab (page 60);
•
: open the online user manual in a web browser;
•
: open the Online help in a web browser, where it is possible to ask for help or report any issue regarding the Semi-Automatic Classification Plugin and the Semi-Automatic OS.
Following a brief video of this tool. http://www.youtube.com/watch?v=YIcd_qc_AzM
39
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
40
Chapter 7. Toolbar
CHAPTER 8
ROI Creation dock
The dock ROI creation allows for the definition of a training shapefile, and for the creation of ROIs using a region growing algorithm or manual drawing. ROIs (Regions Of Interest) are polygons that can be created automatically using a region growing algorithm (i.e. image is segmented around a pixel seed), by clicking on an image pixel. This way, created ROIs include spectrally homogeneous pixels. Alternatively, ROIs can be created manually by drawing a polygon. Created ROIs are temporary polygons, until they are saved in the training shapefile, which are placed inside a group named Class_temp_group , and deleted when the QGIS project is closed. ROIs are then saved in a training shapefile, created by the SCP, which contains several fields required for the classification process. ROIs are defined with the Macroclass ID, Macroclass Information (e.g. macroclass name), Class ID, and Class Information (e.g. class name). The Class ID is a unique identifier for each land cover class. 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. Each Class ID must be assigned to only one Macroclass ID (i.e. each class can have only one macroclass), but several Class IDs can be assigned to the same Macroclass ID (i.e. different classes can have the same macroclass). Of course, several ROIs can share the same Class ID. The use of the Macroclass ID for classifications is defined with the option Use Macroclass ID in the Classification algorithm (page 47). If the option Use Macroclass ID is unchecked, then the classification is performed using the ID class only (e.g. grass and trees are classified as class 1 and 2 respectively). If one does not need macroclasses, then simply assign the same Macroclass ID to all ROIs (e.g. 1) and uncheck the option Use Macroclass ID in the Classification algorithm (page 47).
8.1 Training shapefile • Select a training shapefile : a shapefile, for the collection of ROIs used during the classification; the shapefile must contain at least four fields: MC_ID [int], MC_info [string], C_ID [int], and C_info [string] (custom names can be defined in the Settings tab (page 60)); •
: refresh layer list;
• [ New shp ]: create a new shapefile containing the required fields Macroclass ID, Macroclass Information , Class ID, and Class Information. Tip: If you need to use an existing shapefile having different field names edit the Field names of training shapefile (page 61).
41
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 8.1: ROI creation
42
Chapter 8. ROI Creation dock
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
8.2 ROI list The ROI list display the ROI collected in the Training shapefile. Double click on any table item to zoom in the map to that ROI; also, with a single click on any item, it is possible to change the ROI IDs and Infos directly. • Table fields: – MC ID [int] : ROI Macroclass ID; – MC Info [text] : ROI Macroclass Information; – C ID [int] : ROI Class ID; – C Info [text] : ROI Class Information; • Add to signature : calculate ROI spectral signature and add it to the Signature list (page 45); •
: calculate ROI spectral signature and show it in the Spectral Signature Plot (page 63);
•
: open the Scatter Plot (page 65);
•
: delete highlighted ROIs from the Training shapefile. Tip: in order to calculate a single spectral signature from multiple ROIs having the same MC ID and C_ID, highlight those ROIs in the ROI list and click the button Add to signature.
8.3 ROI parameters • Min ROI size : the minimum area of a ROI (in pixel unit) when created using a region growing algorithm on a specific band; • Max ROI width : the maximum width of a ROI (i.e. the side lenght of a square, centered at the seed pixel, which inscribes the ROI) in pixel unit; • Range radius : the interval which defines the maximum spectral distance between the seed pixel and the surrounding pixels (in radiometry unit); if the ROI size is less then Min ROI size then the Range radius is overridden and ROI is created using the most similar pixels until size is at least Min ROI size; • Rapid ROI on band : if checked, ROI is created only on the selected band of raster (the process is rapider than creating a ROI using all the available bands); if unchecked, the resulting ROI is the intersection of ROIs calculated on each band (therefore it can be smaller than Min ROI size ); this configuration is stored in the QGIS project.
8.4 ROI creation • [+]: recall the pointer for ROI creation using the region growing algorithm; • [ Redo ]: create a new ROI at the same point of the previous one; •
•
: create a ROI by manual drawing of a polygon on the image; after clicking the button, left click on the image to define the ROI vertices and right click on the image to define the last vertex and close the polygon; : open the Multiple ROI Creation tab (page 51).
8.2. ROI list
43
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
8.5 ROI Signature definition • MC ID : ROI Macroclass ID; this ID is used for the classification process as reference for the land cover classes when the option Use Macroclass ID in the Classification dock (page 45) is checked; • MC Info : ROI Macroclass information; this field is used to write a brief description of the Macroclass (this description is not used in the classification process and does not influence the classification); • C ID : ROI Class ID; this ID is used for the classification process as reference for the land cover classes when the option Use Macroclass ID in the Classification dock (page 45) is unchecked; • C Info : ROI Class information; this field is used to write a brief description of the class (this description is not used in the classification process and does not influence the classification); • [ Save ROI ]: save the last created ROI to the training shapefile; • [ Undo ]: delete the last saved ROI from the training shapefile; • Add sig. list: if checked, the spectral signature is calculated (the ROI mean value and standard deviation for each raster band, and the covariance matrix) while the ROI is saved to shapefile (it takes some time depending on the number of image bands); this configuration is stored in the QGIS project. Following a brief video of this tool. http://www.youtube.com/watch?v=cSNIlnM4tPo
44
Chapter 8. ROI Creation dock
CHAPTER 9
Classification dock
The dock Classification is designed to manage the spectral signatures, and classify remote sensing image (or band set). The classification process requires the spectral signatures that define the land cover classes (for instance calculated from the ROIs of a Training shapefile in the ROI Creation dock (page 41)). In addition, it is possible to import spectral signatures from other projects or from the USGS Spectral Library tab (page 51). The classification can be performed for the entire image, or for a portion of it, creating a Classification preview (page 47). Similarly to the ROI creation (page 43), classification previews are created with a click on any image pixel; preview classifications are temporarily placed inside a layer group named Class_temp_group, and they are deleted when the QGIS session is closed. It is possible to choose between the Macroclass ID or Class ID as reference for the Classification algorithm (page 47). A Classification style (page 47) (i.e. a .qml file) can be defined for classifications and previews, allowing for the custom definition of class colors (which overrides the color defined in the Signature list (page 45)). A .tif file is created as output classification. Also, the Classification output (page 48) allows for the automatic conversion of the classification from raster to vector (a shapefile), the calculation of the classification accuracy, and the definition of a mask for the land cover classification (using a polygon shapefile). Other options are defined in the Classification process (page 61).
9.1 Signature list file • Open : open a signature list file (a .xml file); • Save : save the signature list to file; if no signature list file is already defined, a window will open for the selection of where to save the signature file.
9.2 Signature list The Signature list displays the collected signatures. Double click on any table item to check/uncheck all the item checkboxes; only the spectral signatures checked in this list are used for the classification, therefore, it is possible to quickly assess the effect of each signature in the classification result. A single click on any item allows for editing the signature IDs and Infos directly. • Table fields: – S : checkbox field; – MC ID : Macroclass ID; – MC Info : Macroclass Information; – C ID : Class ID; – C Info : Class Information; 45
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 9.1: Classification
46
Chapter 9. Classification dock
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
– Color : color field; double click to select a color for the class. • •
: delete highlighted spectral signatures; : import a spectral library from ASTER spectral libraries (i.e. files .txt downloaded from http://speclib.jpl.nasa.gov), USGS spectral libraries (i.e. files .asc downloaded from http://speclab.cr.usgs.gov/spectral-lib.html), or generic .csv files;
•
: open the USGS Spectral Library tab (page 51);
•
: open a window for the directory selection where signatures are exported as single .csv files;
•
: add highlighted signatures to the Spectral Signature Plot (page 63);
• Export list: export the signature list to a signature file (i.e. a .xml file); • Import list: import a .xml file, adding the spectral signatures to the ones in the Signature list. Tip: the signature list is automatically saved every time the QGIS project is saved, or manually saved by clicking the button Save in the Signature list file (page 45).
9.3 Classification algorithm • Select a classification algorithm : available classification algorithms are: Maximum Likelihood; Minimum Distance; Spectral Angle Mapping; • Threshold [if threshold is equal to 0, then all image pixels are classified; otherwise:] – for Maximum Likelihood, pixels are unclassified if probability is less than threshold value (max 100); – for Minimum Distance, pixels are unclassified if distance is greater than threshold value; – for Spectral Angle Mapping, pixels are unclassified if spectral angle distance is greater than threshold value (max 90). • Use Macroclass ID : if checked the classification is performed using the Macroclass ID; if unchecked, then the classification is performed using the ID class only.
9.4 Classification preview • [+]: recall the pointer for the creation of a classification preview ; • Size : size in pixel unit of a classification preview (i.e. the side lenght of a square, centered at the clicked pixel); • [ Redo ]: create a new classification preview centered at the same pixel of the previous one.
9.5 Classification style • [ Select qml ]: select a previously saved .qml file; this configuration is stored in the QGIS project; • [ Reset ]: reset classification and preview styles to default (i.e. colors are automatically assigned to classes).
9.3. Classification algorithm
47
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
9.6 Classification output • Apply mask : if checked, it allows the users to select a shapefile for the purpose of masking the classification (i.e. image pixels outside this shapefile will be unclassified); • [ Reset ]: reset the shapefile mask. • Create vector : if checked, a shapefile classification is saved into the same folder and with the same name defined for the classification output; • Classification report : if checked, a report about the land cover classification is calculated, providing the pixel count, the percentage and area for each class; the report is saved as a .csv file in the same folder and with the same name defined for the classification output and the suffix _report; in addition, the results are shown in the Classification report tab (page 58); • [ Perform classification ]: open a window for the selection of output destination, and perform the image classification that is saved as a .tif file, along with the optional outputs. Following a brief video of this tool. http://www.youtube.com/watch?v=GFySyhlVnYw
48
Chapter 9. Classification dock
CHAPTER 10
Main Interface Window
The Main Interface Window is composed of several tabs grouped in sections. Each section contains several functions that are useful for the classification process, the pre processing of images, and the post processing of land cover classifications. Three buttons are always available: • Show docks : show the ROI Creation dock (page 41) and the Classification dock (page 45) if closed; • Quick user guide : open the online user manual in a web browser; • Online help : open the Online help in a web browser, where it is possible to ask for help or report any issue regarding the Semi-Automatic Classification Plugin and the Semi-Automatic OS. Following, the list of tabs and the description thereof: • Tools tab (page 49) – Multiple ROI Creation tab (page 51) – USGS Spectral Library tab (page 51) • Pre processing tab (page 53) – Clip multiple rasters tab (page 53) – Landsat tab (page 55) • Post processing tab (page 56) – Accuracy tab (page 56) – Land cover change tab (page 57) – Classification report tab (page 58) • Band set tab (page 59) – Band list (page 59) – Band set definition (page 59) • Settings tab (page 60) – Field names of training shapefile (page 61) – ROI style (page 61) – Spectral signature (page 61) – Classification process (page 61) – RAM (page 61) – Debug (page 61)
10.1 Tools tab The tab Tools includes several tools for the creation and manipulation of ROI and spectral signatures.
49
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 10.1: Multiple ROI Creation
50
Chapter 10. Main Interface Window
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
10.1.1 Multiple ROI Creation tab The tab Multiple ROI Creation allows for the automatic creation of ROIs, useful for the rapid classification of multi-temporal images, or for creating several ROIs using GPS data from field survey. It performs the region growing of ROIs at user defined points, requiring a list of point coordinates and class definitions. Created ROIs are automatically saved to the Training shapefile (page 41). Point coordinates and ROI definition • Table fields: – X [float] : point X coordinate; – Y [float] : point Y coordinate; – MC ID [int] : ROI Macroclass ID; – MC Info [text] : ROI Macroclass Information; – Class ID [int] : ROI Class ID; – C Info [text] : ROI Class Information; – Min size [int] : the minimum area of a ROI (in pixel unit) when created using a region growing algorithm on a specific band; – Max width [int] : the maximum width of a ROI (i.e. the side lenght of a square, centered at the seed pixel, which inscribes the ROI) in pixel unit; – Range radius [float] : the interval which defines the maximum spectral distance between the seed pixel and the surrounding pixels (in radiometry unit); if the ROI size is less then Min size then the Range radius is overridden and ROI is created using the most similar pixels until size is at least Min size; – Rapid ROI band [int] : if defined, ROI is created only on the selected band of raster (the process is rapider than creating ROI using all the available bands); if empty, the resulting ROI is the intersection of ROIs calculated on each band (therefore it can be smaller than Min size ); • [ Add point ]: add a new row to the table for the definition a point; all the table fields must be filled for the ROI creation; • [ Remove highlighted points ]: delete the highlighted rows from the table; • [ Import point list ]: import a point list from text file to the table; every line of the text file must contain values separated by tabs of X [float], Y [float], MC ID [int], MC Info [text], Class ID [int], C Info [text], Min size [int], Max width [int], Range radius [float], and optionally the Rapid ROI band [int]; • [ Export point list ]: export the point list to text file; • [ Create and save ROIs ]: start the ROI creation process for all the points and save ROIs to the Training shapefile; • Add sig. (page 45).
list: if checked, calculate ROI spectral signatures and add them to the Signature list
Following a brief video of this tool. http://www.youtube.com/watch?v=of49IWLnJ9k
10.1.2 USGS Spectral Library tab The tab 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
10.1. Tools tab
51
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 10.2: USGS Spectral Library
52
Chapter 10. Main Interface Window
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Minerals, Mixtures, Coatings, Volatiles, Man-Made, Plants, Vegetation Communities, Mixtures with Vegetation, and Microorganisms. The downloaded library is automatically sampled according to the image band wavelengths defined in the Band set tab (page 59), and added to the Signature list (page 45). Select a chapter • Select a chapter : select one of the library chapters; after the selection, chapter libraries are shown in Select a library (page 53); Select a library • Select a library : select one of the libraries; the library description is displayed in the frame Library description; • Add to signature list [internet connection required] : download the library and add the sampled spectral signature to the Signature list (page 45) using the parameters defined in ROI Signature definition (page 44). Tip: spectral libraries downloaded from the USGS Spectral Library can be used with the Minimum Distance or Spectral Angle Mapping algorithms, but not used with the Maximum Likelihood algorithm. Following a brief video of this tool. http://www.youtube.com/watch?v=RSDuXJHjvgE
10.2 Pre processing tab The Pre processing tab allows for the manipulation of images before the actual classification process.
10.2.1 Clip multiple rasters tab The tab Clip multiple rasters allows for cutting several image bands at once, using a rectangle defined with point coordinates or a boundary defined with a shapefile. Raster list • [ Refresh list ]: refresh layer list; • [ Select all ]: select all the rasters to be clipped. Clip coordinates • [+]: click on the map for the definition of the Upper Left (UL) and Lower Right (LR) point coordinates (X and Y) of the rectangle used for clipping; • Use shapefile for clipping: if checked, use the selected shapefile (loaded in QGIS) for clipping, overriding point coordinates; • < No data value >: set the value for ‘No data’ pixels (e.g. outside the clipped area); • [ Clip selected rasters ]: open a window for choosing the output destination; rasters selected in the Raster list (page 53) are clipped, saved in the output directory with the prefix clip_, and automatically loaded in QGIS. Following a brief video of this tool. http://www.youtube.com/watch?v=8FL0A6eVyzk 10.2. Pre processing tab
53
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 10.3: Clip multiple rasters
54
Chapter 10. Main Interface Window
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
10.2.2 Landsat tab
Figure 10.4: Landsat The tab Landsat allows for the conversion of Landsat images from DN (i.e. Digital Numbers) 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 the Landsat conversion to TOA and DOS1 correction, see Landsat image conversion to reflectance and DOS1 atmospheric correction (page 75)). Landsat conversion to TOA reflectance and brightness temperature • [ Select a directory ]: select the Directory containing Landsat bands (file names thereof must end with the respective number) and the metafile (a .txt file whit the suffix MTL) are stored; all bands found in this directory are converted automatically (it works with Landsat 4, 5, 7, and 8); • [ Select a directory ]: open a window for choosing the Output directory of converted bands; • Brightness temperature in Celsius : if checked, convert brightness temperature to Celsius (default is Kelvin); • Apply DOS1 atmospheric correction : if checked, the DOS1 atmospheric correction is applied to all the bands (thermal bands excluded); • Use No data value : if checked, ‘No data’ values are not counted during the DOS1 calculation of DNmin (for more information about the Landsat conversion to TOA and DOS1 correction, see Landsat image conversion to reflectance and DOS1 atmospheric correction (page 75)); 10.2. Pre processing tab
55
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• [ Create Virtual Raster ]: if checked, a virtual raster named landast.vrt is created and loaded in QGIS after the conversion; • [ Perform conversion ]: start the conversion process; converted Landsat bands are saved in the output directory with the prefix RT_, and automatically loaded in QGIS. Tip: only the bands found in the Directory containing Landsat bands are processed; therefore, it is possible to convert only certain bands if the other ones are removed from the input directory. The metafile (MTL) is always required. http://www.youtube.com/watch?v=pNXKGoDy0ag
10.3 Post processing tab The tab Post processing provides several functions that can be applied to the classification output.
10.3.1 Accuracy tab
Figure 10.5: Accuracy The tab Accuracy allows for the comparison of a classification to a reference shapefile in order to assess the classification accuracy. The reference shapefile must have two fields named the same as the Macroclass ID and Class ID fields in the training shapefile; if Use Macroclass ID is checked in the Classification algorithm (page 47), then the Macroclass ID field of the shapefile is used as reference for the classes, otherwise the Class ID field is used.
56
Chapter 10. Main Interface Window
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Error Matrix Input • Select the classification to assess : select a classification raster; • Select the reference shapefile : select a shapefile, used as reference layer (ground truth) for the accuracy assessment; • [ Refresh list ]: refresh layer list; • [ Calculate error matrix ]: open a window for choosing where to save the error raster (i.e. a .tif file showing the errors in the map, where each value represents a class of comparison between the classification and reference shapefile, which is the ErrorMatrixCode in the error matrix) and the error matrix (i.e. a .csv file separated by tab, with the same name defined for the .tif file), and start the calculation; the error matrix will be displayed in the tab frame and the error raster will be loaded in QGIS. http://www.youtube.com/watch?v=lSZbief-ZuU
10.3.2 Land cover change tab
Figure 10.6: Land cover change The tab Land cover change allows for the comparison between two classifications in order to assess the land cover changes. Classification input • Select the reference classification : select a reference classification raster; 10.3. Post processing tab
57
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• Select the new classification : select a new classification raster, to be compared with the reference classification; • Report unchanged pixels: if checked, report also unchanged pixels; • [ Calculate land cover change ]: open a window for choosing where to save the land cover change raster (i.e. a .tif file, where each value represents a class of comparison between the two classifications, which is the ChangeCode in the land cover change statistics) and the land cover change statistics (i.e. a file .csv saved in the same folder, with the same name defined for the .tif file), and start the calculation; the land cover change statistics will be displayed in the tab frame and the land cover change raster will be loaded in QGIS. http://www.youtube.com/watch?v=uFZd91E_68o
10.3.3 Classification report tab
Figure 10.7: Classification report The tab Classification report allows for the calculation of class statistics as number of pixels, percentage and area (area unit is calculated from the image itself). Classification input • Select the classification : select a classification raster; • [ Refresh list ]: refresh layer list; • Use No data value : if checked, ‘No data’ values are not counted in the report; 58
Chapter 10. Main Interface Window
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• [ Calculate classification report ]: calculate the report and display it in the tab frame; • [ Save report to file ]: save the report to a .csv file. http://www.youtube.com/watch?v=6aD8vOPydUo
10.4 Band set tab
Figure 10.8: Band set The tab Band set allows for the definition of a set of single band rasters loaded in QGIS, used as Input image. This tab allows for the definition of the Center wavelength of bands, which is required also for single multispectral rasters in order to calculate properly the spectral signatures. If a band set is defined, then the Image list in the Toolbar (page 39) will contain the item >.
10.4.1 Band list • [ Refresh list ]: refresh raster band list; • [ Select all ]: select all raster bands; • [ Add rasters to set ]: add selected rasters to the band set; the band set is stored in the QGIS project.
10.4.2 Band set definition • Wavelength unit: select the wavelength unit; 10.4. Band set tab
59
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• Control bands: – [ ↑ ]: move highlighted bands upward; – [ ↓ ]: move highlighted bands downward; – [ Remove band ]: remove highlighted bands from the band set; – [ Clear all ]: clear all bands from band set; – [ Import ]: import a previously saved band set from file; – [ Export ]: export the band set to a file. • Quick wavelength settings: rapid definition of band center wavelength for several satellite sensors: Landsat 8 OLI, Landsat 7 ETM+, Landsat 4-5 TM, RapidEye, SPOT 4, SPOT 5, SPOT 6, Pleiades, QuickBird; Tip: Although it is recommended to define the Center wavelength of bands, it is possible to assign the band number instead of the wavelength. Of course, the USGS Spectral Library tab (page 51) will not be useful, but the ROI collection and the classification process will still be working. http://www.youtube.com/watch?v=FYaWcG0fX_0
10.5 Settings tab
Figure 10.9: Settings
60
Chapter 10. Main Interface Window
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The tab Settings allows for the customization of the required fields in the training shapefile, and other parameters useful during the ROI collection and classification. In addition, the tab Settings contains debugging utilities for the creation of a Log file (i.e. recording of plugin activities for reporting issues).
10.5.1 Field names of training shapefile • [ MC ID field ]: name of the Macroclass ID field (default is MC_ID); • [ MC Info field ]: name of the Information field (default is MC_info); • [ C ID field ]: name of the ID field (default is C_ID); • [ C Info field ]: name of the Information field (default is C_info); • [ Reset field names ]: reset field names to default. Tip: these settings allow for using a shapefile having different field names, without editing the shapefile. It is sufficient to change the field names according to the shapefile fields. Thus, the shapefile loaded in QGIS will be listed in the Training shapefile (page 41) (see this video ).
10.5.2 ROI style • [ Change colour ]: change ROI colour; this configuration is stored in the QGIS registry; • [ Reset ROI style ]: reset ROI colour and transparency to default; • [- Transparency -]: change ROI transparency; this configuration is stored in the QGIS registry.
10.5.3 Spectral signature • < Plot legend Max number of characters >: limit the text length of names in the spectral plot legend.
10.5.4 Classification process • Play sound when finished: play a sound when the classification process is completed; this configuration is stored in the QGIS registry; • Save algorithm files: in addition to the classification output, save the intermediate files calculated by the classification algorithm (one .tif file for each land cover class representing the similarity of each pixel to the class thereof); this configuration is stored in the QGIS registry.
10.5.5 RAM • < Available RAM (MB) >: set the available RAM (in MB) that will be used during the processes; this configuration is stored in the QGIS registry.
10.5.6 Debug • Records events in a log file : start recording events in a Log file; this configuration is stored in the QGIS registry; • [ Export Log file ]: open a window for choosing where to save the Log file (i.e. a .txt file). • [ Clear Log file content ]: clear the content of Log file. http://www.youtube.com/watch?v=4V4Fh_MWgSA
10.5. Settings tab
61
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
62
Chapter 10. Main Interface Window
CHAPTER 11
Spectral Signature Plot
The Spectral Signature Plot window allows for the displaying of spectral signature plots, which are the signature values (usually reflectance) as a function of wavelength. Signatures can be added to the Spectral Signature Plot through the ROI Creation dock (page 41) and the Classification dock (page 45).
Figure 11.1: Spectral Signature Plot
11.1 Signature list • Table fields: – S : checkbox field; if checked, then signature is displayed in the plot; – MC ID : Macroclass ID; – MC Info : Macroclass Information; – Class ID : Class ID; – C Info : Class Information; – Color : color field; double click to select a color for the plot; 63
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• Plot 𝜎 : if checked, plot the standard deviation for each signature; • [ Remove signatures ]: remove highlighted signatures from the list; • [ Fit to data ]: resize the plot to fit to all the data. • Plot commands (from Matplotlib): –
: Reset to original view;
–
: Back to previous view;
–
: Forward to next view;
–
: Pan axes with left mouse, zoom with right;
–
: Zoom to rectangle;
–
: Unused;
–
: Save plot to a figure (e.g. JPG file);
–
: Unused.
Tip: it is possible to move the legend with the mouse.
64
Chapter 11. Spectral Signature Plot
CHAPTER 12
Scatter Plot
The Scatter plot window allows for the calculation of the ROI scatter plots, which are useful to assess ROI separability choosing between two bands. Pixel values for two raster bands are represented as points in the 2D space.
Figure 12.1: Scatter Plot
12.1 ROI List • Table fields: – S : checkbox field; – MC ID : Macroclass ID; – MC Info : Macroclass Information; – C ID : Class ID; – C Info : Class Information;
65
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
– Color : color field; double click to select a color for the plot; • < Band X >: X band of the plot; • < Band Y >: Y band of the plot; • [ Calculate scatter plot ]: calculate the scatter plot for the ROI checked in the list (it can be time consuming). • Plot commands (from Matplotlib): –
: Reset to original view;
–
: Back to previous view;
–
: Forward to next view;
–
: Pan axes with left mouse, zoom with right;
–
: Zoom to rectangle;
–
: Unused;
–
: Save plot to a figure (e.g. JPG file);
–
: Unused.
Tip: it is possible to move the legend with the mouse.
66
Chapter 12. Scatter Plot
Part IV
Brief Introduction to Remote Sensing
67
CHAPTER 13
Basic Definitions
This chapter provides basic definitions about GIS and remote sensing, as a quick reference for the following tutorials. 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 ore 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. 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), shortwave IR, and thermal IR (see Figure Electromagnetic-Spectrum (page 70)). 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. • 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. 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:
69
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 13.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
70
Chapter 13. Basic Definitions
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 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 wavelengths) 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). For example, Landsat is a multispectral family of satellites developed by the NASA (National Aeronautics and Space Administration of USA), very used for environmental research. 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 8 Bands Band 1 - Coastal aerosol Band 2 - Blue Band 3 - Green Band 4 - Red Band 5 - Near Infrared (NIR) Band 6 - SWIR 1 Band 7 - SWIR 2 Band 8 - Panchromatic Band 9 - Cirrus Band 10 - Thermal Infrared (TIRS) 1 Band 11 - Thermal Infrared (TIRS) 2
Wavelength (micrometers) 0.43 - 0.45 0.45 - 0.51 0.53 - 0.59 0.64 - 0.67 0.85 - 0.88 1.57 - 1.65 2.11 - 2.29 0.50 - 0.68 1.36 - 1.38 10.60 - 11.19 11.50 - 12.51
Resolution (meters) 30 30 30 30 30 30 30 15 30 100 (resampled to 30) 100 (resampled to 30)
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; • 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 72) shows a color composite “R G B = 4 3 2” of a Landsat 8 image (for Landsat 7 it is 3 2 1) and a color composite “R G B = 5 4 3” (for Landsat 7 it is 4 3 2). The composite “R G B = 5 4 3” is useful to identify vegetation, because it is clearly highlighted in red. 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. The spectral signature is the reflectance as a function of wavelength (see Figure Spectral Reflectance Curves of Four Different Targets (page 72)); each material has a unique signature, therefore it can be used for material classification (NASA, 2013). A semi-automatic 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 classification algorithms, but the general purpose is to produce a thematic map of the land cover.
71
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 13.2: Color composite of a Landsat 8 image Data available from the U.S. Geological Survey
Figure 13.3: Spectral Reflectance Curves of Four Different Targets (from NASA, 2013)
72
Chapter 13. Basic Definitions
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
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. Image processing and GIS spatial analyses require specific software such as the Semi-Automatic Classification Plugin for QGIS. Usually, supervised classifications require the user to select one or more Regions of Interest (ROIs) for each land cover class. ROIs are polygons defined over the image that overlay pixels belonging to the same land cover class identified with an ID code (i.e. Identifier). After ROI collection, spectral characteristics of land cover classes are calculated considering the values of each pixel belonging to the ROIs that have the same class ID. Therefore, the classification algorithm classifies the whole image by calculating the spectral characteristics of each pixel, and comparing them to the defined land cover classes. The result of the classification process is a raster (see an example of Landsat classification in Figure Landsat classification (page 73)), where pixel values correspond to class IDs. Of course, there can be errors 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.
Figure 13.4: Landsat classification Data available from the U.S. Geological Survey
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.
73
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Class 1 Class 2 ... Class k Total
Ground truth 1 𝑎11 𝑎21 ... 𝑎𝑘1 𝑎+1
Ground truth 2 𝑎12 𝑎22 ... 𝑎𝑘2 𝑎+2
... ... ... ... ... ...
Ground truth 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). For further information, the following documentation is freely available: Landsat 7 Science Data User’s Handbook, Remote Sensing Note , or Wikipedia. References • Congalton, R. and Green, K., 2009. Assessing the Accuracy of Remotely Sensed Data: Principles and Practices. Boca Raton, FL: CRC Press. • Fisher, P. F. and Unwin, D. J., eds. 2005. Representing GIS. Chichester, England: John Wiley & Sons. • JARS, 1993. Remote Sensing Note. http://www.jars1974.net/pdf/rsnote_e.html
Japan Association on Remote Sensing.
Available at
• NASA, 2013. Landsat 7 Science Data User’s Handbook. Available at http://landsathandbook.gsfc.nasa.gov • Richards, J. A. and Jia, X., 2006. Remote Sensing Digital Image Analysis: An Introduction. Berlin, Germany: Springer.
74
Chapter 13. Basic Definitions
CHAPTER 14
Landsat image conversion to reflectance and DOS1 atmospheric correction
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). The Spectral Radiance at the sensor’s aperture (𝐿𝜆 ) is measured in [watts/(meter squared * ster * 𝜇𝑚)] and for Landsat images it is given by (https://landsat.usgs.gov/Landsat8_Using_Product.php): 𝐿𝜆 = 𝑀𝐿 * 𝑄𝑐𝑎𝑙 + 𝐴𝐿 where: • 𝑀𝐿 = Band-specific multiplicative rescaling ANCE_MULT_BAND_x, where x is the band number)
factor
from
Landsat
metadata
(RADI-
• 𝐴𝐿 = 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) “For relatively clear Landsat scenes, a reduction in between-scene variability can be achieved through a normalization for solar irradiance by converting spectral radiance, as calculated above, to planetary reflectance or albedo. This combined surface and atmospheric reflectance of the Earth is computed with the following formula” (NASA, 2011, p. 119): 𝜌𝑝 = (𝜋 * 𝐿𝜆 * 𝑑2 )/(𝐸𝑆𝑈 𝑁𝜆 * 𝑐𝑜𝑠𝜃𝑠 ) where: • 𝜌𝑝 = Unitless planetary reflectance, which is “the ratio of reflected versus total power energy” (NASA, 2011, p. 47) • 𝐿𝜆 = Spectral radiance at the sensor’s aperture (at-satellite radiance) • 𝑑 = Earth-Sun distance in astronomical units (provided with Landsat 8 metafile, and an excel file is available from http://landsathandbook.gsfc.nasa.gov/excel_docs/d.xls) • 𝐸𝑆𝑈 𝑁𝜆 = Mean solar exo-atmospheric irradiances • 𝜃𝑠 = 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. However, 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 75
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• 𝑇𝑣 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). Alternatively, it is possible to use image-based techniques for the calculation of these parameters, without in-situ measurements during image acquisition. 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 Therfore for Landsat images: 𝐿𝑚𝑖𝑛 = 𝑀𝐿 * 𝐷𝑁𝑚𝑖𝑛 + 𝐴𝐿 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. Band 1 2 3 4 5 7 76
Landsat 4* 1957 1825 1557 1033 214.9 80.72
Landsat 5** 1983 1769 1536 1031 220 83.44
Landsat 7** 1997 1812 1533 1039 230.8 84.90
Chapter 14. Landsat image conversion to reflectance and DOS1 atmospheric correction
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
* from Chander & Markham (2003) ** from Finn, et al. (2012) 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. References • Chander, G. & Markham, B. 2003. Revised Landsat-5 TM radiometric calibration procedures and postcalibration 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, 10251036
• Finn, M.P., Reed, M.D, and Yamamoto, K.H. 2012. A Straight Forward Guide for Processing 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%2 • 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 (Ed.) 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 • 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
77
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
78
Chapter 14. Landsat image conversion to reflectance and DOS1 atmospheric correction
CHAPTER 15
Conversion to At-Satellite Brightness Temperature
For Landsat thermal bands, the conversion of DN to At-Satellite Brightness Temperature is given by (from https://landsat.usgs.gov/Landsat8_Using_Product.php): 𝑇𝐵 = 𝐾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 * 𝜇𝑚); for Landsat images it is given by (from https://landsat.usgs.gov/Landsat8_Using_Product.php) 𝐿𝜆 = 𝑀𝐿 * 𝑄𝑐𝑎𝑙 + 𝐴𝐿 where: • 𝑀𝐿 = Band-specific multiplicative rescaling ANCE_MULT_BAND_x, where x is the band number)
factor
from
Landsat
metadata
(RADI-
• 𝐴𝐿 = 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) The 𝐾1 and 𝐾2 constant for Landsat sensors are provided in the following table: Constant 𝐾1 (watts/meter squared * ster * 𝜇𝑚) 𝐾2 (Kelvin)
Landsat 4* 671.62 1284.30
Landsat 5* 607.76 1260.56
Landsat 7** 666.09 1282.71
* from Chander & Markham (2003) ** from NASA (2011) For Landsat 8, the 𝐾1 and 𝐾2 values are provided in the image metafile. References • Chander, G. & Markham, B. 2003. Revised Landsat-5 TM radiometric calibration procedures and postcalibration dynamic ranges Geoscience and Remote Sensing, IEEE Transactions on, 41, 2674 - 2677 • NASA (Ed.) 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
79
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
80
Chapter 15. Conversion to At-Satellite Brightness Temperature
Part V
Tutorials
81
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The following is a basic tutorial about the use of the Semi-Automatic Classification Plugin. Using a semiautomatic approach we are going to rapidly classify a Landsat 8 image and estimate land cover area, in only six phases. Download the sample dataset, which is a subset of a Landsat 8 image acquired over Rome, Italy on June 12, 2014 (data available from the U.S. Geological Survey). The zip file can be extracted with any file archiver software (for instance the open source 7-zip). The dataset includes the metadata file (MTL.txt) and the following Landsat 8 bands (16 bit raster) : • Band 2 = Blue; • Band 3 = Green; • Band 4 = Red; • Band 5 = Near-Infrared; • Band 6 = Short Wavelength Infrared 1; • Band 7 = Short Wavelength Infrared 2. The objective of this tutorial is to classify the following land cover classes: • Class 1 = Water (e.g. surface water); • Class 2 = Vegetation (e.g. grassland or trees); • Class 3 = Built-up (e.g. artificial areas, buildings and asphalt); • Class 4 = Bare soil (e.g. soil without vegetation). Following, the tutorial phases are illustrated along with a brief description thereof.
83
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
84
CHAPTER 16
Pre processing: Conversion of raster bands from DN to Reflectance
The pre processing phase is required before the actual image processing in order to improve the classification results. SCP allows for the automated conversion of Landsat DN (i.e. Digital Numbers) to the physical measure of Top Of Atmosphere reflectance (TOA, see Basic Definitions (page 69)). Also, SCP implements an image-based atmospheric correction using the DOS1 method (Dark Object Subtraction 1) as described in Landsat image conversion to reflectance and DOS1 atmospheric correction (page 75). In addition, we are going to create a color composite of the image. In particular, the composite RGB = 543 (that is the equivalent of RGB = 432 for Landsat 7) 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). Steps: • Open QGIS and start the Semi-Automatic Classification Plugin; • Select the Pre processing tab (page 53) > Landsat tab (page 55);
85
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• Select the directory that contains the Landsat bands (and also the required metafile MTL.txt), and select the output directory where converted bands are saved; • Check the option Apply DOS1 atmospheric correction, and click Perform conversion to convert Landsat bands to reflectance (leaving checked Create Virtual Raster);
86
Chapter 16. Pre processing: Conversion of raster bands from DN to Reflectance
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• At the end of the process, converted bands are loaded in QGIS. Also, a virtual raster named landsat.vrt is loaded (containing all the Landsat bands converted to reflectance), which is useful for the creation of color composites; • Select the Landsat virtual raster, left click and open its properties; in Style select band 4 (i.e. NearInfrared) for the red band, band 3 (i.e. Red) for the green band, and band 2 (i.e. Green) for the blue band.
87
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
The result of the color composite is shown in the following image.
88
Chapter 16. Pre processing: Conversion of raster bands from DN to Reflectance
CHAPTER 17
Definition of the classification inputs
We need to define the input image (i.e. the Landsat bands), the training shapefile (for the ROI collection), and the signature list file (which stores the spectral signatures calculated from ROIs or imported from other sources) in SCP. Steps: • Select the Band set tab (page 59) (also, a button is available in the SCP Toolbar (page 39)); click the button Select All, then Add rasters to set (order the band names in ascending order, from top to bottom using the arrow buttons); then, select the Landsat 8 OLI from the combo box Quick wavelength settings, in order to set automatically the center wavelength of bands.
• In order to create the training shapefile, in the ROI Creation dock (page 41) click the button New shp, and 89
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
select where to save the shapefile (for instance ROI.shp); • Click the button Save in the Classification dock (page 45), in order to create a signature list file (for instance SIG.xml). In the SCP Toolbar (page 39), the name > is displayed in the combo box Input image. The shapefile name is displayed in the Training shapefile (page 41) combo box, and the path to the xml file is displayed in the Signature list file (page 45). Now we are ready to collect the ROIs.
90
Chapter 17. Definition of the classification inputs
CHAPTER 18
Collection of ROIs and Spectral Signatures
ROIs are polygons drawn over homogeneous areas of the image that represent land cover classes. ROIs can be drawn manually or with a region growing process (i.e. image segmentation that groups similar pixels), and they should account for the spectral variability of land cover classes. SCP calculates the spectral signatures (which are used by classification algorithms) considering the pixel values under each ROI. SCP allows for the definition of a Macroclass ID (i.e. MC ID) and a Class ID (i.e. C ID) for each ROI or spectral signature, 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 we could classify grass (e.g. ID class = 1 and Macroclass ID = 1 ) and trees (e.g. ID class = 2 and Macroclass ID = 1 ) as a vegetation class (e.g. Macroclass ID = 1 ) as shown in Figure Macroclass example (page 91).
Figure 18.1: Macroclass example Every ROI (or spectral signature) should have a unique C ID, while the MC ID can be shared with other ROIs. In the Classification dock (page 45) it is possible to choose between MC ID and C ID classification. Steps:
91
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• In order to create a ROI, in the dock ROI Creation dock (page 41) click the button + beside Create a ROI and then click any pixel of the image; zoom in the map and click on a blue pixel of the Tiber river (in order to define the ROI extent, change the ROI parameters (page 43) for Min ROI size and Range radius); after a few seconds the ROI polygon will appear over the image (a semitransparent orange polygon); Tip: ROIs are placed inside a group named Class_temp_group; if no ROI is displayed, move the group on top of other layers in QGIS.
• Under ROI Signature definition (page 44) type a brief description of the ROI inside the field C Info and MC Info, and assign a Macroclass ID and Class ID (these codes can renamed and changed later from the ROI list (page 43) table, thus changing also the values in the training shapefile); • In order to save the ROI to the training shapefile click the button Save ROI; if the checkbox Add sig. list is checked, then the spectral signature is calculated and added to the Signature list (page 45) table; also, it is possible to add signatures later, highlighting the ROIs in the ROI list (page 43) and clicking Add to signature (if two or more highlighted ROIs have the same MC ID and C ID, a unique spectral signature is calculated considering all the pixels that are under those ROIs);
92
Chapter 18. Collection of ROIs and Spectral Signatures
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• Define the color of classes that will be used in the classification, with a double click on the Color column in the Signature list (page 45) (the signature list is automatically saved when you save the QGIS project, or when you click the button Save in the Classification dock (page 45)).
Repeat the above steps for every land cover class, and assign to each ROI a new incremental Class ID, and the following Macroclass IDs: • Water (e.g. surface water): MC ID = 1 • Vegetation (e.g. grassland or trees): MC ID = 2 • Built-up (e.g. artificial areas, buildings and asphalt): MC ID = 3 • Bare soil (e.g. soil without vegetation): MC ID = 4 Following, a few examples of ROIs created for these land cover classes. After the collection of several ROIs, it is useful to display the spectral signatures thereof, in order to assess the spectral similarity:
93
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 18.2: Bare soil
Figure 18.3: Vegetation: trees
94
Chapter 18. Collection of ROIs and Spectral Signatures
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Figure 18.4: Vegetation: grass
Figure 18.5: Built-up
95
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• In the Signature list (page 45) table, highlight one or more signatures, and click the button ; in the Spectral Signature Plot (page 63), if the checkox Plot 𝜎 is checked, then the plot will display the standard deviation of signatures.
You can download the final training shapefile and spectral signature list, where 11 spectral signatures were collected.
96
Chapter 18. Collection of ROIs and Spectral Signatures
CHAPTER 19
Classification of the study area
SCP allows for classification previews, in order to assess very rapidly the classification results. Classifications previews are useful during the collection of ROIs, and for the selection of the more accurate spectral signatures. If the preview results are considered good (i.e. classes are correctly identified), the classification of the entire image can be performed. Otherwise, it is possible to remove one or more spectral signatures, or add new spectral signatures creating other ROIs as described in Collection of ROIs and Spectral Signatures (page 91). Steps: • In the Classification dock (page 45), under Classification preview (page 47) set Size = 500 (i.e. the side of the classification preview in pixel unit), and select the algorithm Spectral Angle Mapping; click the button + and then click on the image; after a few seconds, the classification preview will be displayed;
• Check Use Macroclass ID, and click the button Redo; another preview will be performed, but now using macroclasses;
97
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• In order to perform the final classification, click the button Perform classification and select where to save the output (e.g. classification.tif).
The final land cover classification can be downloaded from here. Tip: during the ROI/Signature collection, perform some classification previews using the Class ID, in order to assess how individual spectral signatures affect the classification; then check Use Macroclass ID, in order to calculate the final land cover classification.
98
Chapter 19. Classification of the study area
CHAPTER 20
Calculation of classification accuracy
The accuracy assessment of land cover classification is useful for identifying map errors. SCP allows for the calculation of accuracy comparing the classification raster to a reference shapefile. Usually, accuracy assessment requires ancillary data and field survey. In this tutorial we are are going to compare the land cover classification to the training ROIs. Steps: • Select the Post processing tab (page 56) > Accuracy tab (page 56);
• Select the classification.tif beside Select the classification to assess and select the ROI shapefile beside Select the reference shapefile;
99
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
• Click the button Calculate error matrix and select a directory where the error matrix (a .csv file separated by tab) and the error raster are saved; the error matrix will be displayed, and the error raster will be loaded in QGIS, showing the errors in the map (each value of this raster represents a class of comparison between classification and reference shapefile, which is the ErrorMatrixCode in the error matrix file).
The results of the error matrix show an overall accuracy of 95%, which is very good. The following error matrix represents the number of pixels classified correctly in the major diagonal. As you can see, most of the errors are between class 3 (built-up) and 4 (bare soil). Classification 1 2 3 4 Total
Reference 1 87 0 0 0 87
2 0 1327 0 21 1348
3 0 1 4417 268 4686
4 0 17 2 606 625
Total 87 1345 4419 895 6746
From the error matrix file, we have also calculated the accuracy of user and producer; the results show that class 4 (bare soil) has high commission error (100 - user accuracy) and low omission error (100 - producer accuracy). In order to improve the results, we should collect more ROIs and spectral signatures for the bare soil class, paying attention to the spectral similarity with the built-up class. • Class 1: producer accuracy [%] = 100.0; user accuracy [%] = 100.0 • Class 2: producer accuracy [%] = 98.44; user accuracy [%] = 98.66 • Class 3: producer accuracy [%] = 94.26; user accuracy [%] = 99.96 • Class 4: producer accuracy [%] = 96.96; user accuracy [%] = 67.71
100
Chapter 20. Calculation of classification accuracy
CHAPTER 21
Calculation of the area of classes
SCP allows for the calculation of a classification report with the percentage and the area of land cover classes. Steps: • Select the Post processing tab (page 56) > Classification report tab (page 58);
• Select classification.tif beside Select the classification and click Calculate classification report; • After a few seconds the report will be displayed, showing the percentage and the area (area unit is calculated from the image itself).
101
Semi-Automatic Classification Plugin Documentation, Release 3.0.7
Following, the report table. Class 1 2 3 4
PixelSum 2353 178040 269664 125943
Percentage % 0.41 30.91 46.82 21.86
Area [metre^2] 2117700 160236000 242697600 113348700
From these results, we can see that about 31% of the study area is vegetated, 47% is occupied by built-up, 22% is bare soil surface (also in agricultural areas), and 0.4% is surface water. Of course, these figures are the result of a tutorial for demonstrating the main features of the SCP for the land cover classification of a Landsat image; several ROIs for each class are required for a good classification (only 11 ROIs were collected in this tutorial), considering their spectral variability; also, field data is useful for improving the collection of ROIs and spectral signatures. Following the video of this tutorial. http://www.youtube.com/watch?v=Uq2S3_InQ8A Please, visit the blog From GIS to Remote Sensing for other tutorials such as: • Estimation of Land Surface Temperature with Landsat Thermal Infrared Band; • Land Cover Classification of Cropland.
102
Chapter 21. Calculation of the area of classes