Corner contact can connect two pixels under one rule and separate them under another. Connectivity belongs to the segmentation definition.
Retain the adjacency rule
A two-dimensional binary labeling operation groups foreground according to a chosen connectivity. Four-neighbor adjacency uses shared sides; eight-neighbor adjacency also permits diagonal neighbors. Identical foreground values can therefore produce different region memberships when the connection rule changes. Primary reference: MathWorks binary labeling connectivity.
For an original worksheet, write the permitted neighbor offsets beside the mask. Keep connectivity with the resulting count instead of describing it as an implementation detail that can be discarded. A visually touching corner does not resolve the intended meaning of foreground connectedness by itself.
Compare a fictional diagonal pair
Take the two-by-two mask with rows [1,0] and [0,1]. The two foreground positions share no side. Under four-neighbor adjacency, they form two components. Under eight-neighbor adjacency, their diagonal contact permits a path, giving one component.
No pixel value changed between these results. The membership rule changed. The invented array is too limited to establish a physical gap, contact condition or count of real packages; its purpose is to make the topological rule explicit before region counts are interpreted.
Check the subsequent question
Prepare an original neighbor diagram and label each result with the rule used. If subsequent calculations use region area or centroids, preserve their component memberships from the same connectivity setting. Do not compare counts from different rules as if they were repeated measurements under identical definitions.
This guide gives no universal choice for HM inspection. The relevant adjacency depends on what the mask is meant to represent and how that interpretation is evaluated. Its reader decision is whether a change in reported component count arose from changed pixels or from a changed connection rule.
Customer Questions
Are the fictional foreground pixels side neighbors?
No. They touch only diagonally.
What are the two component counts?
Two with four-neighbor and one with eight-neighbor adjacency.
Did their intensities change?
No. Only the connectivity definition changed.
Primary References
These references support the technical principles discussed in this guide. The worked examples and review questions are educational.
Discuss Your Machine Requirement
Share your product, container, required output and the evidence needed for your technical review.
Request a Technical Review