Orfeo Toolbox (OTB)
Awesome links
Installing and Loading the Orfeo Toolbox
Installing Orfeo Toolbox
Before using Orfeo Toolbox in R, you need to install the Orfeo Toolbox library on your system. The installation process may vary depending on your operating system.
Installing and Loading the RStoolbox
Package in R
The RStoolbox
package provides an interface to some of the Orfeo Toolbox functionalities.
# Install the RStoolbox package
install.packages("RStoolbox")
# Load the RStoolbox package
library(RStoolbox)
Reading and Writing Data
Reading Raster Data
Writing Raster Data
Image Preprocessing
Image Normalization
Principal Component Analysis (PCA)
Image Enhancement
Image Classification
Unsupervised Classification (K-means)
Supervised Classification (Random Forest)
# Perform supervised classification using Random Forest
trainingData <- read.csv("path/to/training/data.csv")
rf_model <- superClass(raster, trainData=trainingData, responseCol="class", model="rf")
Accuracy Assessment
Confusion Matrix
# Create a confusion matrix for classification results
referenceData <- read.csv("path/to/reference/data.csv")
conf_matrix <- validateMap(rf_model$map, valData=referenceData, responseCol="class")
Overall Accuracy
Change Detection
Change Detection Using Difference
# Perform change detection using difference
raster1 <- raster("path/to/raster1.tif")
raster2 <- raster("path/to/raster2.tif")
change <- raster2 - raster1
Change Vector Analysis
Visualization
Plotting Rasters
Plotting Classification Results
# Plot classification map
plot(rf_model$map)
# Plot classification probability map
plot(rf_model$map$probability)