Lab Instructions Lab 6, due 8:00 am October 21, 2006 EES5053: Remote Sensing, Earth and Environmental Science, UTSA Student Name: ___________________ Digital Image Processing IV: Post Classification Objective: In last lab, you classify both images. In this lab, you will do the post classification work: clumping classes, combining classes, color Mapping, assessing classification, change detection, converting classes to vectors, upload vectors to ENVI. 1. Preparation: (1). Create your own folders: c:\EES5053\studentname\Lab6, storing your work and final lab report. (2). Connect to the server \\129.115.25.240\XIE_misc\EES5053\Lab6 (3). Setup the ENVI data as lab5/6 and output directory for lab6. Today, we will work on the classified images we did in lab5, class_020708.tif and class_021113.tif (or other name you given). Load Radn_020708.tif image as RGB742. 2. Clumping classes Classified images often suffer from a lack of spatial coherency (speckle or holes in classified areas). Low pass filtering could be used to smooth these images, but the class information would be contaminated by adjacent class codes. Clumping classes solves this problem by clumping adjacent similar classified areas together using morphological operators. The selected classes are clumped together by first performing a dilate operation and then an erode operation on the classified image using a kernel of the size specified in the parameters dialog. 1. Select Classification-> Post Classification -> Clump Classes. 2. When the Classification Input File dialog appears, select a classified image (class_020708.tif). click OK. 1 3. The Clump Parameters dialog appears with all of the available classes in the image in the Select Classes list. Select all classes. 4. Enter the desired morphological operator size in the Rows and Cols text boxes (3 by 3). 5. Select output to File (clump_class_020708.tif). Click OK to start the processing. 3. Combining Classes Since it is difficult to accurately distinguish the patchy forest and non-forest vegetation, we need to combine both classes as one class: vegetation. Thus, we have total four types of classes: unclassified, water body, vegetation, and bare land. 1. Select Classification -> Post Classification ->Combine Classes. 2. Select the input classification data (clump_class_020708.tif), click OK. The Combine Classes Parameters dialog appears. 3. In the Combine Classes Parameters dialog, select a class for input by clicking on a name in the Input Classes list. The selected class name appears in the Input Class text box. 4. Select an output class by clicking on a class name in the Output Classes list. 5. When both the input and output classes have been selected, click Add Combination to finalize the selection. The new, combined classes to be created are shown in the Combined Classes list at the bottom of the dialog. Then do same operation for other classes as below and figure 1. Unclassified->Unclassified Region #1-> Region #1 Region #2-> Region #2 Region #3-> Region #2 Region #4-> Region #4 6. Click OK to combine the contents of the input class into the output class. 7. When the Combine Classes Output dialog appears, select Yes to remove empty class, and output to File as Comb_clump_class_020708.tif. 2 Figure 1. combine class Class Color Mapping Use Class Color Mapping to change the color of classes as we wanted after a classified image is loaded into a display window. The color that a class is automatically displayed in corresponds to the color of the selected ROI for supervised classification and to preselected class colors for unsupervised classification. Unclassified areas appear black on the images. 1. In the image window, select Tools -> Color Mapping -> Class Color Mapping from the Display menu in the Main Image window. 2. When the Classification Mapping dialog appears, select from the following options to change the class colors and/or names. o To modify the class color, click on a class name in the Selected Classes list and click the arrow increment buttons to set the color values. o To change the name of the selected class, edit it in the Class Name: text box. Make sure that each region matches as below table Region Unclassified -> Region #1 -> Region #2 -> Region #4 -> Name Unclassified Water body Vegetation Bare land Color Black Blue Green 1 Maroon 3 3 3. When you are finished with your color modifications as in figure 2, select File-> Save Changes to retain the new colors. You also can make class legend on your map using mapkey as we did in Lab 5. Then, close the window. Figure 2. Class color mapping Repeat step1 Clumping classes to step 3 Class Color Mapping for class_01113.tif. Question (1): show the final classification maps on two dates with map legend. 5. Classification assessment. After post-processing the classes, we need to assess the accuracy of our classification results by comparing the classification result with ground truth information. ENVI can calculate a confusion matrix (contingency matrix) using either a ground truth image or using ground truth regions of interest (ROIs). In each case, an overall accuracy, producer and user accuracies, kappa coefficient, confusion matrix, and errors of commission and omission are reported. Since we did not have the ground truth image and Confusion 4 Matrix using ground truth ROI requires that ROIs must be the same size as the classification output image, both are impossible for our lab, thus we have to create the ground truth ROI and build the confusion matrix by ourselves using computing statistics and band mask. Like draw the training sites in Lab5, we need draw ROI for each of the three classes, water body, vegetation, and bare land, respectively. 1. Click Basic tools->Compute statistics, select Comb_clump_class_020708.tif as the input file. 2. In the bottom of the window, click Mask option->build mask. 3. In the Mask Definition window, click Option->click Selected Area “On”, then click Option->Import ROIs. 4. In the Mask Definition Input ROIs window, select Region #1, Click Ok. Output the Mask to file as Watermask_020708.tif. Click OK. 5. The Select Mask Band will automatically select the watermask. Click Ok. 6. Check the Basic tools and Histogram, and Output result as Waterbody_020708.txt. Click OK. Do above step 1-6 for region #2, #3, and output results as Vegetation_020708.txt and Bareland_020708.txt, respectively. Do the same operations from drawing ROIS for Comb_clump_class_021113.tif and output the results as Waterbody_021113.txt, Vegetation_021113.txt and Bareland_021113.txt, respectively. Question (2): Open the above *.txt files and combine them together to show the accuracy of each classes of your classifications, or build the Confusion/Error Matrix. 6. Exporting Classes to Vector Layers/shapfiles In this lab, we will convert the water body classes as a vector, which show the flooding areas and can be edited and upload ArcMap and other software. 1. Select Classification -> Post Classification -> Classification to Vector. 2. Select the Comb_clump_class_020708.tif as the input file. 3. Select the Region #1 class to convert to vector polygons, and output to file as flooding_2002.evf. Click Ok. 4. Available Vector List window pops up. Click file->Export Layers to Shapefile, and output as Gonzales_flooding_200207.shp. 5 5. Open image Radn_020708.tif as RGB742 in the Display #1 window. 6. In the bottom of the Available Vector List window, select the RTV (vector) layer of water class, click Load Selected. 7. Select Display #1, Click Ok. The vector appears in the image window. 8. In the Vector Parameter window, change color of Current Layers as Red, click Apply. The vector will become red in the display #1. Question (3): show your flooding area overlapping with the radiance image (RGB742) on July 8, 2002. 7. Change Detection In the lab 5, we computed the flooding area through compare the statistics of classes. In this lab, you are encouraged but not required to directly use Change Detection tools to do it through the Online help as copied below. If you report a final Change Detection Report, you will be credited extra 20 points. The Change Detection Statistics routine is used to compile a detailed tabulation of changes between two Classification images. The changes detected using this routine differ significantly from a simple differencing of the two images. While the statistics report does include a class-for-class Image Difference, the analysis focuses primarily on the Initial State classification changes—that is, for each Initial State class, the analysis identifies the classes into which those pixels changed in the Final State image. Changes can be reported as pixel counts, percentages, and areas. In addition, a special type of mask image (classification masks) that provide a spatial context for the tabular report can be produced. The class masks are ENVI Classification images with class colors matching the Final State image, making it easy to identify not only where changes occurred but also the class into which the pixels changed. The input images must be co-registered or georeferenced. For the most accurate results, carefully co-register the images before processing. If the input images are not coregistered, the routine will use the available map information to automatically co-register the images, using the Initial State image as the base if re-projection or resampling is required. 1. From the main ENVI menu select Basic Tools -> Change Detection -> Change Detection Statistics, or Classification -> Post Classification -> Change Detection Statistics. 2. In the first file selection dialog, select a Classification image representing the Initial State (20021113). 6 3. In the second file selection dialog, select a Classification image representing the Final State (20020708). The Define Equivalent Classes dialog appears. 4. Match the classes from the Initial and Final State images by clicking on the matching names in the two lists and clicking the Add Pair button. Add only the classes you wish to include in the change detection analysis (it is not required to pair all classes). The class combinations are shown in a list at the bottom of the dialog. If the classes in each image have the same names, they are automatically paired. o o To remove a paired class from the list, click on the pair in the list at the bottom of the dialog and then click on the Remove Pair button. The two class names reappear in the lists at the top of the dialog. To remove all of the paired classes, simply click the Remove All button. All of the classes reappear in the lists at the top of the dialog. 5. After all of your class pairings are made, click OK. The Change Detection Statistics Output dialog appears. 6. Next to the Report Type label, select the type of statistics report you want to generate. You may choose any combination of Pixels, Percent, and Area. 7. To output Class Masks, select Yes in the toggle button next to Output Classification Mask Images, then choose a destination for the mask images. If not outputting Class Masks, set the toggle button to No. 8. Click OK to start the processing. Question 4: show the Change Detection Report (Encouraged but not required), earning extra 20 points. 7