Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dilation

Morphological Dilation


Description

Perform morphological dilation of a window, a line segment pattern or a point pattern

Usage

dilation(w, r, ...)
 ## S3 method for class 'owin'
dilation(w, r, ..., polygonal=NULL, tight=TRUE)
 ## S3 method for class 'ppp'
dilation(w, r, ..., polygonal=TRUE, tight=TRUE)
 ## S3 method for class 'psp'
dilation(w, r, ..., polygonal=TRUE, tight=TRUE)

Arguments

w

A window (object of class "owin" or a line segment pattern (object of class "psp") or a point pattern (object of class "ppp").

r

positive number: the radius of dilation.

...

extra arguments passed to as.mask controlling the pixel resolution, if the pixel approximation is used; or passed to disc if the polygonal approximation is used.

polygonal

Logical flag indicating whether to compute a polygonal approximation to the dilation (polygonal=TRUE) or a pixel grid approximation (polygonal=FALSE).

tight

Logical flag indicating whether the bounding frame of the window should be taken as the smallest rectangle enclosing the dilated region (tight=TRUE), or should be the dilation of the bounding frame of w (tight=FALSE).

Details

The morphological dilation of a set W by a distance r > 0 is the set consisting of all points lying at most r units away from W. Effectively, dilation adds a margin of width r onto the set W.

If polygonal=TRUE then a polygonal approximation to the dilation is computed. If polygonal=FALSE then a pixel approximation to the dilation is computed from the distance map of w. The arguments "\dots" are passed to as.mask to control the pixel resolution.

When w is a window, the default (when polygonal=NULL) is to compute a polygonal approximation if w is a rectangle or polygonal window, and to compute a pixel approximation if w is a window of type "mask".

Value

If r > 0, an object of class "owin" representing the dilated region. If r=0, the result is identical to w.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk

See Also

erosion for the opposite operation.

dilationAny for morphological dilation using any shape.

Examples

plot(dilation(redwood, 0.05))
  points(redwood)

  plot(dilation(letterR, 0.2))
  plot(letterR, add=TRUE, lwd=2, border="red")

  X <- psp(runif(10), runif(10), runif(10), runif(10), window=owin())
  plot(dilation(X, 0.1))
  plot(X, add=TRUE, col="red")

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.