beginning gif up gif contents news

Next: Segmentation: The Hough Transform
Up: Lectures
Previous: Segmentation: Introduction and Edge Detection

 

Segmentation: Edge Linking and Boundary Detection

Last updated on Wednesday, October 25, 1995 at 9:00 AM.


Reading

Gonzalez and Woods, 7.2.1 and 7.2.3
(we'll come back to 7.2.2 in the next lecture)


Introduction

In the last lecture, we discussed how to identify possible edge pixels. However, these tests are made one-by-one and don't necessarily produce closed object boundaries because of noise, intensity variation, etc.

In this lecture, we'll talk about how to link sets of possible edge pixels to find connected boundaries. (In other words, we'll start playing connect-the-dots.)


Gradient-Magnitude Thresholding

A common step in edge detetion is to follow the gradient operator by a magnitude threshold.


We'll call the set of edge pixels.


Local Processing: Edge Linking

One way to find connected sets of edge pixels is to trace from pixel to pixel through possible edge points.

We can link adjacent edge pixels by examining each pixel-neighbor pair and seeing if they have similar properties:

  1. Similar gradient magnitude: for some magnitude difference threshold T.
  2. Similar gradient orientation for some angular threshold A.
Once the links are established, we take sets of linked pixels and use them as borders.

Notice that unless you constrain the linked pixels in some sense (for example, by scanning along horizontal or vertical lines), these can create clusters of linked pixels rather than long single-pixel thick chains.

Edge linking is usually followed by postprocessing to find sets of linked pixels that are separated by small gaps-these can the be filled in.


Local Processing: Edge Relaxation

A process similar to edge linking is edge relaxation.

Let's consider this question of whether or not a pixel between two sets of edge pixels is itself an edge pixel. One way of determining this is to look at the magnitude of the intervening pixel: if it is relatively high, but less than the threshold used to determine that its neighbors are edge pixels, it's probably an edge. Of course, we can also check the similarity of the gradient magnitude and gradient orientation, just like we did with edge linking.

We can also use this not just to interpolate between edge pixels, but to extrapolate from them as well. Suppose that we have two adjacent edge pixels followed my a slightly sub-threshold one (with similar gradient magnitude and orientation). Again, it's likely that this is really an edge pixel.

We can add these possible pixels to the set of edge pixels and repeat the process. Supposing that these are now really edge pixels, there may be other near-misses that we might want to allow as edge pixels.

In a sense, we are successively relaxing the criteria used to determine edge pixels, taking into account not just the properties of the pixel in question but of its neighbors as well.

This process is calle d edge relaxation.

In general, the term relaxation applies any technique such as this that iteratively re-evaluate pixel classification.


Global Processing: Graph Searching

Suppose that instead of finding clusters of linked edge pixels we want to find single-pixel thick curves for object boundaries.

One way to do this is to consider the image as being a graph where the vertices of the graph are the pixel corners and the edges of the graph are the pixel cracks. We can then use gradient or other edge-detecting operators to assign costs to each edge. Edge-like cracks would have low costs; cracks that do not look like edges would have high cost. The problem of finding an optimal boundary through as set of possible pixels thus becomes a simple minimal-cost path, graph-searching problem. (And of course, you should all know how to find minimum-cost paths through graphs.)

There are four basic subparts to this problem:

  1. How to contruct the graph,
  2. How to assign costs,
  3. How to choose starting and ending points, and
  4. How to find the minimum-cost path,

Let's take a look at an example before we discuss each of these four in more detail.

Example: Top-to-Bottom Scan

Graph Formulation

As an example, let's consider the case where we know that the boundary runs from the top to the bottom of some subset of the image without looping backwards. We can thus build a starting node representing the top of the image. The edges proceeding out from this node are all vertical cracks on the top row of the image. For each of these edges, successors include the corresponding vertical crack on next row, the horizontal crack to the left, and the horizontal crack to the right. Each of these has successors that go down vertically or sideways horizontally. Eventually, we get to the bottom row of the image where all paths lead to the end node.

Cost Function

In this simple case, we can let the cost of the edge along the crack between pixels p and q be


where is the maximum pixel value. Remember that we're trying to trying to trace between the inside (one intensity) and the outside (presumably another intensity) of an object.

Starting/Ending Points

In this case, selecting the starting and ending nodes is easy--they're simply the top and bottom of the image.

Graph Searching

An algorithm for finding the minimum cost path is on page 441 of your text. (We'll work thorugh this in class to show how it works).

Graph Formulation

Suppose that we know roughly where the boundary lies or some other information that constrains the location of the boundary. One such case is the example we just used.

The example is obviously a simple cast, but we can do similar things for more complicated cases. If we know that the boundary goes around the object with a monotomically increasing radial angle (i.e., it may move towards or away from the center as it goes around, but it never doubles back as one sweeps around), we can construct a constraining band around the potential boundary. We can also construct our graph so that it at each stage it sweeps radially around the image, but can vary in radial distance.

Both of these formulations give us discrete multistage graphs, either as we move from row to row or radially around the boundary. Sometimes, though, we may want to allow the graph to curve and wind, passing through possibly any pixel. In such a formulation, we can allow unoriented edges along any pixel crack in the image. In other words, an image would have nodes and edges. Our search could be between any two vertices and could trace through any of the edges. This is obviously a huge graph and a compute-intensity search.

Cost Functions

The cost function in the example uses only a simple 2-element mask. Better cost functions can be constructed by using

All of the above possible cost functions are based on the image data, not properties of the boundary curve itself. If we want smoother contours, we can add more cost for paths that would cause greater curvature.

Cost properties based on image data are called external cost terms; cost properties based on the boundary curve are called internal cost terms. Notice that internal cost for an edge is not fixed--it depends on the curve preceeding the edge.

Selecting Start/End Points

There are three common ways to select starting and ending points:

One important property of the starting and ending points is that thier selection shouldn't dramatically change the result. While this sometimes happens, it is not a good thing.

Graph Searching

Finding minimum-cost paths is a very old and well-studied topic in Computer Science.

Common ways include:

Notice that all of these involve our old friend: optimization.

Greedy Algorithms

Greedy algorithms attempt to get the most at each step. Simple pixel-by-pixel linking by taking the best successive edge would be one such greedy algorithm.

Expansion Algorithms

The algorithm discussed earlier in the example (and in your book) is an expansion-based one. The idea is to grow the search outwards looking for optimal additions to each path. One such method is Dijsktra's algorithm.

Expansion with Heuristics for Pruning

If we can estimate using some type of heuristics (guesses) what the remainder of a past might cost, we can prune unproductive paths. These might miss optimal paths through indiscriminate pruning, but it has been shown that if the heuristic is truly a lower bound on the remaining cost (though not necessarily exact), this finds the optimal path. The classis paper on using heuristic graph-searching methods for boundary finding is Martelli, 1976.

Dynamic Programming

Suppose that the graph has several discrete stages through which the paths must go. It can be shown that we can find the optimal path by finding the optimal path from the start to each node in the first stage, from each node in the first stage to the second, and so forth. The optimal path from the start to the second stage is the one whose sum from the start to the first stage plus the first to the second stage is minimal. This type of algorithm is called dynamic programming.


Global vs. Local Methods

This lecture highlights one recurring theme in Computer Vision: local processing vs. global processing. Sometimes we can use strictly-local processing, but we may miss more general properties in the image. We may also use strictly-global methods, but while they might optimize some global criteria they may not seem like ideal solutions when viewed locally. This balance between both local and global optimization is one we'll see frequently in this course.


Vocabulary



beginning gif up gif contents news

Next: Segmentation: The Hough Transform
Up: Lectures
Previous: Segmentation: Introduction and Edge Detection

© Bryan S. Morse, 1995