| sits_label_majority {sits} | R Documentation |
Takes a set of classified raster layers with labels, and executes a majority filter for post-processing.
sits_label_majority(cube, window_size = 3, output_dir = "./", version = "v1")
cube |
Classified image data cube. |
window_size |
Size of the window to apply majority filter |
output_dir |
Output directory where to out the file |
version |
Version of resulting image (in the case of multiple tests) |
A data cube with metadata information on post-processed data
Rolf Simoes, rolf.simoes@inpe.br
## Not run:
# Retrieve the samples for Mato Grosso
# select band "ndvi"
samples_ndvi <- sits_select(samples_modis_4bands, bands = "NDVI")
# select a random forest model
rfor_model <- sits_train(samples_ndvi, sits_rfor(num_trees = 500))
# Classify a raster file with 23 instances for one year
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
# create a data cube based on the information about the files
cube <- sits_cube(
source = "LOCAL",
name = "sinop-2014",
origin = "BDC",
collection = "MOD13Q1-6",
data_dir = data_dir,
delim = "_",
parse_info = c("X1", "X2", "tile", "band", "date")
)
# classify the raster image
probs_cube <- sits_classify(cube,
ml_model = rfor_model,
output_dir = tempdir(),
memsize = 4, multicores = 2
)
# label the classification
label_cube <- sits_label_classification(probs_cube, output_dir = tempdir())
# smooth the result with a majority filter
label_maj_cube <- sits_label_majority(label_cube, output_dir = tempdir())
## End(Not run)