rDilate: Morphologically dilate foreground patches in a raster

Description Usage Arguments Details Value See Also Examples

Description

The morphological operation 'dilate' increases the value of cells along a gradient of values.

Usage

1

Arguments

obj

[RasterLayer(1)]
The object to modify.

kernel

[matrix(1)]
scan the raster with this kernel (default is a 3 by 3 cells diamond kernel).

Details

A morphological dilation changes the values in a raster after comparing each value to a kernel that moves systematically across the raster. A kernel is any 2D array with an odd number of cells in each dimension and a focal cell in the middle. The cells of a kernel can have four categories of values: 0, 1, NA and any value > 1. When the kernel values match the values of the input raster, the input raster cell covered by the focal kernel cell is modified according to a specific operation, for instance the smallest value covered by the kernel is assigned.

Rasters are either binary or non-binary (greyscale) rasters.

Value

A RasterLayer of the same dimension as obj, where a dilation has been performed.

See Also

Other operators to morphologically modify a raster: rErode, rMorph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
input <- rtRasters$continuous
binarised <- rBinarise(input, thresh = 30)
visualise(rDilate(binarised))

# use another kernel
(myKernel <- matrix(1, 3, 3))
visualise(rDilate(binarised, kernel = myKernel), new = TRUE)

# dilate also non-binary rasters
visualise(raster::stack(input, rDilate(obj = input)))

EhrmannS/rasterTools documentation built on May 28, 2019, 8:24 a.m.