Region Growing Segmentation

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
Line 11: Line 11:
 
== Model Description ==
 
== Model Description ==
 
To access the Model script right click on it and select Edit model. Here are the steps followed in the model in order to obtain the final segmentation.
 
To access the Model script right click on it and select Edit model. Here are the steps followed in the model in order to obtain the final segmentation.
# Starting from the CHM, SAGA’s Seed generation geoalgorithm is performed three times changing the ''Bandwith'' parameter each time. A big bandwidth value will be used for extracting big crowns, the lowest value has been used to extract the seeds belonging to small crowns and the intermediate value for the places where there should be no crowns (gaps). These values can be changed for optimizing the model to the current CHM.
+
# Starting from the CHM, SAGA’s {{button|text=Seed generation}} geoalgorithm is performed three times changing the ''Bandwith'' parameter each time. A big bandwidth value will be used for extracting big crowns, the lowest value has been used to extract the seeds belonging to small crowns and the intermediate value for the places where there should be no crowns (gaps). These values can be changed for optimizing the model to the current CHM.
 +
 
 +
::Note: The Seed Generation parameters can be modified according to the type of forest under study. The exmple here described has been adjusted to a broadleaved forest with a high tree crown cover.
 +
 
 
# The seeds in point shapfile format generated for the gaps have to be filtered using the QGIS geoalgorithm {{button|text=Extract by attribute}}, applying a height threshold in order to keep just the seeds related to those places without tree crowns, e.g. those with a height value lower than 5 meters.
 
# The seeds in point shapfile format generated for the gaps have to be filtered using the QGIS geoalgorithm {{button|text=Extract by attribute}}, applying a height threshold in order to keep just the seeds related to those places without tree crowns, e.g. those with a height value lower than 5 meters.
 
# To avoid over-segmentation, a buffer around the seeds obtained for the large crowns has to be carried out using the QGIS geoalgorithm {{button|text=Fixed distance buffer}}. Afterwards, this buffer will be used to filter the points from the small crowns seeds, keeping only those points outside of the buffer. For this purpose, QGIS geoalgorithm {{button|text=Difference}} was used.
 
# To avoid over-segmentation, a buffer around the seeds obtained for the large crowns has to be carried out using the QGIS geoalgorithm {{button|text=Fixed distance buffer}}. Afterwards, this buffer will be used to filter the points from the small crowns seeds, keeping only those points outside of the buffer. For this purpose, QGIS geoalgorithm {{button|text=Difference}} was used.

Revision as of 15:01, 11 July 2016

QGIS Individual Tree Crown Segmentation Method

Different QGIS geoalgorithms are implemented in order to segment a greyscale single-band Canopy Height Model (CHM) raster using a Region Growing approach. These are the steps you need to follow to use the Image Segmentation Model. The following procedure is explained using QGIS version 2.12.2.

  1. Download the *.model file.
  2. Open QGIS and go to the Processing Toolbox; if the Toolbox is not opened go to Processing → Toolbox to activate it. Once the Toolbox is opened go to Models → Tools → Add model from file and load the previously downloaded model.
  3. The model should appear in the Models tab. Double click on it to execute.
  4. A window showing the different inputs and outputs should appear, just as if you were using any other geoalgorithm.
  5. You will need to provide the model with the CHM and a polygon shapefile containing the boundary of the plot that you want to segment.
  6. The main output is called Segments_noGaps, you can disable the rest since they are only used when creating the Model to check if every step is working properly.
  7. If any error window from Python pops up close it and the model will continue running properly. This error windows should not imply any error on the results of the model.

Model Description

To access the Model script right click on it and select Edit model. Here are the steps followed in the model in order to obtain the final segmentation.

  1. Starting from the CHM, SAGA’s Seed generation geoalgorithm is performed three times changing the Bandwith parameter each time. A big bandwidth value will be used for extracting big crowns, the lowest value has been used to extract the seeds belonging to small crowns and the intermediate value for the places where there should be no crowns (gaps). These values can be changed for optimizing the model to the current CHM.
Note: The Seed Generation parameters can be modified according to the type of forest under study. The exmple here described has been adjusted to a broadleaved forest with a high tree crown cover.
  1. The seeds in point shapfile format generated for the gaps have to be filtered using the QGIS geoalgorithm Extract by attribute, applying a height threshold in order to keep just the seeds related to those places without tree crowns, e.g. those with a height value lower than 5 meters.
  2. To avoid over-segmentation, a buffer around the seeds obtained for the large crowns has to be carried out using the QGIS geoalgorithm Fixed distance buffer. Afterwards, this buffer will be used to filter the points from the small crowns seeds, keeping only those points outside of the buffer. For this purpose, QGIS geoalgorithm Difference was used.
  3. SAGA’s geoalgorithm Merge layer is used for merging all the final seed shapefiles.
  4. Merged seeds are rasterized using GDAL’s function Rasterize (vector to raster). The resolution of the output raster has to match the CHM’s resolution. In this case, the resolution is set to 0.25x0.25.
  5. The CHM and the rasterized seeds have to be clipped by the extent of the plot’s boundary (*.shp) using Clip raster by mask layer from GDAL.
  6. SAGA’s Simple region growing is performed using the previous clipped raster files as inputs. All the parameters are set as default, except for the “Threshold – Similarity” which is set at 0.0001 in order to cover the entire plot with the regions.
  7. Parallel to this step, a mask for the gaps is created for later on clipping the gaps out of the segments.
    • Using the Raster calculator from GDAL with the CHM as input (“Input layer A”). The condition set is “A<5” so that the calculator returns a raster where, if the condition is true a value of 1 is assigned, and if not, a 0.
    • Afterwards, the generated raster is polygonized and the mask is generated by extracting the polygons with a value of 0 in the attribute table by using QGIS geoalgorithm Extract by attribute.
  8. Finally, the segments generated in the simple region growing are clipped with the gaps mask using Clip raster by mask layer from GDAL. This raster is clipped again with the boundary of the plot for being able to run “Hoover metrics” if necessary.
Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export