Exercise 09: Segmentation algorithms

From AWF-Wiki
Jump to: navigation, search


Preparatory steps

  1. Open image svm_classification.tif
  2. Open the layer properties (right click in TOC or double click). In the Style tab, click Load style and browse for classification.qml.
  3. Open Plugins --> Openlayers plugin --> Add Google Satellite Layer (figure A).
  4. With the image svm_classification.tif on top (with transparency more than 50%) we can compare the classification with the information of the Google image and look for errors in the classification (figure B).
  5. Improving the classification
    1. Open Processing tools --> Orfeo Toolbox --> Classification Regularization
    2. Using the svm_classification.tif as input image run the classification regularization. See figure C for the parameter configuration. Then you can compare the result to the image svm_classification.tif (figure D).
  6. Installing Monteverdi
    • Open Start --> OSGeo4W --> Setup. Select Advanced Install and Install from internet in the following window and confirm the default settings in the next four dialogues until reaching the Select package dialogue. Select Monteverdi from the software list (figure D). Confirm with Next

Segmentation in Monteverdi

  1. Open Monteverdi by double-clicking the icon on the Desktop
  2. Select File --> Open dataset and browse for 188_pcs_indices.tif
  3. Open the panchromatic image saved in landsat8/DOY88/SUB_LC81950242013188LGN00_B8.tif via File --> Open dataset.
  4. In order to equalize the spatial extent and resolution of the two maps, select Geometry --> Superimpose two images Select image 188_pcs_indices.tif) for reprojection and SUB_LC81950242013188LGN00_B8.tif as reference image. Confirm with OK.
  5. To generate an image with the characteristics of the multispectral image with the panchromatic resolution, select Filtering --> Pansharpening --> Simple RCA Pansharpening Select image to reproject (188_pcs_indices.tif) and the reference image for reprojection (SUB_LC81950242013188LGN00_B8.tif). Confirm with OK.
  6. Save the processed image: Right-click the file of the output image (Pan SharpenedImageOutput) and select Export dataset --> pansharpened188.tif (32 bit). Confirm with OK.
  7. Load the generated image (pansharpened188.tif) into the QGIS project and compare it to the original multispectral image (188_pcs_indices.tif).
  8. As segmentation is a procedure that requires high computational capacity, it is recommended o select a subset of the sharpened images: Select File --> Extract ROI from dataset and select the image pansharpened188.tif as input. Draw a box in the select ROI window and confirm with OK (figure F).
  9. Applying the segmentation algorithm:
  10. Open Filtering --> Mean shift clustering and select the ROI extracted from pansharpened188.tif. Once you see the Mean shift module window you can change the parameters spectral value, spatial radius and opacity to find the pool of values that fit best to the characteristics of the image (e.g. figure G).
  11. When the set of values that best fit to the image are found, the segmentation parameters can be applied to the whole image via Processing: Select Processing --> Orfeo Toolbox --> Segmentation --> Mean Shift segmentation (large scale, vector output). Use pansharpened188.tif as input map with the parameters selected in Mean Shift module from Monteverdi software.

Cloud detection in satellite images

  1. Load the raster image file 188_pca_indices.tif from the supervised folder of the course data.
  2. Load the raster image file SUB_LC81950242013188LGN00_B1.tif from geodata/raster/landsat/landsat8/DOY188 folder into the project. (Coastal Aerosol Band)
  3. Load the raster image file SUB_LC81950242013188LGN00_B11.tif from geodata/raster/landsat/landsat8/DOY188 folder in QGis. (Thermal Infrared Band). Place the Band 11 image at the top in the TOC.
  4. Generate a ratio channel with the raster calculator from Processing Toolbox --> SAGA --> Grid-Calculus --> Raster calculator. Select the raster images from Band 11 and 1. The formula must be a / b. Don't forget to enter the name for the image result. Start the calculation with Run.
  5. Open the ratio image ratio_band11_band1.tif in Monteverdi via File --> Open dataset.
  6. For filtering the image, select Filtering --> Threshold and select the ratio image generated in the previous step. Confirm with OK.
  7. In the Threshold Module window select Binary Threshold; set outside value to 1 and inside value to 0; Change the values of lower and upper threshold until the clouds are entirely covered (figure H). Save the threshold information.
  8. Export the image: Select the output image with right clicking and selecting Export dataset. Save the output as cloud_mask.tif.
  9. Open the cloud_mask.tif image in QGis
  10. Convert the image to shapefile: select Processing --> SAGA --> Shapes – Grid --> Vectorising Grid classes. Select the image.
  11. To calculate the area of the polygons in the shapefile: Select Vector --> Geometry tools --> Export/ Add Geometry Columns
  12. Open the attribute table of the shapefile and shift to editing mode. Press the icon of Select features using an expression and enter area < 30000. Select and delete the selection.
  13. Place the image and 188_pca_indices.tif on top of each other to see the final result of the clouds delineated (figure I).


Figure A: Land cover map with underlying Google satellite layer.
Figure B: Zoom in on land cover map with underlying Google satellite layer. Note how forested areas are classified as water.
Figure C: Classification Regularization algorithm of the Orfeo Toolbox in QGIS.
Figure D: Land cover map before and after processing with the Classification Regularization plugin.
Figure E: OSGeo4W setup dialogue for installing software from the internet with row for Monteverdi highlighted.
Figure F: The Select ROI module menu in Monteverdi.
Figure G: The Mean shift module menu in Monteverdi.
Figure H: The Threshold module menu in Monteverdi.
Figure I: PCA Indices map and cloud vector layer.
Personal tools