erosion.owin(w, r, shrink.frame=TRUE, ..., strict=FALSE, polygonal=TRUE)
erode.owin(w, r, shrink.frame=TRUE, ..., strict=FALSE, polygonal=TRUE)
"owin"
.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
)."owin"
representing the
eroded window. The functions erode.owin
and erosion.owin
are
identical; they compute the erosion of the window w
.
If w
is a rectangle, the result will be a rectangle, or empty.
If w
is a polygonal window and polygonal=TRUE
,
a polygonal approximation to the eroded window will be computed.
Otherwise, w
and its erosion will be approximated by
a binary pixel image.
The arguments "..."
are passed to as.mask
to determine the pixel resolution. There is a sensible default.
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
).
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
.
dilate.owin
for the opposite operation.
owin
,
as.owin
,
eroded.areas
w <- owin(c(0,1),c(0,1))
v <- erode.owin(w, 0.1)
# returns rectangle [0.1, 0.9] x [0.1,0.9]
v <- erode.owin(w, 0.6)
# erosion is empty
Run the code above in your browser using DataLab