Problem:
I have a large double (2d) array filled with various shortcuts. Each element (cell) in a double array contains a set of labels, and some elements in a double array may be empty. I need an algorithm to cluster elements in a double array into discrete segments. A segment is defined as a set of pixels that are adjacent within a double array, and one label that has all of these pixels in the segment. (Diagonal adjacency is not taken into account, and I do not cluster empty cells).
|-------|-------|-------|
| Jane | Joe | |
| Jack | Jane | |
|-------|-------|-------|
| Jane | Jane | |
| | Joe | |
|-------|-------|-------|
| | Jack | Jane |
| | Joe | |
|-------|-------|-------|
In the above arrangement of labels, distributed across nine elements, the largest cluster is the Jane cluster, which occupies the four upper left cells.
What I thought:
, , . , . / , .
, , . , , . - , .
:
, , : . , , , .
, , , . , , , , .
, - , .
?
Edit:
- , . :
Segment 1 - Jane: (1,3), (2,3), (1,2), (2,2)
Segment 2 - Joe: (2,3), (2,2), (2,1)