Semi-Automatic Classification Plugin: A Python tool for the download and processing of remote sensing images in QGIS

The Semi-Automatic Classification Plugin is a Python plugin for the software QGIS (QGIS Development Team, 2021) developed with the overall objective to facilitate land cover monitoring by people whose main field is not strictly remote sensing, but that could benefit from remote sensing analysis. The Semi-Automatic Classification Plugin provides a set of intertwined tools and a user interface for easing and automating the phases of land cover classification, from the download of remote sensing images, to the preprocessing (i.e. tools for preparing the data to the analysis or other calculations), the processing (i.e. tools for performing the classification of land cover or perform analysis), and postprocessing (i.e. tools for assessing the classification accuracy, refining the classification, or integrating additional data). The processing of remote sensing data can be computationally intensive, therefore most of the developed tools use Python multiprocessing to exploit the system CPU and RAM by splitting the work among multiple subprocesses. The aim of this paper is to describe the main characteristics of the Semi-Automatic Classification Plugin for the land cover classification of remote sensing images.

as GRASS (GRASS Development Team, 2017), GDAL (GDAL/OGR contributors, 2021), and Orfeo Toolbox (OTB Development Team, 2020). These programs allow for the processing of satellite images, nevertheless their use can be difficult for people interested in land cover classifications but specialized in fields other than remote sensing, because of the several steps required for image processing.
The Semi-Automatic Classification Plugin aims to provide a complete suite of tools for processing remote sensing data, easing the phases related to the download, the preprocessing of images, and the postprocessing of classifications, with built-in algorithms developed in Python and third party algorithms for specific functions (e.g. Sentinel-1 preprocessing through ESA SNAP (European Space Agency, 2021)).
Several tutorials about the Semi-Automatic Classification Plugin are freely available on the official website, and the user manual is being translated into several languages by the user community.

Overview of the Semi-Automatic Classification Plugin
The Semi-Automatic Classification Plugin interfaces is composed of several modules (as illustrated in Figure 1). A module allows for searching and downloading freely available images (in particular ASTER, GOES, Landsat, MODIS, Sentinel-1, Sentinel-2, and Sentinel-3). It is possible to perform the preprocessing and raster calculations automatically after the download, by setting a few parameters in the user interface. The interface allows to define an image input (named band set) which is the set of raster bands to be processed.
The following tools are available for preprocessing: Congedo, L., (2021). Semi-Automatic Classification Plugin: A Python tool for the download and processing of remote sensing images in QGIS. Journal of Open Source Software, 6(64), 3172. https://doi.org/10.21105/joss.03172 • Conversion to reflectance for ASTER, GOES, Landsat, MODIS, Sentinel-1, Sentinel-2, and Sentinel-3 images; • Clip multiple rasters at once; • Cloud masking based on the values of a raster mask; • Mosaic band sets, merging the corresponding bands of two or more band sets; • Statistic calculation for neighbor pixels; • Reprojection of the coordinates of raster bands; • Splitting or stacking raster bands in a unique file; • Vector to raster conversion.
The following processing tools are available: • Band combination to get a raster where each value corresponds to a combination of input values; • Clustering for unsupervised classification (i.e. without training input); • Principal Component Analysis of band set; • Calculation of the spectral distance between every corresponding pixel of two band sets; • Classification using one of the available algorithms, such as Minimum Distance (Richards & Jia, 2006), Maximum Likelihood (Richards & Jia, 2006), Spectral Angle Mapping (Kruse et al., 1993), and Random Forest (Breiman, 2001).
Considering that semi-automatic classification algorithms require training pixels (i.e. spectral signatures), a specific dock interface for training input creation and spectral signature calculation is available, which allows to create polygons interactively (manually or through region growing) and import spectral libraries such as the USGS Spectral Library (Kokaly et al., 2017). The interface allows to create classification previews on small portion of the image to assess the results before launching the classification process for the whole image. In addition, the plot of spectral signatures can be visualized in order to assess the spectral separability of signatures.
A band calculator is available for performing mathematical and conditional calculation using input rasters, for instance for the calculation of spectral indices.
The following postprocessing tools are available for refining the classification output and further analyses: • Accuracy assessment of the classification; • Classification dilation, erosion, and sieve for refining the patches of the classes; • Classification report for calculation of class statistics such as number of pixels, percentage and area; • Conversion of classification from raster to vector; • Manual editing of raster values; • Assessment of land cover change comparing two classifications; • Statistics related to an input raster for every unique value of a reference vector or raster; • Reclassification of raster values.
Finally, the tool Batch allows for performing a series of functions consecutively and automatically through the definition of a script.
The Semi-Automatic Classification Plugin for QGIS is developed with Python 3 and requires the installation of GDAL, NumPy, SciPy, and Matplotlib (as illustrated in Figure 2). The user interface is developed using the Qt framework. The additional installation of SNAP (European Space Agency, 2021) is required for the Sentinel-1 preprocessing and random forest classification tools. A testing tool is available for verifying the correct installation of the required dependencies and check the main functions of the Semi-Automatic Classification Plugin.