The function segments a mosaic using an interative process where the user picks samples from background (eg., soil) and foreground (eg., plants).
Arguments
- mosaic
A mosaic of class
SpatRaster, generally imported withmosaic_input().- basemap
An optional
mapviewobject.- r, g, b
The layer for the Red, Green and Blue band, respectively. Defaults to
1,2, and3.- max_pixels
Maximum number of pixels to render in the map or plot (default: 500000).
- downsample
Downsampling factor to reduce the number of pixels (default: NULL). In this case, if the number of pixels in the image (width x height) is greater than
max_pixelsa downsampling factor will be automatically chosen so that the number of plotted pixels approximates themax_pixels.- quantiles
the upper and lower quantiles used for color stretching.
- return
The output of the function. Either 'mosaic' (the segmented mosaic), or 'mask' (the binary mask).
Value
An SpatRaster object with the segmented mosaic (if return = 'mosaic') or a mask (if return = 'mask').
Examples
if (interactive() && requireNamespace("EBImage")) {
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))
seg <- mosaic_segment_pick(mosaic)
mosaic_plot(seg)
}
