The purpose of this tutorial is to outline the basic process of performing a supervised classification using imported training sites. When performing a supervised classification, you will often have a vector file that you want to use for the training sites. This file may have been created in other software and may be in non-pix format such as a shapefile. You can import this dataset into Geomatica to complete the classification.
Preparing Your Data
A shapefile was used as the training site vector file in this tutorial. This shapefile was created in Geomatica but the same process will work with any vector format supported in the Geomatica Generic Database Library (GDB). It is important to note that the vector that you use for the training sites must have an integer field with the classification information. The image below shows the attributes of an acceptable shapefile. The class field is an integer value which represents the class for each polygon.
Enough training sites should be collected to ensure a good representation of each type of land cover. The image below shows the training sites that will be used in this tutorial. The imagery that is used is the irvine.pix file which is available in the demo data download package from the PCI Geomatics website. http://www.pcigeomatics.com/Download2015
In order to complete the supervised classification you will need to add two new raster layers to your imagery. One of these layers will be used to store the training sites and the classification will be written to the other layer.
- In Focus, from the files tab right-click the folder with your imagery.
- Select New Raster Layer
- In the Add Image Channels window add two 8 bit channels to the Irvine image.
Importing the Shapefile as Training Sites
Once you have prepared your imagery and training set data you can begin the supervised classification.
- In Focus, navigate to Analysis Image Classification Supervised.
- From the File Selector window choose the imagery that you wish to classify.
- The Session Selection widow will open. Click New Session.
- Next you will reach the Session Configuration window.
- Select all 5 TM bands as the Input Channels.
- Select your first new channel as the Training Channel
- Select your second new channel as the Output Channel.
- Your Session Configuration window should resemble the example below.
- Click OK
5. The Training Site Editor will open. In this window navigate to Class > Import Vector
6. From the Import Vectors window browse to your vector file
- When the vector file is loaded, check the Polygon Boundary box and change the Field box to the field where you stored the classification integer.
- Click Rasterize
7. The Training Site Editor window will open and display each of the classes from your shapefile.
8. Make sure that your Training Sites resembles the image above.
9. Click Save & Close to close this window.
Running the Classification
Now you can complete the classification using the imagery and the newly rasterized training sites
1. From the Maps tab right-click the Classification Metalayer. Choose Run Classification
2. From the Supervised Classification window choose Maximum Likelihood as the algorithm type. Click OK
3. Once the classification has finished running an output result will be added to the Classification MetaLayer which should resemble the image below. You can also load the final output band of your image to view the classification. You can change the colours of the classification to better represent the features that are classified.
- Right-click the classified image and choose representation editor. In this window you can change the colours for each class.
Optional Step: Run SIEVE
As demonstrated by the image above, there will likely be small areas with different classifications. To filter out very small polygons in a class you can run the SIEVE function. In this function you set a polygon size threshold and any area below that threshold will be merged with the surrounding classification.
- From the algorithm librarian, search for the SIEVE algorithm.
- When the SIEVE Module Control Panel is open choose your output classification band as the Input Raster Layer and save the output file.
- For the Input Parameters set the Polygon Threshold. In this tutorial the value 2 is used.
- Click Run
The final output should look similar to the image below. You can change the polygon value depending on the level of aggregation that you require.
Optional Step: Run RAS2POLY
A final optional step that you may wish to complete is converting the classified raster to polygons.
- Open the RAS2POLY algorithm from the algorithm librarian.
- Choose the final classified image (either original output of Sieve output) as the Input Raster Layer.
- Save the output polygon layer to a new file. Click Run
The final output vector layer will look similar to the image below.