OtsuSeg is an R package designed for the segmentation of burned areas using smoothed histograms and Otsuโs thresholding method applied to spectral indices such as the Normalized Burn Ratio (NBR).
Authors: Hammadi Achour, Olga Viedma, Zina Soltani, Imene Habibi, Wahbi Jaouadi
The package provides tools to:
Large example datasets are hosted externally and are not bundled in the CRAN/GitHub package to comply with size limits.
These files are hosted at: https://github.com/olgaviedma/OtsuSeg/releases/tag/v0.1.0
library(OtsuSeg)
# Download and extract example data
get_external_data()
# 1.Load a specific file as a raster object
<- get_external_data("NBRpre.tif", load = TRUE)
NBRpre <- get_external_data("NBRpost.tif", load = TRUE)
NBRpost <- get_external_data("shapefile_reference.shp", load = TRUE)
shapefile_reference
## 2.Fire scars segments
<- file.path("D:/OLGA/binary_segments.shp")
shapefile_path <- binarize_raster(NBRpre, NBRpost, shapefile_path = shapefile_path)
result
print(result$area_hectares)
<-result$binary_raster_smoothed
raster<-st_as_sf(result$binary_shapefile)
polygons
plot(raster, main = "Binary Raster (Smoothed)")
plot(polygons, main = "Binary Shapefile")
## 3.Accuracy assessmet
<-polygons
binary_shape <- st_as_sf(shapefile_reference)
reference_shape
# Apply Quality Control
<- Quality_control(binary_shape, reference_shape)
result2 print(result2)
This documentation includes examples, illustrations, and step-by-step workflows to guide the use of the package.
๐ Note: If the links stop working after the first click, this is a known issue with GitHub Pages navigation and browser cache. The links are correct and stable, but the browser may cache or misroute when going back from GitHub Pages. For the best experience, open HTML and PDF documents in a new window or tab (right-click the link and choose โOpen in New Tabโ).
To install the latest version of OtsuSeg
:
#The CRAN version:
install.packages("OtsuSeg")
# Install the 'remotes' package if not already installed
install.packages("remotes")
# Install 'otsuSeg' from GitHub
::install_github("olgaviedma/OtsuSeg") remotes