Skip to contents

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

Usage

diagonal_adjacency(pixel.idx, sort_by_frequency = TRUE)

Arguments

pixel.idx

list declaring pixels to which target.color.hsv is applied

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. Additionally, points (5/5) and (6/6) are assigned the same cluster.

To consider diagonal matches as well, see adjacency()

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