labcon {adehabitat}R Documentation

Labelling Connected Features

Description

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

Usage

labcon(x)

Arguments

x an object of class asc

Value

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@oncfs.gouv.fr

See Also

asc for further information on the class asc

Examples

data(puechabon)
hr <- getsahrlocs(puechabon$sahr, "hr")
u <- getkasc(hr, "Jean")
image(u)

## numbering of the connected components
p <- labcon(u)
nlevels(p)
image(p)

##  stores the first component
c1 <- p
c1[c1 != 1] <- NA
image(c1)

##  stores the second component
c2 <- p
c2[c2 != 2] <- NA
image(c2)

[Package adehabitat version 1.8.3 Index]