conLabel: Assigns labels to connected components in a logical matrix

Description Usage Arguments Value Examples

Description

Assigns labels to connected components in a logical matrix

Usage

1
conLabel(x,N=4)

Arguments

x

A logical matrix whose connected components are to be detected

N

Number specifying whether to use 4 or 8 neighborhood connectivity (Can only be 4 or 8. Default is 4)

Value

A matrix with labeled connected components

Examples

1
2
3
4
5
x=matrix(c(1,1,1,0,0,0,0,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0,1,1,0,1,1,1,0,0,0,0,0),byrow=TRUE,nrow=8)

conLabel(x)
conLabel(x,4)
conLabel(x,8)

ra125/concomp documentation built on May 26, 2019, 8:51 p.m.