adehabitat (version 1.8.20)

labcon: 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

See Also

asc for further information on the class asc

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab