Académique Documents
Professionnel Documents
Culture Documents
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
3. Tutorials
The following is a basic tutorial about the use of the Semi-Automatic Classification
Plugin. However, visit the blog From GIS to Remote Sensing for new and updated
tutorials such as:
Estimation of Land Surface Temperature with Landsat Thermal Infrared Band;
Land Cover Classification of Cropland.
In this tutorial we are going to classify a Landsat image (single band rasters). Download
the sample dataset, which is a Landsat 8 image (a subset acquired in the South of Rome,
Italy) available from the U.S. Geological Survey. The following bands (each band is a
single 16 bit raster) are included in the file:
2 - Blue;
3 - Green;
4 - Red;
5 - Near-Infrared;
6 - Short Wavelength Infrared 1;
7 - Short Wavelength Infrared 2.
The Semi-Automatic Classification Plugin uses SAGA GIS for the classification process.
The SAGA algorithms work only with single band images as input. Therefore, if input is a
multi band raster (i.e. a single image file made of several bands), the Semi-Automatic
Classification Plugin automatically splits the input file to single band rasters, which takes
some time depending on raster size. In order to optimize the classification process
(especially for hyperspectral images), it is preferable to use single band rasters, or split
the image file to single bands, as explained here (point 1) .
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
1/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
In the plugin dock ROI creation click the button Band set besideSelect an image;
the tab Band set will open; click the button Select All, then Add rasters to set;
under Band set definition, order the band names in ascending order, from top to
bottom using the arrows (this is useful for the interpretation of spectral
signatures);
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
2/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
Now we need to create a training shapefile that will store ROIs (a polygon layer
that requires two fields ID_class and ROI_info in the attribute table); in the dock
ROI creation click the button New shapefile, and select where to save the shapefile
(for instance ROI.shp).
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
3/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
Hint: in order to use any shapefile (having different field names for ID and Information)
as training shapefile, it is possible to change the default field names in the tab Settings
of the main interface, according to the existing field names. When needed, the plugin
will add automatically other fields for the spectral signature calculation.
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
4/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
Now, check Rapid ROI on band and click the button Redo ROI; this way, ROIs can
be computed only on one selected band, saving time especially for
hyperspectral images; change the value to 4 beside Rapid ROI on band, and click
the button Redo ROI; as you can see, ROIs have different shapes depending on the
selected band;
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
5/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
Open the Settings tab of the main interface; under ROI style it is possible to
change colour and transparency of created ROIs as you wish.
6/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
of each ROI; you can pan and zoom through the plot using the navigation toolbar
(provided by Matplotlib).
Hint: in the tab Settings of the main interface, it is possible to change the maximum
number of characters for ROIs of the plot legend (which is 15 by default).
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
7/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
8/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
It is also possible to import a list of points, maybe from field survey; download
this text file, click the button Import and select the downloaded file;
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
9/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
In order to create and save the ROIs to the shapefile click Create and save ROIs (it
takes some time, depending on the number of points).
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
10/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
Created ROIs are displayed in the ROI list; double click on any item to zoom to the
corresponding ROI in the map; also, it is possible to delete selected ROIs using
the button Delete selected ROIs.
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
11/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
12/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
Hint: after adding a new class to the training shapefile, repeat the above steps to
overwrite the .qml file and update the classification style.
A large number of ROIs is required for a good classification. Download this training
shapefile , which contains several ROIs, and load it in QGIS.
The main output of a classification is a raster file .tif; click the button Perform
classification and select where to save the output (e.g. classification.tif); use the
classification style from this file zip ;
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
13/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
If the checkbox Calculate accuracy is checked, than the error matrix is calculated
and saved as file .txt in the same directory of the .tif file (also, it is automatically
displayed in the tab of the plugin main interface Post processing > Accuracy); the
error matrix is calculated by comparing the classification to the training shapefile
used for the classification (see below Post processing tools);
It is possible to apply a mask shapefile to the classification; download this
shapefile , check the checkbox Apply mask and select the downloaded shapefile;
click the button Perform classification, and the classification will be saved along
with the error matrix and the vector output.
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
14/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
It is useful to calculate the land cover change (through GDAL and Numpy)
between a reference classification raster and a new classification raster; download
this classification (pretend this is the last year classification); select the tab Post
processing > Land cover change of the plugin main interface, select the
downloaded classification as reference classification, and the classification.tif as
the new classification; click the button Calculate land cover change and select
where to save the raster of changes and the related table (i.e. a file .csv, whose
values are separated by tab); pixel values of the raster of changes (ChangeCode)
are described in the table, and each value represent a class of change from the
reference classification to the new classification;
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
15/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
16/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
If the checkbox Mask unchanged pixel is checked, then unchanged pixels will have
a value of 0 (Unclassified).
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
17/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
18/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
19/20
12/9/2015
3.TutorialsSemiAutomaticClassificationPlugin2.5.1documentation
http://semiautomaticclassificationmanual.readthedocs.org/en/latest/Tutorials.html
20/20