grow_black | R Documentation |
Grow black pixels in a binary mask using a kernel of user-defined size. Useful to reduce errors associated with inter-class borders.
grow_black(bin, dist_to_black)
bin |
logical terra::SpatRaster with one layer. A binarized
hemispherical image. See |
dist_to_black |
numeric vector of length one. Buffer distance (pixels) used to expand black regions. |
Expands the regions with value FALSE
(typically rendered as black) in a
binary image by applying a square-shaped buffer. Any white pixels (value
TRUE
) within a distance equal to or less than dist_to_black
from a black
pixel will be turned black.
Logical terra::SpatRaster with the same dimensions as bin
. Compared
to the input bin
, black regions (FALSE
) have been expanded by the
specified buffer distance.
## Not run:
r <- read_caim()
bin <- binarize_with_thr(r$Blue, thr_isodata(r$Blue[]))
plot(bin)
bin <- grow_black(bin, 11)
plot(bin)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.