This tutorial presents R code for forest gaps and edges detection from Airborne Laser Scanning (ALS) data. The workflow is based on functions from packages `lidaRtRee` and `lidR`.
Licence: CC BY / Source page
Changelog
* Jan 2021: updated to comply with lidR 3.1.0 and lidaRtRee 3.0.0
+ Oct 2020: checked compatibility with lidR 3.0.3
+ May 2020: added edge detection
+ Feb 2019: updated for compatibilty with package lidR 2.0.0 and lidaRtRee 2.0.0
+ June 2018: first version
```{r include = FALSE}
library(lidR)
```
Licence: CC BY / [Source page](https://gitlab.irstea.fr/jean-matthieu.monnet/lidartree_tutorials/-/blob/master/gap.edges.detection.Rmd)
Histogram can be used to compare the distribution of surface in different classes of gap surface. For better visualization of the differences between the set of criteria, large gaps are not taken into account.
Histogram can be used to compare the distribution of surface in different classes of gap surface. For better visualization of the differences between the set of criteria, gaps bigger than 500 m^2^ are not taken into account.
In the previous part, a pixel that fulfills the maximum height criterion but does not fulfill the distance ratio criterion (i.e. it is too close to surrounding vegetation based on the distance / vegetation height ratio) is removed from gap surface. For edge detection, it seems more appropriate to integrate those pixels in the gap surface, otherwise some edges would be detected inside flat areas. The difference is exemplified in the following plots. The second image exhibits more gaps, because some gaps which are not reconstructed do not reach the minimum surface. The gaps in the second image are also larger, because gaps extend to all neighboring pixels complying with the height threshold, even if they do not comply with the distance criterion.
...
...
@@ -178,3 +169,5 @@ raster::plot(edgeInside, main="Edges (detection by erosion)", legend=FALSE)
raster::plot(edgeOutside, main="Edges (detection by dilation)", legend=FALSE)
```
Percentage of edges can be calculated as the ratio between edge pixels surface and total surface, multiplied by 100. The result is dependent on the raster resolution. Obtained percentage for the "erosion" method is `r round(sum(raster::values(edgeInside))/(nrow(edgeInside)*ncol(edgeInside))*100, 1)`, whereas it is `r round(sum(raster::values(edgeOutside))/(nrow(edgeOutside)*ncol(edgeOutside))*100, 1)` for method "dilation".