Exercise 09: Segmentation algorithms
From AWF-Wiki
(Difference between revisions)
Line 53: | Line 53: | ||
|style="border:0pt"|[[Image:RemSens_Exercise09_10.png|thumb|450px|'''Figure I''': PCA Indices map and cloud vector layer.]] | |style="border:0pt"|[[Image:RemSens_Exercise09_10.png|thumb|450px|'''Figure I''': PCA Indices map and cloud vector layer.]] | ||
|} | |} | ||
− | |||
− |
Latest revision as of 09:57, 6 January 2020
Contents |
[edit] Preparatory steps
- Open image svm_classification.tif
- Open the layer properties (right click in TOC or double click). In the Style tab, click Load style and browse for classification.qml.
- Open Plugins --> Openlayers plugin --> Add Google Satellite Layer (figure A).
- 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).
- Improving the classification
- Open Processing tools --> Orfeo Toolbox --> Classification Regularization
- 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).
- 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
[edit] Segmentation in Monteverdi
- Open Monteverdi by double-clicking the icon on the Desktop
- Select File --> Open dataset and browse for 188_pcs_indices.tif
- Open the panchromatic image saved in landsat8/DOY88/SUB_LC81950242013188LGN00_B8.tif via File --> Open dataset.
- 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.
- 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.
- 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.
- Load the generated image (pansharpened188.tif) into the QGIS project and compare it to the original multispectral image (188_pcs_indices.tif).
- 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).
- Applying the segmentation algorithm:
- 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).
- 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.
[edit] Cloud detection in satellite images
- Load the raster image file 188_pca_indices.tif from the supervised folder of the course data.
- Load the raster image file SUB_LC81950242013188LGN00_B1.tif from geodata/raster/landsat/landsat8/DOY188 folder into the project. (Coastal Aerosol Band)
- 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.
- 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.
- Open the ratio image ratio_band11_band1.tif in Monteverdi via File --> Open dataset.
- For filtering the image, select Filtering --> Threshold and select the ratio image generated in the previous step. Confirm with OK.
- 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.
- Export the image: Select the output image with right clicking and selecting Export dataset. Save the output as cloud_mask.tif.
- Open the cloud_mask.tif image in QGis
- Convert the image to shapefile: select Processing --> SAGA --> Shapes – Grid --> Vectorising Grid classes. Select the image.
- To calculate the area of the polygons in the shapefile: Select Vector --> Geometry tools --> Export/ Add Geometry Columns
- 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.
- Place the image and 188_pca_indices.tif on top of each other to see the final result of the clouds delineated (figure I).