Unsupervised classification (Tutorial)
From AWF-Wiki
(Difference between revisions)
Line 45: | Line 45: | ||
|255-255-255 | |255-255-255 | ||
|} | |} | ||
− | |||
# Classifying an image | # Classifying an image | ||
## Add the raster layer ''188_pca_indices.tif'' into a [[QGIS]] project. It should be available in the [[Course data|course data]] (see [[Exercise 06: Digitizing training and test areas|previous exercise]]). | ## Add the raster layer ''188_pca_indices.tif'' into a [[QGIS]] project. It should be available in the [[Course data|course data]] (see [[Exercise 06: Digitizing training and test areas|previous exercise]]). | ||
Line 56: | Line 55: | ||
## Right-click the classified layer in the [[TOC]] and select {{mitem|text=Properties --> Style}} (see figure '''B'''). | ## Right-click the classified layer in the [[TOC]] and select {{mitem|text=Properties --> Style}} (see figure '''B'''). | ||
## Set the {{button|text=Render type}} to {{button|text=Singleband pseudocolor}}. | ## Set the {{button|text=Render type}} to {{button|text=Singleband pseudocolor}}. | ||
+ | ## Set {{button|text=Color interpolation}} to {{button|text=Discrete}}. | ||
## Set the {{button|text=Mode}} to {{button|text=Equal interval}} with 20 classes and confirm with {{button|text=Classify}}. | ## Set the {{button|text=Mode}} to {{button|text=Equal interval}} with 20 classes and confirm with {{button|text=Classify}}. | ||
## In the {{button|text=Load min/max}} section, select tbe {{button|text=Min/max}} radio button and click {{button|text=Load}} to update the range for classification. | ## In the {{button|text=Load min/max}} section, select tbe {{button|text=Min/max}} radio button and click {{button|text=Load}} to update the range for classification. |
Revision as of 14:53, 24 February 2014
sorry: |
This section is still under construction! This article was last modified on 02/24/2014. If you have comments please use the Discussion page or contribute to the article! |
- This article is part of the QGIS tutorial 2013/14.
In this article, you will learn how to classify a landscape raster via k-means clustering
Code | Name | Cluster number | RGB color |
---|---|---|---|
1 | Urban area | 10,9,15 | 230-000-077 |
2 | Cropland | 16,0,13,3,7,17,18 | 255-255-268 |
3 | Pastures/grassland | 12,8 | 230-230-077 |
4 | Broadleave forest | 6,2,5,4 | 128-255-000 |
5 | Coniferous forest | 11,19 | 000-166-000 |
6 | Water bodies | 14 | 128-242-230 |
7 | Cloud | 1 | 255-255-255 |
- Classifying an image
- Add the raster layer 188_pca_indices.tif into a QGIS project. It should be available in the course data (see previous exercise).
- Open the k-means classification algorithm provided by the Orfeo toolbox. It can be found in the processing toolbar under Toolbox --> Orfeo Toolbox --> Learning --> Unsupervised KMeans image classification (see figure A).
- Set the 188_pca_indices layer as Input image
- Set the Number of classes to 20 and the Number of iterations to 1000.
- The Convergence threshold should be set at 0.0001.
- Leave all other configurations as they are and click Run. The resulting image has 20 classes, labeled from 0 to 19.
- Image symbology
- Right-click the classified layer in the TOC and select Properties --> Style (see figure B).
- Set the Render type to Singleband pseudocolor.
- Set Color interpolation to Discrete.
- Set the Mode to Equal interval with 20 classes and confirm with Classify.
- In the Load min/max section, select tbe Min/max radio button and click Load to update the range for classification.
- Confirm with Apply or click OK if you are content with your settings.
- Create a land use/cover classification scheme table as in table A.
- As a reference, you may add a google layer to the project:
Plugins --> ObenLayers plugin --> Add Google Satellite layer. - Set the coordinate reference system
- Open Project --> Project properties.
- Set WGS 84 Pseudo Mercarot (EPSG 3857) as coordinate system
- Check the Enable on the fly transformation box
- Right click 188_pca_indices in the TOC and select Set Project CRS from layer.
- Change the grid values
- Assign discrete colors to the land cover layer (figure C).
- Right click the layer in the TOC or double click to open the layer Properties.
- Select the Style tab and set the following options:
- For Render type select Singleband pseudocolor
- For Color interpolation, select Discrete
- Set Mode to Equal interval and Classes to 7.
- Set Load min/max values to Min/max.
- Don't forget to click Classify for adding the classes.
- Click Load and confirm with Apply or OK.