gaussian_smooth | R Documentation |
Takes a classified image with probabilities, and reduces outliers and smoothens probability according to a Gaussian filter
gaussian_smooth(x, window_size = 5, sigma = 1)
x |
SpatRaster object with probabilities images |
window_size |
Size of the neighborhood. |
sigma |
Standard deviation of the spatial Gaussian kernel |
A SpatRaster object
Gilberto Camara, gilberto.camara@inpe.br
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_file, labels)
# smooth the probability image
gauss <- gaussian_smooth(probs,
window_size = 5,
sigma = 1
)
# plot the probability image
bayes_plot_probs(gauss)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.