bayes_smooth {bayesEO} | R Documentation |
Smooth probability images
Description
Takes a classified image with probabilities, and reduces outliers and smoothens probability according to Bayesian statistics
Usage
bayes_smooth(x, window_size = 7, neigh_fraction = 0.5, smoothness = 10)
Arguments
x |
SpatRaster object with probabilities images |
window_size |
Size of the neighborhood. |
neigh_fraction |
Fraction of neighbors with high probabilities to be used in Bayesian inference. |
smoothness |
Estimated variance of logit of class probabilities (Bayesian smoothing parameter). It can be either a vector or a scalar. |
Value
A SpatRaster object
Author(s)
Gilberto Camara, gilberto.camara@inpe.br
Examples
if (bayes_run_examples()) {
# select a file with probability values
data_dir <- system.file("/extdata/probs/", package = "bayesEO")
file <- list.files(data_dir)
# create a full path for the file
probs_file <- paste0(data_dir, "/", file)
# provide the labels
labels <- c("Water", "ClearCut_Burn", "ClearCut_Soil",
"ClearCut_Veg", "Forest", "Wetland")
# read the probs file
probs <- bayes_read_probs(probs_file, labels)
# smooth the probability image
probs_smooth <- bayes_smooth(probs,
window_size = 7,
smoothness = 20
)
# plot the probability image
bayes_plot_probs(probs_smooth)
}
[Package bayesEO version 0.2.1 Index]