Instructor: Brian Klinkenberg

Office: Room 209
Office hours: Tues 12:30-1:30
Wed 12:00-1:00

TAs: Katie De Rego and Leo King

Office hours in Room 115
Katie: Thur @ 9:00
Leo: Mon @ 10:00

Lab Help: Jose Aparicio

Office: Room 240D

Computer Lab: Rm 115

 

 

Lab 6: Introduction to Image Analysis: Supervised Image Classification

Due: Next week, at the beginning of your lab.

Marks: 25

Background to Lab 6

In Lab 5 you classified the Morro Bay data using two unsupervised classification methods: CLUSTER and ISOCLUST. In this lab you will perform three supervised classifications on the Morro Bay image by identifying 'training data' and using that information to guide the classifications. You will use two hard classifiers (MINDIST, MAXLIKE) and one soft classifier (BAYCLASS). These are described in detail in the IDRISI manual in the Classification section.

Optional additional readings: Recall that there is a comprehensive IDRISI manual available (C:\Program Files (x86)\IDRISI Selva\Documentation\IDRISI Manual.pdf) that you can copy to a memory stick, should you like to explore IDRISI in more detail.

LOAD DATA information: For this lab, either:

  • Copy the lab5 data that you previously saved, on your H: drive, to C:\data\MorroBay OR
  • Using Windows Explorer, go to: G:\courses\data\IDRISI_labs and copy the Lab5 MorroBay.zip file to C:\Data, etc. (refer to Lab 5 for the detailed instructions).

    Then
  • Set your project and working folders to the appropriate name.
  • Please do not save these folders to your H: drive without first zipping them.

In summary, the three steps required to conduct a supervised classification include:

1) Identify training sites: Selecting homogeneous areas (referred to as 'training sites') in the image that correspond to the land cover classes that you have identified as occurring within the image. This first step involves digitizing polygons (areas) that delimit the training sites--each training site should contain pixels that belong to one of the land cover classes, and should not contain pixels that belong to another class. (You can and should create more than one training site for each class--this may be particularly important if the land cover class is composed of small areas located throughout the image.)

2) Create signatures: Creating signatures for each land cover class, based on the training sites you identified in step 1, is a necessary step that subsequently enables the program to match the remaining unclassified (unknown) pixels to one of the (known) training class signatures.

3) Classify the image: There are a wide variety of methods available with which to assign the unknown pixels to a known class. You can either create a hard classification (i.e., each pixel is assigned to one and only one of the training classes) or a soft classification (i.e., each pixel is given a value that represents its 'membership' or association with each of the training classes) using one of several methods. Each approach / method has its benefits and drawbacks--no one method is necessarily the 'best' since each image, each set of training classes, and each image classification exercise, bring with them a unique set of circumstances. Note that many classification methods implicitly include an 'unknown' class in the results--that is, pixels that cannot be assigned to one of the land cover classes associated with the training sites you identified will be left unclassified. Thus, when viewing the results of a classification you may observe many black pixels--those pixels have spectral response patterns that do not resemble the (average) spectral response patterns captured in the training sites you created.

1 Identify training sites

1.1 Create a composite image. In order to make it easier to select appropriate training sites, you should first create a composite image that allows you to clearly distinguish the different land covers present in the image.

  • Create a composite Compositeof bands 3, 4, and 5, with linear saturation points, using 2.5% saturation. Call the output image Morr345 (if you already have a composite with this name you should overwrite it).

1.2 Enter training data sets using the Morr345 composite

Individual training sites are created by digitizing polygons (the training sites) that altogether contain at least 70 pixels [see footnote at the end of the lab] in areas that (for the purposes of this lab) uniformly represent one of the following 7 classes:

1) Water,   2) Urban,   3) Grass, 4) Forest,   5) Soil,   6) Surf,   7) Sand

These training site polygons will be saved in a vector file. When IDRISI computes the statistics (e.g., mean DN) of the spectral responses within each training class and within each band, it will use the pixels that lie within the boundaries of each training site polygon. It helps to consistently display these classes using the “qual16” palette, so that 1) water = dark blue, 2) urban = yellow, 3) grass = red, 4) forest = light green, 5) soil = purple, 6) surf = dark green and 7) sand = light blue. For the purposes of this lab, assume that the lighter green areas, many of them with regular (e.g., straight) boundaries, are grassy areas, while the irregular darker green areas more often associated with hillslopes (especially in the northeastern portion of the image) are forests.

To create the training site polygons, follow these steps:

1. Within Morr345, zoom in to a region that contains one of the 7 classes, using either the Page Down key and the arrow keys in the composer window, or the Zoom icon. If you start with class 1 (water), and then proceeded through the other 6 classes in the order given above, you will find it much easier to keep track of your work. It may help you in identifying appropriate training sites if you have your Morrisoclust image [created in Lab 5] available for reference purposes. That is, your training site polygons should, ideally, be located in areas identified as relatively homogeneous in your Morrisoclust image. However, it is also important to capture the range of spectral responses associated with a land cover class. As you might infer, creating appropriate training sites is not an easy process!

2. Select the Digitize icon Digitize icon(cross-hairs in circle)

    • Choose polygon for the layer type, and
    • trainingsites for the name of the layer file.
    • Make qual16 the palette for this layer. You can make sure this is your default qualitative palette by clicking on File / User preferences and selecting Display settings.
    • You will be producing a single file that contains all of the training sites for the seven land use classes (doing so makes the signature creation process easier).
    • Accept the default data type “Integer” and the “id or value”’ of 1, which indicates that you are creating a training site associated with land cover class 1.

3. Using the left mouse button, click to define the outline of a polygon (the training site--note that the shape of the polygon can be as complicated as you like, but do not allow your polygon outlines to cross) that contains only water (but not surf areas).

  • End your digitizing at the start position by right-mouse-clicking (that is, the digitize program automatically 'closes' the polygon by joining the last point you digitize with the first point you digitized).
  • To erase a polygon that accidentally includes more than one land cover class, use the Delete digitized feature Delete Feature icon to the right of the Save digitized data icon Save digitized feature--this process can be frustrating, so you may want to start the digitizing process again, depending upon how many polygons you have digitized. Note that you first have to save your edits before you can delete the incorrectly digitized polygon.
  • Save your polygon by clicking on the red angled arrow icon Save digitized data (Save digitized data).

4. Return to the full image size using unzoom (e.g., the Home key), and then zoom into an area that represents the next training site class (urban in this case). (Note that you can zoom in multiple times to get a small area.)

  • Click the digitize icon again – you should see a dialog saying “Add features to the current active vector layer”.
  • Click OK and accept the new ID number of 2. (It is at this point that you could, if you wish, enter a different number. Thus, for example, if you wished to digitize a second training site for water you could enter an ID number of 1.)
  • Left-mouse click to define your new polygon, and close it with a right-mouse click.
  • This newly digitized polygon should appear in the Morr345 image as a new coloured area (if the ID was other than 1), and when you unzoom, you should now see two differently-coloured polygons on the image.
  • If you forget which ID number corresponds to a particular land class, you can click on the cursor inquiry icon Cursor inquiry to remind you.

5. Continue adding polygons until you have identified training sites for all seven land cover classes.

6. Note: If you want to stop and resume the training site polygon digitization process at a later time, you need to start each session by using Display Launcher to bring up the false color composite (e.g. Morr345), and then adding the ‘trainingsites’ vector file to the raster image. If you display the training site polygon layer first, it will be covered by the Morr345 image when you display it.

7. You can also add a legend to the display by selecting “trainingsites” in the Composer window, clicking on “Map properties,” and under “Legend” selecting “Visible” and “Layer: trainingsites”. If you see more legend entries than their are classes (i.e., at most only seven legend entries should be present, corresponding to the seven training classes you have created), you may need to, first, remove the layer trainingsites from the composition and then add it back to the composition.

Question 1: Print out a copy of the Morr345 composite with your training sites, a legend (with the land cover classes named accordingly), and your name added to the image. (3)

2 Signature creation

1. As a first step in the signature creation process, create a raster group file that contains the seven Landsat band images by pulling down “File / Collection editor”, selecting “File / New”, setting the filename to “Morrobay” and the file type “raster group files”. Insert bands “morr1” to “morr7” into the collection, then do File / Save and Exit.

2. Launch IMAGE PROCESSING / SIGNATURE DEVELOPMENT / MAKESIG and select “trainingsites” as the vector file defining the training sites data.

3. Click on “Enter the signature filenames” and name the training sites: 1) water, 2) urban, etc.. Important note: DO NOT include a ' / ' or ' \ ' (slash) in your legend names (e.g., Snow/Ice) as that will cause the following steps to bomb out.

4. Under “Bands to be processed,” click on “Insert layer group” and enter your morrobay raster group file created above in step 1.

5. Press OK and let MAKESIG run. It will create a .sig file for each of your classes, containing the spectral reflectance statistics for each land cover class.

6. Check that you now have seven .sig files by adding the filetypes ‘Signature’ (.sig, .spf) and ‘Signature Group’ (.sgf) from the Filters tab in Idrisi File explorer. Check that all seven of your classes have been written by looking under the Files tab again. You should also confirm that the seven classes have been created under the “trainingsites.sgf” signature group file. Double-click on the trainingsites.sgf group--you should see the seven classes listed there as well.

Question 2: Compare the “grass” and “water” signatures, and the "urban" and "sand" signatures, by:

  • Selecting IMAGE PROCESSING / SIGNATURE DEVELOPMENT / SIGCOMP,
  • setting the number of files to 2 and
  • selecting the two classes (grass and water, or urban and sand) by clicking in the empty boxes, then on the ... and selecting them using the file browser.
  • Check the box that says “Mean, minimum and maximum”.
  • Print out the two plots (one comparing grass and water, and the other comparing urban and sand).

Comment on similarities / differences between the two sets of classes in i) band values and ii) variability within each band. Is there a detectable 'red edge' when looking at the grass signature? How do the values in thermal IR band (which provides a relative Tkin value) compare? (Refer to the table presented in Lab 5 if you can't recall which band is the thermal IR band).) (5)

3 Classification

Idrisi provides a wide selection of classification methods. For the purposes of this lab you will be working with two of the more commonly used 'hard' classifiers--minimum distance (MINDIST) and maximum likelihood (MAXLIKE)--as well as one of the 'soft' classifiers--Bayesian classification (BAYCLASS).

3.1 Hard classifier – MINDIST

Launch IMAGE PROCESSING / HARD CLASSIFIERS / MINDIST

  • Choose “Normalized Z-scores”, and then select
  • “User defined Z scores” and enter 5.0 (i.e., don’t classify any pixel more than 5 standard deviations away from the mean of a training site).
  • Choose "Insert signature group" and
  • supply your sig group "trainingsites."
  • Name the output file MorrMinDist.

You will use this image to answer questions below.

3.2 Hard classifier – MAXLIKE

Launch ANALYSIS / IMAGE PROCESSING / HARD CLASSIFIERS / MAXLIKE

  • Choose “Insert signature group” and
  • supply your sig group “trainingsites”.
  • Select “Use equal prior probabilities for each signature” and exclude 0.01 probability or 1% of questionable pixels.
  • Name the output file MorrMaxLike.

Question 3: Print your classified map of MorrMinDist. Be sure to use the QUAL16 colour palette in Layer Properties (if it isn’t the default already). Include a title, a proper legend and your name on your output. (3)

Question 4: What percentage of the scene is covered by each land class in the MorrMinDist image? (Click on “Histo” in the composer window, select MorrMinDist, and use the values presented with the frequency histogram to get the total number of pixels and the numbers of pixels within each class). (3)

Question 5: How does your classified MorrMinDist image compare to the Morro345 image? What are the major similarities? Where does the classification appear to have failed (e.g., misclassified an area)? (3)

Question 6: Compare the MorrMaxLike results to the Morro345 image. Which of the 2 methods (MINDIST or MAXLIKE) does a better job of successfully classifying pixels into land categories? (Is this a 'fair' comparison of the two methods?) Which areas in particular are consistently misclassified? (4)

3.3 Soft classifier – Bayesian

Launch IMAGE PROCESSING / SOFT CLASSIFIERS / BAYCLASS and select your signature group.

  • Use Equal prior probabilities for each signature.
  • Choose an output prefix (“bay”) for your files. (Note that this procedure creates images for each class, as well as producing a map of the overall classification uncertainty.)
  • The Display Launcher will automatically bring up the “Classification uncertainty” image bayclu.rst once the BAYCLASS process is completed. A value of 0 in this image means that there is no uncertainty associated with assigning that pixel to one of the training classes. As the values get larger (approaching 1.0), that indicates that there is increasing uncertainty as to which of the training classes that pixel should be assigned to.
  • To see the class maps, open Display Launcher. You should see “+bay.rgf”, which can be expanded to a list of seven files (“bayurban”, “baysoil”, etc.); as well, you'll see the same seven filenames listed below the grouping.
  • Select “bayurban” under the bay grouping. You should see bay.bayurban listed as the filename in the display launcher. (It might be helpful to view some of the other images as well, such as baywater and bayforest; doing so might enable you to better interpret the values presented in the uncertainty image bayclu.)

In Composer, click on the button labeled “Feature properties”. This should open up an Attribute / Value table with seven rows. Clicking in the image will display the posterior probabilities for a given pixel within each class map (e.g., baywater, bayurban, baygrass).

Look at the bay.bayurban image and examine several regions where the training has performed poorly (e.g., where Morr345 appears to show an urban area but the classification is something else, or where the classification uncertainty--as expressed by the values presented in in bayclu.rst--is larger than, say, 40%).

Question 7: What land cover(s) is urban commonly (mis)classified as? (1)

Question 8: Why is the urban class so poorly classified? (1)

Question 9: How could we improve the classification accuracy? (2)

 

Footnote

As noted in the Idrisi manual, you should have 10 times as many pixels associated with a training class as there are bands in the images you will be classifying. Since there are seven bands in the Landsat image you are classifying, you should include at least 70 pixels in each training class. Moreover, more pixels (to a limit) are better than fewer, and having more than one training site associated with each class is also good practice. However, you should not create too large a training site (e.g., including the majority of the ocean area in one large training site) since that defeats the purpose of using automated classification techniques. A rule-of-thumb is that training sites should not occupy more than 5% of a land cover.

In order to get a sense of how large the training sites should be, you can use the Measure Zone icon Measure zone. Knowing that each pixel is 30 X 30 m, we can determine that it will take slightly more than 9 pixels (3 X 3) to form one hectare. Click on the Measure Zone icon, and then click within Morr345. Holding the left-mouse button down, move the mouse away from where you clicked. You should see an expanding circle form with the radius and area (in hectares) indicated. Since the training sites should encompass at least 70 pixels, and we know that 9 pixels represents an area of slightly less than one hectare, an area of approximately 8 hectares should encompass 70 or so pixels. Once you have become comfortable with knowing how large the training sites (in total) should be (release and click on the left-mouse button to reset the measure icon), click once again on the Measure Zone icon to turn it off.