This Weeks Lab
- Reviewing Classification
- Prepare some data
- Segmentation using Idrisi
- Creating objects (segments) with Feature ObjectX
Unsupervised approach in this course for the most part
We generally are using unsupervised classification in this course, as it illustrates the concepts we are trying to get across without having to seed a bunch of stuff to produce classifications. We are going to perform some unsupervised classifications in this lab, but we will be referring to the use of a supervised approach often.
Load up some data – and classify it
Open up Focus and load in the file: /home/labs/geog457/classification_object_oriented/mcbride/subset_93h.pix. This file was created from a subset of a Landsat 8 scene, but trimed to fit the 93H map sheet.
Perform an unsupervised classification wit 10 classes, then look for the cutblocks in the scene – what class(s) is the cutblock in? This of course requires that you copy the file into your own workspace.
How do the cutlblocks and the avalanche shoots compare. Are they in the same class.
Add a DEM layer and do some more classifying
Perhaps the location of avalanche shoots can be drawn out by the elevation they are found at – or perhaps slope can play a part in the separation of cutlblocks and avalanche shoots.
Take the steps necessary to get the DEM layer: /home/labs/geog457/classification_object_oriented/dem_data/93h-dem25m-utm.asc into your subset file. You can eliminate the striping issues we get from going from one projection to another by setting your parameters in the reproject window to:
- Resampling methood – Cubic
- Transform Order – 4 Order
- Sampling interval – 4
Here is a screenshot of the layout for the resampling:
Then try the unsupervised classification again. Try it with slope, and see if that helps to separate the two land features.
If the problem still persists, so we need another method to distinguish the two land features into separate classes. The difference is their shape…
Taking the classification into a vector layer
We are going to see if we can perform some shape index functions of the vectors from class that holds the cutblocks and avalanche shoots. Do this by following theses steps:
- put the pixels that represent the class into a separate channel
- convert the pixels in that channel to a vector layer
- bring the layer into QGIS
Perform a shape index on the layer in QGIS
- Open the layer into QGIS
- Load the processing toolbox
- find and execute “Polygon Shape Indices”
- look to see if you can extract out the different features by the shape indices created in the attribute table
What is Object Classification
There is a fair bit of literature explaining he concept of Object Oriented Classification for Remote Sensing, but it really comes down to braking down a pixel based classification into different indices. For instance we have been trying to separate the cutblocks from avalanche shoots – but the digital signatures are too close to separate them. What if we take the results from the pixel based classification and try to separate the features based on its shape? We then are creating a hierarchy of decisions to be applied to each classified polygon. Below are a couple articles that explain some of these methods.
Prepare some data in PCI
Create an unsupervised classification from a pix file you wish to use
Using a file in your home directory, create an unsupervised classification for use in this lab later on (way at the end actually).
Clip out an area
Using PCI create an area of interest (maybe 1000X1000) pixels in size that has a mixture of DN values (i.e. some water, some slopes and a variety of landcover features) from you Bowron data set.
You can use larger images, but for this exercise – a smaller set is easier.
We are looking to classify features in the landscape. For instance we could look at classifying a river based on its shape not just its DN values (i.e Nechako vs Fraser). Subset out the channels you want to use for this lab from a pix file to a tif file.
Segmentation using Idrisi
Log into osmotar and start the program Idrisi Selva. We are going to follow Roger’s excercise for creating objects in Idrisi. I have not been able to get it to work fully, but lets spend some time and see if we can get it to work.
Things to test after you have played around with the software
You can add what ever layers you want to the project.
- Try just the 3 satellite bands with simularity tolerance of 50 and 100
- Add the DEM layers with a lower weight at 50 for the tolerance
- Better yet, create a slope or shaded relief layer to see if that affects your results
- When performing Segtrain – make sure you have enough classes to have variety – as all pixels will be grouped by these classes
- Try the mindist classifier, but also try an unsupervised classified image from PCI
Excerpts from Roger’s Document
1. preparing and managing data in Idrisi
We dis this step above – but a gentle reminder
IDRISI cannot directly read a .PIX file, so the easiest format will likely be a .TIF
In PCI, use utilities -> translate to create a .TIF either keep all 4 bands, or just 2,3 and 4
You might also consider reducing its size
Tools -> Clipping/subsetting can reduce and save as tif in the same step.
2. IDRISI SELVA START
Idrisi is windows based software
Start Idrisi -Selva from Start -> all programs -> IDRISI
Warning: Roger was raised on Idrisi versions 1-7 but lost touch with later versions (now 16), so in some areas, you may be boldly going where no UNBC’ers have boldly gone before
Briefly flip through the menu dropdowns to tally the many options
Set up your workspace
Before we go to far, set up your workspace follow these steps:
- expand the Idirsi Explorer pane below the pulldown menus on the left
- Under the projects tab – create a new project and direct it to a folder in your labs folder called idrisi
- in the lower pane set your working folder to the same (click on your new project name to expose the working folder)
Getting a feeling for Idirsi
Have a brief look at help -> Quick start
Follow the instructions under Idrisi Explorer to set your project environment to a folder under your own workspace, the default otherwise is on the server where the software is located, and none of us even (especially) me can write data here
Get you data in
TIF file conversion / import
In the same menu, you can import your tif file for the lab: (Do it!)
Help-> ESRI quick start -> TIF import
(this option is also available from the pulldown menu through reformat-> convert)
There are several other ways to bring in TIF files – even one that uses the same method as QGIS.
Idrisi Raster files
The native format for raster files is .RST
Unlike PIX files, these are single bands but multiple bands can be grouped as a .RGF
Display the data
To display a raster band :
Display -> display launcher
Take the defaults to display one of your bands -> OK = to the PCI pseudocolour display
Repeat, selecting the grayscale option
To display a 4-3-2 (or a 6-4-3 for landsat 8) colour composite, select display -> COMPOSIT and proceed
(the band numbers may have changed during the import / convert process).
HINT: The order they are put into the composite is the order you click on them
The modules we will need are under the Image Processing dropdown ->
Open the help for segmentation and peruse
Select input files and output prefix, otherwise accept defaults. It does seem easier to add in a raster group for the input bands (there should be a raster group created when you added in the tif file of all the band originally).
The results are a bit staggering, zoom in to see the results. You can see that perhaps playing with the parameters may produce different results. What are we looking at here?
SEGTRAIN creates training and signature files from a segmentation file (.VCT) created with SEGMENTATION. The user interactively creates signatures (.SCF) and assigns class names and IDs directly from the segmentation file.
SEGTRAIN uses the vector layer created in the previous step.
Follow the SEGTRAIN operations instructions in the help menu – use the same classes you may have saved earlier in the lab (in PCI) to do the next step (step 5). PAINFUL and you may need to restart a few times…
The final result includes training signature files that will be used in classification
The final stage SEGCLASS is a majority rule classifier based on the majority class within a segment. It requires an already classified image and segmentation image.
The Idrisi Way for classification – we are not going to use it in this lab
The classified image is derived in IDRISI using a pixel-based classifier such as MAXLIKE with the segment-based training and signature files. From what I read, MINDIST might be easier.
There are unsupervised methods as well, such as ISOCLUSTER
The import from PCI way – we are going to use this method
You already have a classified layer in PCI, so simply repeat the earlier steps to translate this layer to a .TIF and convert to .RST
Follow the help for SEGCLASS inputting the classification and segmentation images
InterIMAGE as a solution for Object Image Approach
Scott has taken a look some software for building rules for the Object Approach to classification, but he has not tested it well enough for this lab. To use the software to better create object classification check out:
The software is installed on Osmotar, but Scott has it working with Wine on the Linux machines, he can show you how to install it as well.