Skip to contents

The function assigns clusters to all coordinate-pairs in pixel.idx. A cluster contains all pixels which share a non-diagonal link with each other.

Usage

adjacency(pixel.idx, sort_by_frequency = TRUE)

Arguments

pixel.idx

pixel.idx-object

sort_by_frequency

logical, control if clusters should be enumerated from 1 > N based on the number of elements in them. For more info, see documentation on reassign_integers_by_frequency()

Value

pixel.idx with added 3rd column clus mapping to a cluster

Details

This means that points (1/1), (1/2) and (2/2) are assigned the same cluster, whereas points (5/5) and (6/6) are assigned separate clusters.

To consider diagonal matches as well, see diagonal_adjacency()

Reference: https://stackoverflow.com/a/37946855