## S3 method for class 'owin':
distmap(X, \dots)
"owin"
).as.mask
to control pixel resolution."im"
) whose greyscale values
are the values of the distance map.
The return value has an attribute "bdry"
which is a pixel image.f(u)
is defined for any two-dimensional
location $u$ as the shortest distance from $u$ to $W$. This function computes the distance map of the window X
and returns the distance map as a pixel image. The greyscale value
at a pixel $u$ equals the distance from $u$ to the nearest
pixel in X
.
For computational efficiency, the distances computed are not the usual Euclidean distances. Instead the distance between two pixels is measured by the length of the shortest path connecting the two pixels. A path is a series of steps between neighbouring pixels (each pixel has 8 neighbours). This is the standard `distance transform' algorithm of image processing (Rosenfeld and Kak, 1968; Borgefors, 1986).
Additionally, the return value
has an attribute "bdry"
which is
also a pixel image. The grey values in "bdry"
give the
distance from each pixel to the bounding rectangle of the image.
If the window X
is not already a pixellated window
(a binary image mask), it is converted into one. The arguments
...
control the pixel resolution in this case, but will
otherwise be ignored.
This function is a method for the generic distmap
.
distmap
,
distmap.ppp
data(letterR)
U <- distmap(letterR)
plot(U)
plot(attr(U, "bdry"))
Run the code above in your browser using DataLab