04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

.i<br />

394<br />

Chapter 7 Network Flow<br />

Thus we see that the maximization of q(A, B) is the same problem as the<br />

minimization of the quantity<br />

j~B<br />

(i,13aE<br />

IANIi,I|I=I<br />

As for the missing source and the sink, we work by analogy with our constructions<br />

in previous sections: We create a new "super-source" s to represent<br />

the foreground, and a new "super-sink" t to represent the background. This<br />

also gives us a way to deal with the values ai and b i that reside at the nodes<br />

(whereas minimum cuts can only handle numbers associated with edges).<br />

Specifically, we will attach each of s and t to every pixel, and use a~ and bi to<br />

define appropriate capacities on the edges between pixel i and the source-and<br />

sink respectively.<br />

Finally, to take care of the undirected edges, we model each neighboring<br />

pair (i, j) with two directed edges, (i, j) and (], i), as we did in the undirected<br />

Disjoint Paths Problem. We will see that this works very well here too, since<br />

in any s-t cut, at most one of these two oppositely directed edges Can cross<br />

from the s-side to the t-side of the cut (for if one does, then the other must go<br />

from the t-side to the s-side).<br />

Specifically, we define the following flow network G’ = (V’, E t) shown in<br />

Figure 7.18(b). The node set V t consists of the set V of pixels, together with<br />

two additional nodes s and t. For each neighboring pair of pixels i and j, we<br />

add directed edges (i,j) and (j, i), each with capacity p~j. For each pixel i, we<br />

add an edge (s, i) with capacity a~ and an edge (i, t) with capacity hi.<br />

Now, an s-t cut (A, B) corresponds to a partition of the pixels into sets A<br />

and B. Let’s consider how the capacity of the cut c(A, B) relates to the quantity<br />

q~(A, B) that we are trying to minimize. We can group the edges that cross the<br />

cut (A, B) into three natural categories.<br />

o Edges (s, j), where j ~ B; this edge contributes aj to the capacity of the<br />

cut.<br />

o Edges (i, t), where i ~ A; this edge contributes bi to the capacity of the<br />

cut.<br />

o Edges (i,)) where i ~ A andj ~ B; this edge contributes Pii to the capacity<br />

of the cut.<br />

Figure 7.19 illustrates what each of these three kinds of edges looks like relative<br />

to a cut, on an example with four pixels.<br />

Pij.<br />

b.<br />

7.10 Image Segmentation<br />

Figure 7.19 An s-~ cut on a graph constructed from four pLxels. Note how the three<br />

types of terms in the expression for q’(A, B) are captured by the cut.<br />

If we add up the contributions of these three kinds of edges, we get<br />

=q(,B). ’A<br />

(i,])~<br />

IAnli,jll~l<br />

So everything fits together perfectly. The flow network is set up so that the<br />

capacity of the cut (A, B) exactly measures the quantity q’(A, B): The three<br />

kinds of edges crossing the cut (A, B), as we have just defined them (edges<br />

from the source, edges to the sink, and edges involving neither the source nor<br />

the sink), correspond to the three kinds of terms in the expression for q’(A, B).<br />

Thus, if we want to minimize q’(A, B) (since we have argued earlier that<br />

this is equivalent to maximizing q(A, B)), we just have to find a cut of minimum<br />

capaciW. And this latter problem, of course, is something that we know how<br />

to solve efficiently.<br />

Thus, through solving this minimum-cut problem, we have an optimal<br />

algorithm in our model of foreground/background segmentation.<br />

(7.55) The solution to the Segmentation Problem can be obtained by a<br />

minimum-cut algorithm in the graph G’ constructed above. For a minimum<br />

cut (A’, B~), the partition (A, B) obtained by deleting s* and t* maximizes the<br />

segmentation value q(A, B).<br />

P~<br />

395

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!