Unsupervised classification (Tutorial)

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
 
(39 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{construction}}
+
==Unsupervised K-Means classification==
:''This article is part of the [[QGIS tutorial 2013/14]].<br/>In this article, you will learn how to classify a landscape raster via k-means clustering''
+
* In the search engine of the Processing Toolbox, type {{typed|text=kmeans}} and double click '''KMeansClassification''' of OTB.
 +
* Specify a multispectral image as Input Image.
 +
* Specify directory and name for the Output image. Select the output data type {{button|text=uint 8}} from the pull-down list.
 +
* Set the {{button|text=Number of classes}} to {{typed|text=20}}
 +
* Check the {{button|text=Training set size}} to {{typed|text=10000}}
 +
* Output pixel type: {{typed|text=uint8}}
 +
* Click on {{button|text=Run}}.
 +
[[File:qgis_otb_kmeans.png|400px]]
  
# Classifying an image
+
* Load the resulting image into QGIS. It is single band file with 20 grey levels labeled from 0 to 19.
## Add the raster layer ''188_pca_indices.tif'' into a [[QGIS]] project. It should be available in the [[Course data|course data]].
+
* {{mitem|text=Layer Properties --> Symbology --> Render type}}. Switch to {{button|text=Singleband pseudocolor}} and select a '''Color ramp''' (e.g. Spectral). Select the '''Mode''' {{button|text=Equal interval}} and set the number of classes to {{typed|text=20}}
## Open the k-means classification algorithm provided by the Orfeo toolbox. It can be found in the processing toolbar under {{mitem|text=Toolbox --> Orfeo Toolbox --> Learning --> Unsupervised KMeans image classification}}.
+
##* Set the ''188_pca_indices'' layer as {{button|text=Input image}}
+
##* Set the {{button|text=Number of classes}} to 20 and the {{button|text=Number of iterations}} to 1000.
+
##* The {{button|text=Convergence threshold}} should be set at 0.0001.
+
##* Leave all other configurations as they are and click {{button|text=Run}}. The resulting image has 20 classes, labeled from 0 to 19.
+
# Image symbology
+
## Right-click the classified layer in the [[TOC]] and select {{mitem|text=Properties --> Style}}.
+
## Set the {{button|text=Render type}} to {{button|text=Singleband pseudocolor}}.
+
## 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.
+
## Confirm with {{button|text=Apply}} or click {{button|text=OK}} if you are content with your settings.
+

Latest revision as of 14:37, 24 November 2020

[edit] Unsupervised K-Means classification

  • In the search engine of the Processing Toolbox, type kmeans and double click KMeansClassification of OTB.
  • Specify a multispectral image as Input Image.
  • Specify directory and name for the Output image. Select the output data type uint 8 from the pull-down list.
  • Set the Number of classes to 20
  • Check the Training set size to 10000
  • Output pixel type: uint8
  • Click on Run.

Qgis otb kmeans.png

  • Load the resulting image into QGIS. It is single band file with 20 grey levels labeled from 0 to 19.
  • Layer Properties --> Symbology --> Render type. Switch to Singleband pseudocolor and select a Color ramp (e.g. Spectral). Select the Mode Equal interval and set the number of classes to 20
Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export