Labelling Connected Features

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.