Winter 2018 GEOG457/657: Lab 5 – Object Oriented Classification
Topics covered in this lab
- Quick Review of Sentinel data
- Object Oriented Methods
- Collecting Statistics under objects (Feature Extractio)
- Classification (unsupervised using stats for each object)
- Creating Decision Tree nodes (Attributes of the objects)
- Look at Decision Tree modeling for within PCI wizard (Rule Based Classification)
As you are getting closer to completing your last assignment, you are becoming more familiar with Sentinel 2 data. In this lab, we are using the same Terrace scene – but without the Red Edge bands or the coastal aerosol, water vapour or cirrus. Ths approximates the data present in Landsat sensors. The bands have been resampled to 10 metres where necessary.
Objected Oriented Classification with PCI
Software other than PCI was explored for this lab, and although there are great benefits for using the other software (as this model of classification is present in a variety of software – some working very well) – we will stick to what we know. The object oriented approach had lost momentum over the years, but with the use of high resolution data (often with low spectral variation) – it has gained a spot on common practices for Remote Sensing folks. We are going to follow through parts of the work flow laid out in the Object Analyst panel of PCI. THis can be launched from the analysis menu.
Once the menu is open, you should open the help for this wizard
The data for this lab is in /home/labs/geog457/object_oriented_data. There is a sub-folder called scotts_files we can refer as we go through the lab (just in case things go sideways). Although you do not need to own the dataset you may want to copy the terrace_10m_with_SWIR.pix file to you lab5 directory.
The first task for most OO software procedures is to create segments that reflect the shapes of features on the earth. The software can determine the size and shape of these objects from inputs the user supplies. We are going to create segments with the following specifications:
- Scale – 25
- Shape – 0.9
- Compactness – 0.5
- Create a new file (it will hold vectors (perhaps with the ending segments i.e terrace_10m_with_SWIR_segments.pix
- Keep the HC_S25 is you wish or create a new layer
Hit the add and run button
This should only take a few minutes to run. Once it is finished, take a look at the results. Do the size and shape of the features make sense? You are welcome to run the segmentation again to see how the different inputs affect the results. Scott will discuss these factors.
Feature Extraction – Zonal Statistics
This procedure is used to gather information about each input band for under each object (polygons) created by segmentation. Run this procedure with the following inputs:
- Select all the bands from the raster file (the original one used to create the segments
- Use the newly created segmented file from the segmentation procedure above (gaining the attributes/statistics collected)
- Select all Feature attributes except the pure pixel stats (this includes the Geometrical values as well)
Run the process. This should take even shorter than the segmentation.
Review the attributes of the results – do a query (back to GIS)
Once the feature extraction is complete, you can look at the attributes by right click on the layer in the map or file tab and select Attribute Manager. Look at the values to see if they make sense.
Making a Decision Tree Node for Water
Performing a query with low NIR values
After looking at the values, we are going to make our first node of the decision tree. We are going to select out the water from the rest of the data using the following steps:
- In the Attribute Manager –> Query by–>Example
- Make the Query by Example panel larger and select Mean_NIR < 700 (leave the AND value created by the software if you wish)
- Add the query to the statement box
- Hit Apply
- Save your query as water in the query interface
Cleaning up the results
You should see the water in the image selected (almost all of it) and some shadows on the eastern part of the image (about 3/4 of the way to the top on the image). We are going to clean up the data by editing it by:
- ensure the segment layer (vector layer is active
- zoom the area where a section of the tiver is missing
- select the pointer button
- hold the shift key down and select the narrow section (polygon missing from the query) to add it to the selection of polygons
- zoom the extent
- zoom to the polygons depicting shadow on the eastern ridge
- hold the control key down and individually select each polygon to remove them from the query results
- zoom out to see your results
Getting the reverse selection
You can get the opposite of the lakes vector layer by: , r
- reloading the layer you queried (the segmented layer)
- running the query (although the selection is probably still active when you load the vector layer)
- e-add the water polygon and remove the eastern polygons
- record –> invert selection
- right click and save the selected values as a new layer called no-water
Once the select is finished, right click on the vector layer to save your selection as a new vector layer called water in the segmentation pix file.
Create a bit map of the water vector
Using the vector layer you saved for the water, create a bitmap using the POLY2BIT algorithm and then transfer it to the sentinel data file.
Classifying Segmented data
Select the classification in the OO classification toolset and run an unsupervised classification using the following values:
- All the fields in the segment vector layer except the Area, Perimeter and Pixel Value fields (should be 28 of them)
- Name the output field as you wish or leave as the default (OutClassFld).
- 11 clusters
Reviewing the results
The results are presented as semi-transparent polygons each being place in classes from 1-10 with water being unclassified. We also see that the water polygons are confused with some forested area, so perhaps a series of classifications using and NDVI sampled data set (and removing other channels) may have helped as a preliminary classification.
You can also see that as the number of the classes increases the number of segments within those classes decreases.
Extracting another class for the tree
Extracting the newer cutblocks from scene
We are going to perform the same type of query using the attribute editor using different values than we used to separate water from the scene. There are many methods (such as using and NDVI), but lets try to gather our stats from an unsupervised classification – to see if that helps.
Pixel based classification
We are going to add an unsupervised pixel based classification (the type we are used of using) into the mix by following these steps:
- Perform an unsupervised classification on the Sentinel bands, with 10 classes including all the bands as input
- Run the Feature Extraction process again on the segments (all segments layers – not water only or non-water layers)
- The Feature Extraction should only use the classification channel you created and only the summary statistics values (min, max, mean and standard deviation).
Once the values have been added to the segments, see if you can find a sweet spot in the mean of the class value to see if the segments selected can favour cut blocks and remove non-cut block segments (you have to use the query tool again and add the new query string to the existing cut block query)