labcon function

Labelling Connected Features

Labelling Connected Features

This function attributes unique labels to pixels belonging to connected features on a map of class SpatialPixelsDataFrame.

labcon(x)

Arguments

  • x: an object of class SpatialPixelsDataFrame with one column

Returns

Returns a matrix of class asc, of type "factor", with a number of levels equals to the number of connected components

Author(s)

Clement Calenge clement.calenge@ofb.gouv.fr

See Also

SpatialPixelsDataFrame-class for further information on the class SpatialPixelsDataFrame

Examples

data(lynxjura) sa <- lynxjura$map[,1] ## build an image with separate components sa[[1]][sa[[1]]<50] <- NA ## show the connected components image(sa) image(labcon(sa))
  • Maintainer: Clement Calenge
  • License: GPL (>= 2)
  • Last published: 2024-09-06

Useful links