Learn R Programming

imager (version 0.42.19)

label: Label connected components.

Description

The algorithm of connected components computation has been primarily done by A. Meijster, according to the publication: 'W.H. Hesselink, A. Meijster, C. Bron, "Concurrent Determination of Connected Components.", In: Science of Computer Programming 41 (2001), pp. 173--194'.

Usage

label(im, high_connectivity = FALSE, tolerance = 0)

Arguments

im

an image

high_connectivity

4(false)- or 8(true)-connectivity in 2d case, and between 6(false)- or 26(true)-connectivity in 3d case. Default FALSE

tolerance

Tolerance used to determine if two neighboring pixels belong to the same region.

Examples

Run this code
imname <- system.file('extdata/parrots.png',package='imager')
im <- load.image(imname) %>% grayscale
#Thresholding yields different discrete regions of high intensity
regions <- isoblur(im,10) %>% threshold("97%") 
labels <- label(regions)
layout(t(1:2))
plot(regions,"Regions")
plot(labels,"Labels")

Run the code above in your browser using DataLab