Grow black pixels in a binary mask using a kernel of user-defined size.
Useful to reduce errors associated with inter-class borders.
Usage
grow_black(bin, dist_to_black)
Value
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.
Arguments
bin
logical terra::SpatRaster with one layer. A binarized
hemispherical image. See binarize_with_thr() for details.
dist_to_black
numeric vector of length one. Buffer distance (pixels)
used to expand black regions.
Details
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.