Description Usage Arguments Details Value See Also Examples

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

1 |

`obj` |
[ |

`kernel` |
[ |

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.

For binary rasters the kernel cells with values 0 and 1 are matched accurately in the input raster. Cells with value NA will be ignored, i.e. "it does not matter what value is there".

For a non-binary raster the value 0 does not have any meaning and every 0 is turned into an NA. In case a non-binary kernel is defined to dilate a non-binary (greyscale) raster, each value of the input raster that is currently covered by the kernel is summarised with the focal kernel value and the maximum of this set of values is assigned to the input raster cell covered by the focal kernel cell.

A `RasterLayer`

of the same dimension as `obj`

, where a
dilation has been performed.

Other operators to morphologically modify a raster: `rErode`

,
`rMorph`

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)))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.