Learn R Programming

mmand (version 1.6.3)

skeletonise: Skeletonise a numeric array

Description

Skeletonisation is the process of thinning a shape to a medial line or surface, and can be achieved using elementary mathematical morphology operations in a number of ways. Three methods are available through this function. They are all iterative and therefore relatively time-consuming.

Usage

skeletonise(x, kernel = NULL, method = c("lantuejoul", "beucher",
  "hitormiss"))

Value

A skeletonised array with the same dimensions as the original array.

Arguments

x

An object that can be coerced to an array, or for which a morph method exists.

kernel

An array representing the kernel to be used for the underlying morphology operations. The kernel is fixed for the "hitormiss" method, so this argument will be ignored.

method

A string giving the method to use. See Details.

Author

Jon Clayden <code@clayden.org>

Details

The default method is Lantuéjoul's formula, a union across repeated erosions, which works in any number of dimensions and may produce reasonable results on greyscale images, but does not in general produce a connected skeleton. Beucher introduced an alternative which may produce a better result (although again the skeleton may not be connected), but this implementation of the latter algorithm only applies to binary arrays. The final method uses the so-called hit-or-miss transform, which searches for exact patterns in the source array. This is guaranteed to produce a connected skeleton, which is often desirable, but uses fixed kernels (so the kernel argument is ignored) and is currently only implemented for 2D binary arrays.

References

C. Lantuéjoul (1977). Sur le modèle de Johnson-Mehl généralisé. Technical report, Centre de Morphologie Mathématique, Fontainebleau, France.

S. Beucher (1994). Digital skeletons in Euclidean and geodesic spaces. Signal Processing 38(1):127-141. tools:::Rd_expr_doi("10.1016/0165-1684(94)90061-2").

See Also

morphology

Examples

Run this code
x <- c(0,0,1,0,0,0,1,1,1,0,0)
k <- c(1,1,1)
skeletonise(x,k)

Run the code above in your browser using DataLab