Two robot segmentation masks can have the same foreground area and the same Euler characteristic while containing different numbers of connected regions and holes. The characteristic is a combined topological summary, not a complete description of the mask.
In two dimensions, write chi = C − H, where C counts foreground components and H counts enclosed background holes. Interpreting either count requires a foreground definition, a connectivity rule, and an exterior boundary.
The following masks are original graph constructions. They do not measure physical object count, defects, or inspection acceptance.
Declare the digital plane and its exterior
Use a seven-by-seven binary array with row and column indices zero through six. Ones are foreground. All unlisted positions are background, and background outside the array is also treated as exterior.
For a four-connected foreground, use eight-connected background. For an eight-connected foreground, use four-connected background. This complementary choice avoids assigning the same diagonal passage simultaneously to both interpretations.
Count a hole as a background component that cannot reach the exterior under the declared background neighborhood. This is a digital graph definition, rather than a claim about subpixel physical gaps.
Scikit-image's euler_number documentation identifies the two-dimensional C − H definition and complementary connectivity. MathWorks' bweuler documentation independently defines components minus holes with a specified foreground connectivity. Their concepts support the calculations; the arrays below are independently chosen.
Start with one ring
Place foreground on the boundary of the three-by-three block spanning rows two through four and columns two through four. Leave its center, row three column three, as background.
The eight foreground positions form a single closed ring. They connect orthogonally around its perimeter, so C = 1 under either four- or eight-connected foreground.
The central background pixel has foreground on all four orthogonal neighbors and all four diagonal neighbors. It cannot reach exterior background under either background rule, so H = 1.
The characteristic is therefore chi = 1 − 1 = 0. The surrounding two-pixel-wide background border makes the exterior distinct from the enclosed central pixel.
Fill the center without changing the component count
Change only the central pixel to foreground. The mask now contains a solid three-by-three square with nine foreground pixels.
Its foreground remains one component. The enclosed background component has disappeared, so H falls from one to zero. The new characteristic is chi = 1 − 0 = 1.
The one-pixel change increased area and increased chi, while C remained unchanged. Looking only at foreground component count would miss this topological change.
This operation is a directly stipulated pixel edit. It is not a claim that a particular morphological closing operation would make the same edit under every structuring element or boundary convention.
Add a separate component instead
Return to the original eight-pixel ring and add one isolated foreground pixel at row zero column zero. Its closest ring position is row two column two, so no allowed one-step foreground link joins them under either neighborhood.
This second mask also has nine foreground pixels. Its counts are C = 2 and H = 1, giving chi = 1.
The solid square and the ring-plus-singleton mask consequently have equal area, nine, and equal characteristic, one. Their separate component and hole counts differ.
The summary cannot distinguish (C, H) = (1, 0) from (2, 1). More generally, increasing both C and H by the same amount leaves C − H unchanged.
That arithmetic does not make the masks geometrically equivalent. Location, boundary length, shape, and connectivity structure remain additional information outside the single characteristic.
Open a diagonal background passage
Again return to the original ring. Remove only its upper-left foreground corner, row two column two. Seven foreground pixels remain.
They still form one connected chain under four-connected foreground: the remaining top edge joins the right edge, then the bottom edge, then the left edge. Thus C is one under both foreground neighborhoods.
The central background pixel is now diagonally adjacent to the removed corner, which itself connects to the exterior background.
With four-connected foreground and eight-connected background, that diagonal background step is allowed. The center can escape to the exterior, so H = 0 and chi = 1.
With eight-connected foreground and four-connected background, that diagonal step is not allowed. Every orthogonal neighbor of the center is still foreground. The center remains a hole, so H = 1 and chi = 0.
The foreground component count is identical in both interpretations. Their different Euler characteristics come from the background hole definition, not from splitting or merging foreground components.
Connectivity and image edits are different changes
For the seven-pixel open-corner mask, changing the adjacency convention changes the interpretation without changing any stored pixel. Removing the corner from the original ring instead changed the data.
Both can change chi, but their provenance differs. A reproducible report must retain whether a topology difference came from segmentation, a later pixel operation, cropping, or an adjacency setting.
Cropping also changes which background can reach the exterior. A region that appears closed within one representation can be opened at a crop boundary. The explicit exterior treatment in these examples prevents that condition from being left implicit.
A topological number is not a physical count
A hole in a binary mask need not be a hole through a physical part. It can arise from a projected shape, illumination, occlusion, or the segmentation rule. Likewise, a connected region need not correspond to one physical object.
The two-dimensional C − H expression also should not be transferred unchanged to three-dimensional volume data, where cavities and tunnels enter different topological relationships.
For robot image records, retain C and H separately when their distinction matters, along with chi, foreground and background adjacency, crop, and boundary treatment. The original masks demonstrate why: one summary can agree while the structures that produced it differ.
Sources checked October 24, 2026
Scikit-image 0.25.2, measure.euler_number:
https://scikit-image.org/docs/0.25.x/api/skimage.measure.html
MathWorks, bweuler, documentation displayed as R2026b:
https://www.mathworks.com/help/images/ref/bweuler.html
All masks and topology counts are original hypothetical constructions. No image-analysis library was executed.
Illustration note: A generic robot vision scene is a concept illustration. It does not show the constructed masks or verified physical holes or objects.