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 such as Square Tracing algorithm, Moore-Neighbor Tracing algorithm and the Theo Pavlidis’ algorithm have been used for boundary tracing.[1] With an abstract cell complex representation of a digital image, the boundary point coordinates may be extracted from that digital image by following an algorithm created by Dr Kovalevsky using modulo division and simple pixel lookups. A generic approach using vector algebra for tracing of a boundary can be found at.[2] An extension of boundary tracing for segmentation of traced boundary into open and closed sub-section is described at.[3]

Algorithm

This algorithm assumes a single connected region within the binary image and begins with an exhaustive search to locate the first foreground pixel by iterating over the columns and rows of the image.

For this example digital region the boundary point depicted in red is the starting point for the boundary tracing algorithm since it is the point / 0-cell for the first foreground pixel located along a row major order search.
// 2D Point data structure
typedef struct P
{
    int x; // col
    int y; // row

    P(int a , int b)
    {
        x = a;
        y = b;
    };
} Point;

// Example Image Data
const int width  = 6; 
const int height = 10;
int[height][width] image = { { 0 , 0 , 0 , 0 , 0 , 0 } ,
                             { 0 , 0 , 1 , 1 , 1 , 1 } ,
                             { 0 , 0 , 1 , 1 , 1 , 1 } ,
                             { 0 , 1 , 1 , 1 , 1 , 1 } ,
                             { 1 , 1 , 1 , 1 , 1 , 0 } ,
                             { 1 , 1 , 1 , 1 , 1 , 0 } ,
                             { 0 , 0 , 1 , 1 , 1 , 0 } ,
                             { 0 , 0 , 1 , 1 , 1 , 0 } ,
                             { 0 , 0 , 1 , 1 , 1 , 0 } ,
                             { 0 , 0 , 0 , 0 , 0 , 0 } };

// Exhaustive row-major order search for first foreground pixel
Point startPoint;
for ( int row = 0 ; row < height ; row++ )
{
    for ( int col = 0 ; col < width ; col++ )
    {
        if ( image[row][col] == 1 )
        {
           startPoint.x = col;
           startPoint.y = row;
           return;
        }
    }
}
The direction assignments given to various crack orientations to create a means of coding a set of boundary points.

Once that pixel is located the algorithm may begin by tracing the cracks of the region in a counterclockwise fashion following one of four possible directions at each step. These directions are represented by a crack code sequence: 0 (East), 1 (South), 2 (West), 3 (North)

References

  1. Contour Tracing Algorithms
  2. Vector Algebra Based Tracing of External and Internal Boundary of an Object in Binary Images, Journal of Advances in Engineering Science Volume 3 Issue 1, January - June 2010, PP 57-70
  3. Graph theory based segmentation of traced boundary into open and closed sub-sections, Computer Vision and Image Understanding, Volume 115, Issue 11, November 2011, Pages 1552–1558

External links

This article is issued from Wikipedia - version of the Monday, December 28, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.