mosaic_vectorize | R Documentation |
SpatRaster
mask to an sf
objectConverts a raster mask into a vectorized sf
object, with various options
for morphological operations and filtering.
mosaic_vectorize(
mask,
aggregate = NULL,
watershed = TRUE,
tolerance = 1,
extension = 1,
opening = FALSE,
closing = FALSE,
filter = FALSE,
erode = FALSE,
dilate = FALSE,
fill_hull = FALSE,
lower_size = NULL,
upper_size = NULL,
topn_lower = NULL,
topn_upper = NULL,
smooth = FALSE
)
mask |
An optional mask (SpatRaster) to mask the mosaic. |
aggregate |
The size as a fraction (percentage) of the input image size. Either a scalar (eg., 50), or a length-two numeric vector. In the last, different percentage reduction/expansion can be used for columns, and rows, respectively. |
watershed |
If |
tolerance |
The minimum height of the object in the units of image intensity between its highest point (seed) and the point where it contacts another object (checked for every contact pixel). If the height is smaller than the tolerance, the object will be combined with one of its neighbors, which is the highest. |
extension |
Radius of the neighborhood in pixels for the detection of neighboring objects. A higher value smooths out small objects. |
opening , closing , filter , erode , dilate |
Morphological operations (brush size)
|
fill_hull |
Fill holes in the binary image? Defaults to |
lower_size , upper_size |
Lower and upper limits for size for the image
analysis. Plant images often contain dirt and dust. Upper limit is set to
|
topn_lower , topn_upper |
Select the top |
smooth |
Smoothes the contours using a moving average filter. Default is
|
An sf
object containing vectorized features from the raster mask,
with added area measurements.
if (interactive() && requireNamespace("EBImage")) {
library(pliman)
mask <- image_pliman("mask.tif")
shp <- mosaic_vectorize(mask, watershed = FALSE)
mosaic_plot(mask)
shapefile_plot(shp, add = TRUE, lwd = 3)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.