erosion(w, r, ...)
## S3 method for class 'owin':
erosion(w, r, shrink.frame=TRUE, \dots,
strict=FALSE, polygonal=NULL)
## S3 method for class 'ppp':
erosion(w, r,\dots)
## S3 method for class 'psp':
erosion(w, r,\dots)
"owin"
or a line segment pattern (object of class "psp"
)
or a point pattern (object of class "ppp"
).TRUE
, erode the bounding
rectangle as well.as.mask
controlling the pixel resolution, if pixel approximation is used.polygonal=TRUE
) or
a pixel grid approximation (polygonal=FALSE
).
Ignored if gpclib
is disabled.r > 0
, an object of class "owin"
representing the
eroded region (or NULL
if this region is empty).
If r=0
, the result is identical to w
. If polygonal=TRUE
then a polygonal approximation
to the erosion is computed.
If polygonal=FALSE
then a pixel approximation
to the erosion is computed from the distance map of w
.
The arguments "..."
are passed to as.mask
to control the pixel resolution.
The erosion consists of all pixels whose distance
from the boundary of w
is strictly greater than r
(if
strict=TRUE
) or is greater than or equal to r
(if
strict=FALSE
).
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"
.
Polygonal calculations require the gpclib
package which is subject to licence restrictions.
It is enabled by spatstat.options(gpclib=TRUE)
.
See licence.polygons
.
If shrink.frame
is false, the resulting window is given the
same outer, bounding rectangle as the original window w
.
If shrink.frame
is true, the original bounding rectangle
is also eroded by the same distance r
.
To simply compute the area of the eroded window,
use eroded.areas
.
dilation
for the opposite operation.
owin
,
as.owin
,
eroded.areas
w <- owin(c(0,1),c(0,1))
v <- erosion(w, 0.1)
# returns rectangle [0.1, 0.9] x [0.1,0.9]
v <- erosion(w, 0.6)
# erosion is empty
Run the code above in your browser using DataLab