• No results found

Exercise #4: Maximum Likelihood Classification

In document Exploring ENVI 50 Manual (Page 98-104)

For this classification you will create training site vectors before starting the classification routine. 1. To create training site vectors, click on File →New →Vector Layer from then ENVI menu. 2. The Create New Vector Layer dialog appears. Type in soil in the Layer Name field. Then click OK. 3. Draw a few polygon vectors over areas of bare ground. You should try to include areas that

encompass the variability of the class. In the Layer Manager, the icon of a vector layer that has been edited and not yet saved is stippled.

4. Save the vectors by right clicking on the vector layer in the Layer Manager and selecting Save As. In the Save As dialog, leave the file name as soil and note that it will be saved as a shapefile. Click Save. The icon for this layer will no longer be stippled.

Supervised and Unsupervised Classification Regions of Interest and Classification Techniques

5. Click on File →New →Vector Layer from then ENVI menu.

6. The Create New Vector Layer dialog appears. Type in crops in the Layer Name field. Then click OK.

7. Draw several polygons over various agricultural fields. Save the changes to this vector layer as you did to the previous vector layer.

8. Create new vectors for additional classes as you wish. Possible other classes include dark bare fields, urban materials, ocean, rivers, wetlands, native brush, etc. Remember that you should only include one material in each class, and also be sure to choose enough training sites to represent the diversity of each class.

9. When you are finished defining class training sites, click on the Select tool to get out of Vector Create mode.

10. In the ENVI Toolbox expand the Classification and Supervised Classification folders. Then double click on Maximum Likelihood Classification. A Classification Input File dialog appears. 11. Select ca_coast.dat. Before you click OK click Spectral Subset and then deselect the

thermal band (Band 11). You will not use this band in the classification. Click OK. Note that it is possible to use a mask to exclude areas not to be used in the classification. Click OK again. 12. The Maximum Likelihood Parameters dialog appears. The vectors you created should be listed.

Regions of Interest and Classification Techniques Supervised and Unsupervised Classification

13. Click the Preview button. The image that appears can be used to help you evaluate the classes you have created. Don’t worry if the result is not accurate, you will use the Rule Classifier tool to set class thresholds later.

14. For Output Classification Filename type Ca_coast_maxlike.dat. For Output Rule Filename type Ca_coast_maxlike_rule.

15. Click OK to run the classification.

16. The classification result will be displayed. To evaluate it right click on the original image in the Layer Manager and select Display in Portal. After the portal appears, compare it to the

classification result either by using the Transparency slider, or by right clicking in the Portal and choosing Blend, Flicker, or Swipe. Remember you can move the portal around as well as resize it.

17. Right click in the Portal and choose Close Portal.

18. Uncheck some of your classes to view the underlying image. This is probably a rule image, so uncheck any rule image listed in the Layer Manager. This should allow you to see the original color scene below unchecked classes.

19. Next you will improve the classification result by setting thresholds for each class. In the ENVI Toolbox expand the Post Classification folder and double click on Rule Classifier.

Supervised and Unsupervised Classification Regions of Interest and Classification Techniques

20. In the Rule Image Classifier dialog, select Ca_coast_maxlike_rule and click OK.

21. The first thing to do in the Rule Image Classifier Tool that appears is to decide whether to Classify by Maximum Value or Minimum Value. Because the Maximum Likelihood algorithm evaluates matches by using a measure of probability, this means that larger pixel values in the rule images indicate a better match. So, let Classify by default to Maximum Value.

22. The classes you defined are listed and checked. The class colors may not correspond with the colors you used to define them. Click Options →Edit class colors/ names. This tool allows you to edit class colors and names. Make any edits that you want. Then click OK to close the Class Color Map Editing dialog.

23. Before setting any thresholds, click Quick Apply to create a new classified image in memory. The image appears in a separate display. Note that the entire image is classified.

24. In the Rule Image Classifier Tool dialog, click the Hist button for a class. A histogram plot window for the rule image appears. Again, pixel values in rule images represent how well a particular pixel matched a class training site. Logical places to put thresholds are either between histogram peaks or at an abrupt change in histogram slope. Both of these usually occur at the transition between different types of materials.

25. For the Maximum Likelihood classification good matches are at the right side of the histogram (higher values). Zoom into the right side of the histogram by placing your cursor in the histogram and hold the CONTROL key down while you draw a box in the histogram. You can’t zoom in when the cursor is near the edge of the plot, but if you start the zoom box in the plot window, you can extend it beyond the plot axes. What can also help is using SHIFT click to pan around in the histogram plot. If you need to zoom back out, right click in the histogram and choose Reset Plot Range. Materials that are rare in the scene will be found in the tail of the histogram. Materials that are abundant will be represented by a peak.

26. The figure below shows an example histogram of the ocean class. Because there are a lot of pixels in the ocean, the class is represented by a large peak. After zooming in to the histogram, click inside the plot and note Data Values (x-axis) where the slope of the histogram changes. In the example below, a likely threshold value is -553.

Regions of Interest and Classification Techniques Supervised and Unsupervised Classification

27. Figure out an appropriate threshold for your class and type that value into the Thresh field for the class. Then Click Quick Apply. The temporary result in the separate display will update.

28. Click on the Hist button for each class and determine a good threshold for each. You may need to rest the histogram by right clicking and selecting Reset Plot Range. Or you can hit the SHIFT key and pan around the plot. Type your threshold values in to the appropriate Tresh field.

29. When you have finished finding good thresholds for your classes save your new result by clicking Save To File on the Rule Classifier Tool.

30. In the Output Rule Classification Filename dialog, type in Ca_coast_max_class.dat and click OK.

31. To display the new result, open up the Data Manager, scroll down to your new output, then right click on the Rule Class band for Ca_coast_max_class.dat and select Load Grayscale.

Supervised and Unsupervised Classification Regions of Interest and Classification Techniques

32. Close the Rule Image Classifier Tool and the Data Manager.

33. To evaluate your result, right click on the original ca_coast.dat CIR image in the Layer Manager and select Display in Portal. Move the portal around and use the transparency slider or right click in the portal and use Blend, Flicker, or Swipe to compare your result to the input data set. 34. When you are finished with the evaluation, right in the portal and choose Close Portal.

35. An optional step is to “clean up” your result using Clump and Sieve. To use them, double click on Clump Classes and Sieve Classes in the Post Classification folder in the ENVI Toolbox. This will

Regions of Interest and Classification Techniques Supervised and Unsupervised Classification

36. To convert your classification image to vectors, choose Classification →Post Classification in the ENVI Toolbox. Double click on Classification to Vector. For input select the Rule Class band for Ca_coast_max_class.dat and click OK. Select classes to vectorize excluding Unclassified. Toggle Output to One Layer per Class. Type in an output filename of

Ca_coast_max_class.evf and click OK.

37. To display the vector files, open up Windows Explorer, browse to your output folder and drag the vector files into the ENVI display. The RTV (raster to vector) layers will be overlain on top of the displayed image. The vector editing tools will be available if you want to make edits.

In document Exploring ENVI 50 Manual (Page 98-104)