To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Boundary tracing

From Wikipedia, the free encyclopedia

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. Boundary is a topological notion. However, a digital image is no topological space. Therefore, it is impossible to define the notion of a boundary in a digital image mathematically exactly. Most publications about tracing the boundary of a subset S of a digital image I describe algorithms which find a set of pixels belonging to S and having in their direct neighborhood pixels belonging both to S and to its complement I - S. According to this definition the boundary of a subset S is different from the boundary of the complement I – S which is a topological paradox.

To define the boundary correctly it is necessary to introduce a topological space corresponding to the given digital image. Such space can be a two-dimensional abstract cell complex. It contains cells of three dimensions: the two-dimensional cells corresponding to pixels of the digital image, the one-dimensional cells or “cracks” representing short lines lying between two adjacent pixels, and the zero-dimensional cells or “points” corresponding to the corners of pixels. The boundary of a subset S is then a sequence of cracks and points while the neighborhoods of these cracks and points intersect both the subset S and its complement I – S.

The boundary defined in this way corresponds exactly to the topological definition and corresponds also to our intuitive imagination of a boundary because the boundary of S should contain neither elements of S nor those of its complement. It should contain only elements lying between S and the complement. This are exactly the cracks and points of the complex.

This method of tracing boundaries is described in the book of Vladimir A. Kovalevsky[1] and in the web site.[2]

YouTube Encyclopedic

  • 1/3
    Views:
    6 102
    13 020
    767
  • Writing a Mandelbrot Fractal Renderer with Boundary Tracing Algorithm
  • Creating a MIDI player in MS-DOS / BASIC
  • New Java Fractal Applet(The Fractal Microscope) *Tour*

Transcription

Algorithms

Types

  • Pixel-Following: walks through cells and records them. Typically only traces an outer boundary and require post-processing when changing the size of the space. Easiest to implement
  • Vertex-Following Method: walks through edges, recording edges and corners. Typically only traces the outer boundary. Sequential edges can be removed to simplify the data
  • Run-Data-Based: processes all cells in the space. Traces all boundaries in the image. Less efficient than other types for small single boundaries since all cells have to be processed. More efficient for large, complex images since the steps per individual cell are usually less than other types [3]

Examples

Algorithms used for boundary tracing:[4]

  • Square tracing algorithm.[5] Can only be used for 4-connected (non-diagonal) patterns and requires the stopping criteria to be entering the starting cell in the same direction as the beginning.
  • Moore-neighbor tracing algorithm is similar to the Square tracing algorithm with similar weaknesses but works with 8-connected (diagonal) patterns
  • Radial sweep [6]
  • Theo Pavlidis’ algorithm [7] tests three cells in front but the check can be short-circuited. Might fail on some patterns.
  • A generic approach using vector algebra for tracing of a boundary can be found at [8]
  • An extension of boundary tracing for segmentation of traced boundary into open and closed sub-section is described at [9]

Marching squares extracts contours by checking all corners of all cells in a two-dimensional field. It does not use an initial position and does not generate the contour as an ordered sequence so it does not 'trace' the contour. Has to check each cell corner for all four neighbors but since the checks are independent performance can be easily improved with parallel processing

Square tracing algorithm

The square tracing algorithm is simple, yet effective. Its behavior is completely based on whether one is on a black, or a white cell (assuming white cells are part of the shape). 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:

  • If you are in a white cell, go left.
  • If you are in a black cell, go right.

Keep in mind that it matters how you entered the current cell, so that left and right can be defined.

public void GetBoundary(byte[,] image)
{
    for (int j = 0; j < image.GetLength(1); j++)
        for (int i = 0; i < image.GetLength(0); i++)
            if (image[i, j] == 255)               // Found first white pixel
                SquareTrace(new Point(i, j));
}

public void SquareTrace(Point start)
{
    HashSet<Point> boundaryPoints = new HashSet<Point>();  // Use a HashSet to prevent double occurrences
    // We found at least one pixel
    boundaryPoints.Add(start);

    // The first pixel you encounter is a white one by definition, so we go left.
    // In this example the Point constructor arguments are y,x unlike convention
    // Our initial direction was going from left to right, hence (1, 0)
    Point nextStep = GoLeft(new Point(1, 0));               
    Point next = start + nextStep;
    while (next != start)
    {
        // We found a black cell, so we go right and don't add this cell to our HashSet
        if (image[next.x, next.y] == 0)
        {
            next = next - nextStep;
            nextStep = GoRight(nextStep);
            next = next + nextStep;
        }
        // Alternatively we found a white cell, we do add this to our HashSet
        else
        {
            boundaryPoints.Add(next);
            nextStep = GoLeft(nextStep);
            next = next + nextStep;
        }
    }
}

private Point GoLeft(Point p) => new Point(p.y, -p.x);
private Point GoRight(Point p) => new Point(-p.y, p.x);

See also

References

  1. ^ Kovalevsky, V., Image Processing with Cellular Topology, Springer 2021, ISBN 978-981-16-5771-9
  2. ^ http://www.kovalevsky.de, Lecture "Tracing Boundaries in 2D Images"
  3. ^ Seo, Jonghoon; Chae, Seungho; Shim, Jinwook; Kim, Dongchul; Cheong, Cheolho; Han, Tack-Don (March 2016). "Fast Contour-Tracing Algorithm Based on a Pixel-Following Method for Image Sensors". Sensors. 16 (3): 353. Bibcode:2016Senso..16..353S. doi:10.3390/s16030353. PMC 4813928. PMID 27005632.
  4. ^ Contour Tracing Algorithms
  5. ^ Abeer George Ghuneim: square tracing algorithm
  6. ^ Abeer George Ghuneim: The Radial Sweep algorithm 
  7. ^ Abeer George Ghuneim: Theo Pavlidis' Algorithm 
  8. ^ 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 [1]
  9. ^ 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 [2]
This page was last edited on 19 February 2024, at 05:02
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.