Boundary tracing


Boundary tracing, also known as contour tracing, of a binary digital region can be thought of as a segmentation technique that identifies the boundary pixels of the digital region. Boundary tracing is an important first step in the analysis of that region.

Algorithms

Algorithms used for boundary tracing:
The square tracing algorithm is simple, yet effective. Its behavior is completely based on whether one is on a black, or a white cell. First, scan from the upper left to right and row by row. Upon entering your first white cell, the core of the algorithm starts. It consists mainly of two rules:
Keep in mind that it matters how you entered the current cell, so that left and right can be defined.

public void GetBoundary
public void SquareTrace
private point GoLeft => new Point;
private point GoRight => new Point;