Four-Neighbor and Eight-Neighbor Grids

Different adjacency rules define which neighboring pixels can connect. Some include diagonals, and others use only horizontal and vertical steps.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two selected cells
  2. State the convention with results

Trace two selected cells

Pixels at row zero column zero and row one column one touch diagonally. They are connected directly under eight-neighbor adjacency and separate under four-neighbor adjacency if no other cells are selected. See grids as graphs.

State the convention with results

Component counts depend on this choice. Test a diagonal pair so the code's selected rule is visible. Connected components supply the graph interpretation.[1][2]

References

  1. scikit-image Contributors, NumPy Images and Coordinate Conventions ↩
  2. scikit-image Contributors, Image Data Types and Representable Values ↩