Compute the morphological erosion of one spatial window by another.
erosionAny(A, B)A %(-)% B
Windows (objects of class "owin"
).
Another window (object of class "owin"
).
The operator A %(-)% B
and function erosionAny(A,B)
are synonymous: they both compute the
morphological erosion of the window A
by the window B
.
The morphological erosion
Equivalently
If B
is a disc of radius r
, then
erosionAny(A, B)
is equivalent to erosion(A, r)
.
See erosion
.
The algorithm currently computes the result as a polygonal window using the polyclip library. It will be quite slow if applied to binary mask windows.
# NOT RUN {
B <- square(c(-0.1, 0.1))
RminusB <- letterR %(-)% B
FR <- grow.rectangle(Frame(letterR), 0.3)
plot(FR, main="", type="n")
plot(letterR, add=TRUE, lwd=2, hatch=TRUE, box=FALSE)
plot(RminusB, add=TRUE, col="blue", box=FALSE)
plot(shift(B, vec=c(3.49, 2.98)),
add=TRUE, border="red", lwd=2)
# }
Run the code above in your browser using DataLab