LAB 2 Sanchayeeta Adhikari Object Oriented Classification Lab Overview: In this lab, you will create a object oriented classified image. To accomplish this, you will Create objects/polygons using the region growing method in Erdas Imagine. Convert the .aoi polygons to a shapefile. Convert the vector layer to raster using the Area and the Perimeter so that each pixel inside the polygon has the same area or perimeter value. Creat a texture layer of the image. Classify the objects based on some rules (Rule based classification). Background: The traditional image classification method in Remote Sensing uses mainly the spectral information received from the sensor. And also in the traditional classification method, the algorithms to classify the images are applied on pixels rather than on real world objects or contextual information. Object oriented classification not only removes this drawback of the traditional classification, but also it allows for a vector based image processing in GIS based environment rather than just on raster based image processing. The object oriented classification is a new classification method which is based on image segmentation. This is opposed to per pixel image segmentation method. In this kind of image segmentation objects are the basic units for classification which are composed of a group of pixels representing real world objects (that the user intends to identify) rather than per pixel as the basic unit of classification. These objects are created by image segmentation process mainly the region based segmentation process. The purpose of image segmentation is to subdivide an image into different segments/polygons that corresponds to objects in the terrain (Wang, 2004). Image segmentation techniques make use of both spectral information (feature vector of the pixels) and spatial information (size, shape, texture, contextual information and adjacency to other pixels) to identify and delineate suitable segments within an image. The region based segmentation process is performed by different methods. Some of the methods are clustering method, histogram based method, region growing method, split and merge method, graph partitioning method, model based segmentation method, multiscale segmentation method and semi automatic segmentation method. For the present lab region growing segmentation method will be used (Wikipedia). Some of the disadvantages of this kind of classification method are tedious while creating the segments, unavailability of software packages which is actually limitation of this lab rather than disadvantage of this method. Also the classification method is overly dependent on the accuracy of the segmentation method used. Some Definitions: Objects: An object is any real entity the user intends to classify (land cover patch, eological unit, etc.) (Wang, 2004). Segmentation: It is a process of partitioning a digital image into multiple regions (sets of pixels). The goal of segmentation is to simplify and/or change the representation of an image into something that is more meaningful and easier to analyze (Mitra et al. 2004). Region-based segmentations: To identify segments by applying homogeneity criteria inside candidate segments (MIT, 2007). Software Packages to be Used: Erdas Imagine 9.0 ArcGIS 9.1 Compumine Rule Discovery System (RDS) Lab Procedures: Image for classification Ikonos 2: Nepal_ikonos_subset.img ; 1-2-4, R-G-B. This is a subset of the Nepal_ikonos image. You can use your own subset or use the whole image for the classification. Image Description The present image is an IKONOS-2 image. The image mainly shows the location of the Royal Chitwan National Park in Nepal with some surrounding urban area and agricultural fields. The image was acquired on 09/08/04. Broadly land covers like water, settlement, agriculture, floodplain, forest could be seen in the image. Part I – Image Segmentation Method: Region Growing In this step, we will learn to create polygons/regions based on spectral similarities. So rather than pixels we would train regions. And we would use these segments to classify according to some homogeneity criteria. The file format that would be created in this step is .AOI. Set Seed Properties 1. Select AOI | Seed Properties from the Viewer menu bar. The Region Growing Properties dialog opens. This dialog enables you to define the region that grows from the seed. 2. In the Region Growing Properties dialog, change the Spectral Euclidean Distance to 100 while doing the river, floodplain and the farmland and settlement. Set it to 150 when doing the forest. If you are not happy with your segmentation, change the Spectral Euclidean Distance and see if you get your desired segmentation. Entering the Euclidean spectral distance in digital number (DN) units on which to accept pixels will accept pixels that are within this (number you have decided) spectral distance from the mean of the seed pixel. If you want smaller segmentation, then keep the values less in the Geographic constraints (Area or Distance) and Spectral Euclidean Distance. 3. Click Options, and uncheck the Include Island Polygons and Buffer Region Boundary. You can check them and see how your region grows. But if you want broader segmentations, uncheck them. Island polygons are areas within the region that do not match the region growing properties. When displayed, island polygons are excluded from subsequent processing using the parent AOI (such as area calculation). Checking the Include Island Polygons will create too many polygons within larger polygons which do not match the homogeneity criteria for the broader polygon. So depending on the research question (DORQ) it should be checked or unchecked. For example if we need to study diversity studies then we may want to include island polygons to see the diversities in the landscape. But if we want broad land cover classes we can exclude those islands. For the present lab we would not include the island polygons. 4. If you have AOI saved earlier, then you can use these AOI’s to grow your seed into. Click Set Constraint AOI in the Region Growing Properties dialog. The Choose AOI dialog opens. In the Choose AOI dialog, select AOI file under AOI Source and then get your AOI file and then click OK. For this lab you can just click the None under AOI source. 5. Click the Region Grow AOI icon in the AOI tool palette. Click this tool to plant seeds, or points in the Viewer, from which to grow a regional AOI. The region grows in the Viewer as an AOI that can be selected. Click to select an AOI to constrain the region growing. Adjust the Spectral Euclidean Distance here. 6. Move the cursor into the Viewer window and click the water to indicate where you want the region growing to take place. A status meter displays in the status bar of the Viewer. You may click Cancel to terminate the region grow process. The meter dismisses when the region growing process is complete. The area you selected in the Viewer is surrounded by a second bounding box and chaser lights. 7. Click Close in the Region Growing Properties dialog. See the figure 1 to see how your polygons should look. 8. Keep on creating polygons untill you cover the whole image. Save your AOI/polygons/objects as lastname_objects.aoi. Region Growing Properties Figure 1 Note: Be cautious about where you plant the seed. Try other method of image segmentation method using different softwares to check out the best possible segmentation method. Part II – AOI to Shapefile This is the process in which the segments that are created in Part I will be transformed. Our image segments are mainly in .AOI format. So in this process we will convert the image AOI’s from Part I to shapefile. These shapefile will be mainly polygons or objects that we will use for our object oriented classification. The data format after performing this step will be .shp. In the viewer where you have the AOI to be exported being viewed – 1. Select all the AOI to convert to shapefile. Use the Box Select AOI to select all your objects/AOI/polygons. Click the icon and drag a box around the AOI’s you want to convert into objects. 2. Click File/New/Vector/ and Set the output file to lastname_object .shp and click OK. A dialogue box New Shapefile Layer Option opens like the figure below. Be sure to set the shape type to be Polygon Shape. 3. The vector tool box opens as you perform the second step. If not, open it from the viewer/vector/tools. Click Add selected AOI/ Annotation to specified vector layer. This is a blue polygon with a right arrow button. Your vector layer for lastname_object.shp is created. Part III – Vector to Raster The objects created in Part II were in vector format (shapefile). We need to convert these vector format objects to raster format. This is mainly done to use the object data in Compumine. So the lab users will need to convert the lastname_objects.shp to a raster format. By this step we will have each pixels inside a polygon/object to have the value of the polygon Area or Perimeter. The Polygon Area and Perimeter will be calculated in this step. And then each pixel in one polygon will have the value of the polygon area or perimeter. Two separate files will be created one each for Area and Polygon. For example, if a polygon “A” has an area of 10sq km and perimeter of 12 km ., then each pixel inside polygon “A” will have a value of 10sq km for the Area file and for the perimeter file each pixel will have 12km value. 1. Click Image Interpreter/ Utilities/ Vector to Raster. 2. Input will be your area_polygons.img. lastname_objects.shp. Give a output name as 3. Vector type will be Polygons. Data type Unsigned 16 bit and Layer Type as continuous. 4. Check the Use Attributes as Values. And select Area from the drop down menu. Leave everything else as default. Give an appropriate name like Area_object.img. Click Ok. 5. Repeat the Step 4 and this time Select Perimeter from the drop down menu. Leave everything else as default. Give an appropriate name like Perimeter_object.img. Click Ok. Note: You can do this step in the ArcMap also by using the spatial analyst tool. Go to View/Toolbar/Spatial Analyst/ Convert/ Feature to Raster. Part IV – Training Samples AOI to point This step is performed as we need point features of the training sample to use in the ArcGIS software. Our training samples are a polygon features (.aoi file format). So we need to convert those polygon features to a point features for using it in ArcGIS for relating explicatory variables to training samples in spatial analyst toolbox. 1. Collect your training samples from the image by creating 5 land cover classes, Water, Agriculture, Forest, Floodplain and Settlement. Collect the training samples in a conventional way of creating polygons using the AOI toolbox. We need to change these polygon features to a point features which we will do in next step. 2. Give unique land cover IDs to the land cover class training samples by clicking vector/ enable editing. Open the vector/ attributes and edit the IDs. 3. Next, Convert them into a vector file in the method mentioned in Part II. 4. Open the training sample vector file in ArcMap. Convert the polygons into point file. Click View/ Toolbar/ X Tools Pro. Go to Feature Conversion and click Convert Feature to Points. Save the point layer Training Samples. Part V – Create Texture, NDVI, Tasseled Caps layer and PCA The compumine software gives better result when the number of data inputs is more. So to create more explicatory variables this step is necessary. Also objects could be better classified if a texture file is used as the texture of different land covers differ. For example, the texture of a forest cover will be fuzzy kind, while the texture of an agricultural plot will be smoother with edges separating one agricultural plot with another. For similar reasons we will create tasseled cap and NDVI layers which can be good to separate vegetation from non vegetation. . 1. Click Image Interpreter/ Spatial Enhancement/ Texture. 2. Input will be your Nepal_ikonos_subset. Output will be lastname_texturevariance. 3. Data type will be unsigned 16 bit. And select Variance as your Operators and 3 x 3 window sizes in Output Options. Click Ok. 4. You can create Tasseled Cap layers also for different bands. Create NDVI, PCA for the image. This process is necessary as Compumine works better with more data. Part VI. Using data-mining software to construct decision trees. Till this step only thing we did was to create our explicatory variables. In the following steps we would try to find some rules for our decision tree using the compumine rule discovery system. In the present step at first we would associate the training samples to their corresponding values of all explicatory variables in ArcGIS using spatial analyst toolbox. So we will relate the following layers to our training sample point feature file: I. II. III. IV. V. VI. VII. VIII. IX. The Tasseled Caps NDVI Raster layer for Area Raster Layer for Perimeter Spectral Bands of IKONOS PAN band of IKONOS Texture file Area-Perimeter Ratio PCA After we have related the explicatory variables with the training sample, the file will be saved in a compumine compatible format. In the next step we will use these related data in the COMPUMINE’s Rule Discovery System (RDS) to get our rules for the decision tree in knowledge manager. We will create the rules in the knowledge manager and classify the images using those rules that we got from Compumine. The procedure is explained in details below. (Following section of the lab has been taken and modified from Hector Castenda’s Lab 1.) Very often, especially when there is lots of ancillary data that can be combined in many ways, manual thresholding to find optimum values for the decision tree can be very time consuming. This is when certain tree-building data mining software can be useful. Most of these software programs are not intended specifically for image classification, they are decision based software used to classify any type of information according to available criteria. For example they can be used to diagnose disease based on symptoms and environmental conditions; they can be used to classify animal species according to morphology; or customers according to sociological data. This is why trees generated through them must be translated into ERDAS knowledge engineer or similar programs to produce a classified image. In this case we want to use any relevant information that can be spatially associated to a training sample to classify it into its correct land cover class. Since the software we will be using (COMPUMINE’s Rule Discovery System (RDS) http://www.compumine.com/web/public/home) is not made to work with remote sensing software, several steps are required to extract the data it needs to create a classification tree and then to incorporated it to the knowledge engineer in order to create a land-cover map. In this part we will use RDS to create a classification tree based on training sample data. The following classes will be used: Class 1: Forest Class 2: Water Class 3: Agriculture Class 4: Floodplain Class 5: Settlement Example 2. In order to execute the classification, a combination of software generated trees and expert classification will be conducted. a. Creating explicatory variable layers. 1. The first step is to generate all the available (and relevant) data layers that will be included into the tree analysis. This will include spectral bands, indices, ratios, Principal components, texture, ancillary data (such as roads, urban areas, etc.) and generated secondary data (distance to roads, slope-weighed distance to rivers, etc.) Anything that has a theoretical base to explaining landcover/use and that can be put into a raster file is acceptable. For this exercise the possible layers that are used is Area-Perimeter Ratio, Raster layer for Area, Raster Layer for Perimeter, Texture layer, Spectral Bands, Tasseled Cap. You can use some other layers lie PCA or other indices. b. Relating explicatory variables to training samples. 2. A set of training samples [training_samples] are given to you in the exercise files. The next step is to associate the training samples to their corresponding values of all explicatory variables. To do this open your training sample data points in ArcMAP together with all your possible explicatory variables you have chosen to use. Use the “Sample” tool from the spatial analyst toolbox (spatial analyst/extraction/sample) to extract the corresponding layers (when you are listing the variables in the “Sample” window don’t forget to write them down in the order that you put them since ArcMAP will often erase their names in the output table.) Fig. 13 3. Once you obtain the sample output file join the resulting table with the training sample data using the ID column as a guideline: c. Transferring data to RDS 4. Once the tables from the training samples file and the sample output are joined, export the joined attribute table open it up in excel, write the names of the variables that might be missing, and save it as a .TXT file (that is what RDS reads). Your table should look something like this: Fig. 14 5. Open RDS, open “create new modeling experiment” and import your data. Once you open your data you must define the nature of each one of your variables (numeric, nominal, lexical, etc). You must have at least one “class” variable which should be the column that indicates what land cover/use class the training sample belongs to. Fig. 15 6. Read the RDS manual regarding validation and modeling methods so you can choose the one you like best. One particularly useful method is constructing classification trees using n-fold cross validation. This method generates a defined number of trees combining variables and training samples in different ways. In the end you can examine the resulting trees and see which variables tend to be selected more often. Play with the different methods and choose the one you think is more accurate. A typical tree model will look like this: Tree diagram Node details Variable importance in prediction Model accuracy (according to validation method) Fig. 16 Notice that water did not come out as a class. One disadvantage with this software is that land covers with little representation in the scene might be ignored (water only had two training samples). Such errors can be corrected later on by adding the missing landcovers through rules later on. IV. Converting a tree model into a land-cover/use map. 7. When you have found your optimal tree you will have to translate it ERDAS knowledge engineer in order to convert it into a classification. A good way of starting is to pick one land-cover class and find all tree branches that lead to it. Once you have identified all end-nodes that belong to that class, trace your way up for each node to the initial node. The whole “branch” or path from the end node to the top node can be interpreted as a “rule” in Knowledge Engineer, and each logical statement will be a “variable” within that rule ( Fig, 17). All the nodes along each path will be interpreted as variables under each rule: Fig. 17. Sometimes trees generated by software can be taken more as guide lines rather than absolute values, this means that expert criteria should always be used in decision based classification rather than letting the machine do all the work. Results will be highly dependent on sufficient samples with a good distribution that covers all the variation in the image for all the variables that will be used. Decision trees constructed from biased or insufficient training samples might present errors since the decision tree is unable to process data. As an example, if no training samples were taken of bare land cover above 1000 meters, the software may conclude that it is impossible that bare patches exist above that level. Always be on the lookout for this type of errors. Combining decision based classification with traditional statistical methods is probably a better option than relying on decision based methods alone. This is because both methods complement each other’s shortcomings. Questions: 1) What is an object oriented classification and how is it different from the conventional classification? 2) What are the advantages and disadvantages of object oriented classification? 3) What are the different kinds of image segmentation and how they are different from each other? 4) What image segmentation method is used for the present lab? What are the advantage and disadvantages of this kind of image segmentation? 5) What is the difference when you create objects by the region growing method and some other region based image segmentation methods? 6) What difference do you find between the two types of classification named object oriented and conventional supervised classification? 7) What are some other method of object oriented classification? Explain some of the methods. 8) Prepare a map composition showing the original image, the pixel based classification (it can be either a unsupervised or a supervised classification) and object oriented classification (RGB: 4, 3, and 2). Cool Websites and Freewares for Image segmentation: Spring GIS: http://www.dpi.inpe.br/spring/english/index.html GIMP: http://www.gimp.org/ eCognition: http://www.definiens.com/index.php (This is not freeware). Reference: Mitra, P., Uma Shankar, B. and Pal, S. K. (2004). Segmentation of multispectral remote sensing images using active support vector machines. Pattern Recognition Letters 25 (2004) 1067–1074. Wang,Z., Wei, W., Zhao, S., Chen, X. (2004). Object-oriented Classification and application in Land Use Classification Using SPOT-5 PAN Imagery. 0-7803-87422/04/$20.00 (C) 2004 IEEE. http://people.csail.mit.edu/seth/pubs/taskforce/paragraph3_5_0_0_3.html