Your SlideShare is downloading. ×
Loop snakesiv05
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Loop snakesiv05


Published on

The topologically adaptable snake model, or simply Tsnakes, …

The topologically adaptable snake model, or simply Tsnakes,
is a useful tool for automatically identifying
multiple segments in an image. Recently, in [4], a novel
approach for controlling the topology of a T- snake was
introduced. That approach focuses on the loops formed
by the projected curve which is obtained at every stage
of the snake evolution. The idea is to make that curve the
image of a piecewise linear mapping of an adequate
class. Then, with the help of an additional structure, the
loop-tree, it is possible to decide in O(1) time whether
the region delimited by each loop has already been
explored by the snake. In the original proposal of the
Loop Snakes model, the snake evolution is limited to
contraction and there is only one T-snake that contracts
and splits during evolution. In this paper we generalize
the original model by allowing the contraction as well as
the expansion of several T-Snakes.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Loop Snakes: The Generalized Model ANTONIO OLIVEIRA1, SAULO RIBEIRO1, CLÁUDIO ESPERANÇA1, GILSON GIRALDI2 1 Dept. of Syst. Eng. and Comp. Sciences -COPPE/Federal Univ. of Rio de Janeiro, Brazil 2 National Laboratory of Scientific Computation – Petrópolis, Brazil oliveira,saulo,; Abstract changes without adding extra machinery. Among the The topologically adaptable snake model, or simply T- proposed works to address this limitation, the T-snakes snakes, is a useful tool for automatically identifying model has the advantage of being a general one. The T- multiple segments in an image. Recently, in [4], a novel snakes have the ability of changing their topology either approach for controlling the topology of a T- snake was by splits or merges allowing the recovery of more than introduced. That approach focuses on the loops formed one segment in the target image. The basic idea is to by the projected curve which is obtained at every stage embed a discrete deformable model within the of the snake evolution. The idea is to make that curve the framework of a triangulation of the image domain. The image of a piecewise linear mapping of an adequate Characteristic Function of the set of points already class. Then, with the help of an additional structure, the visited by the snake is, then, sampled at the nodes of that loop-tree, it is possible to decide in O(1) time whether triangular grid. Placing a snaxel on every edge where the region delimited by each loop has already been that characteristic function changes value and linking explored by the snake. In the original proposal of the those placed on adjacent edges, we have a simple way of Loop Snakes model, the snake evolution is limited to evolving a snake which is able to perform topological contraction and there is only one T-snake that contracts changes. and splits during evolution. In this paper we generalize In the Loop Snakes model proposed in [4], the the original model by allowing the contraction as well as decomposition framework consists of a mesh of square the expansion of several T-Snakes. cells which is the easiest way of avoiding the well known direction bias that original T-snakes have. The Characteristic Function sampled at the grid nodes is replaced by a matrix of flags indicating for each cell 1. Introduction whether it has been visited earlier by the projected curve – PC – of the current iteration. Parametric Snake models are deformable models The fact that it, essentially, uses only data produced in proposed by Kass at al. [2] which have been successfully the current step is a noticeable difference which makes it applied in a variety of problems in computer vision and easier refining the mesh or making a snake move image analysis [3]. Its mathematical formulation makes backwards. Topological changes are performed based on easier to integrate, in a single extraction process, image the loops formed by that projected curve. The regions data, an initial estimation, desired contour properties and delimited by some of these loops – which are named knowledge based constraints. In comparison to other closed – have already been totally explored, while those methodologies to segment an image, they have the encircled by others – called open loops – have not been appreciable property of producing a closed polygonal visited yet. While closed loops must be discarded, the curve at any iteration while some classical gradient based open ones are made the snakes of the next stage and for approaches only get that at the end of a sequence of that reason, we choose to call them loop snakes. Figure 1 different processes. The updating procedure performed at pictures this idea. It shows a step of a snake evolution each step is usually computationally lighter than those with the arrows indicating the displacement applied to employed in relaxation methods and the interaction the snaxels in the step. In the projected curve of that step between snaxels serves to obtain smoother border some self-intersection points happen. These points define approximations while other simple alternatives – like closed loops– those enclosing regions that have already thresholding – may require a post-processing specifically been doubly swept by the snake – and open loops for that. delimiting regions yet to be explored. Despite of their capabilities, a known limitation of most When a loop L is formed, its label – closed or open – snake methods is that the topology of the structures of can be found in O(1) time, either by considering the label interest must be known in advance since the of the loops adjacent to L that have been found earlier or mathematical model cannot deal with topologicalProceedings of the Ninth International Conference on Information Visualisation (IV’05)1550-6037/05 $20.00 © 2005 IEEE
  • 2. by simply examining the connection of L with the rest of 2. Other models for controlling the topology the projected curve. The T-Snakes approach is composed basically by four components[3]: (1) a discrete snake model, which takes the initial snake of a step – S – into the, so called, transformed curve – TC; (2) a simple CF-triangulation of the image domain; (3) A way of projecting the transformed curve onto the grid edges, obtaining, then, the projected curve – PC; (4) a binary function, called characteristic function, defined on the grid nodes, which distinguishes the interior from the exterior of the projected curve. Figure 1: Original snake and the projected curve of a To clear the idea, consider the characteristic functions (f1 step. and f2) relative to the regions delimited by the two contours pictured in Figure 2. These functions are In [4], the whole image is encircled by a closed snake. sampled on the vertices of a CF-triangulation of the During its evolution, that snake is continuously plane and the T-snakes algorithm marks – or burns – contracted and eventually broken into smaller ones those vertices where max{f1,f2}= 1. The merge of the which are subjected to the same contraction process. curves is, then, obtained by choosing a vertex in every In this paper we generalize the loop snakes model edge linking a burnt to a non-burnt vertex. allowing the use of an a initial set of snakes, disjoint to Updating the set of burnt vertices at an iteration, each other, which may be either contracting or however, is not so simple. In [3] it is indicated that 16 expanding. Those snakes must only comply with the two different cases must be considered to decide whether a following simple rules. 1) Every expanding snake is vertex must be burnt. Also, in an usual iteration, where encircled by a contracting one. 2) A contracting snake no topological changes occur, it is easy to see that the cannot enclose another. These assumptions avoid that projected curve is unnecessarily traversed twice – once regions wider than twice the length of a mesh edge, are for burning nodes and once for choosing a vertex on swept more than once. every transition edge. Moreover, the use of triangular Two or more expanding snakes can be merged into a meshes, necessary to obtain new snakes as level sets in single one and the evolution of one of them can generate an unambiguous way, determines that grid diagonals several contracting snakes. Also a contracting and a should be considered. That can enlarge considerably the expanding snake can collide or simply get too close to number of crossings between PC and the grid edges each other. In this case, depending on the context, the besides introducing a directional bias. two snakes are either abandoned or are turned into standard ones and used as initial solutions of a dual process to get a finer approximation of the contour that presumably exists between or close to them. Having contracting and expanding snakes, a contour can be approximated both from inside and from outside which allows to determine it in a more reliable way in comparison to the case where snakes of only one type are used. As the focus of this work is the control of a snake topology, we consider that the physical displacement of a Figure 2: Two snakes colliding. Snaxels and grid nodes snaxel is computed by a “black-box”. Most of the inside each one of them are marked. secondary rules used in this work are also employed by other approaches: 1) If a cell C is cut by the snakes of a In the approach described in[1] a snaxel is displaced only certain number of consecutive steps, the snaxels in C are along the grid edge – e – where it is. If a vertex – v – of either frozen or subjected to an artificial force to take that edge is reached, the snaxel is exploded into three – them out of C – that is the way a snake escapes from a one on each edge adjacent to v different from e. This local minimum of energy. 2) The process ends when all methodology determines that the transformed curve is snaxels are frozen. always simple and that its vertices are already on grid This paper is organized as follows. Other models for edges. On the one hand, this method has none of the controlling the topology of a snake are revised on section drawbacks of the original T-snakes model mentioned 2 . Loop snakes are described in Sections 3-9 while above. On the other hand, it has its own disadvantages sections 10 and 11 are dedicated, respectively, to like complicating the way of displacing snaxels and computational results and to conclusions and future either reducing the time lag or provoking the alignment works. of snaxels, facts that can slow the snake evolution.Proceedings of the Ninth International Conference on Information Visualisation (IV’05)1550-6037/05 $20.00 © 2005 IEEE
  • 3. Loop-snakes is an alternative to avoid the difficulties of which is simple and has a single vertex on every mesh both that last method and the original T-snakes model. edge crossed by it. PC curves are only -curves while The price to be paid for that is to complicate the process topological snakes must be regular ones . Two -curves that makes a topological change. However, considering crossing the same sequence of mesh edges are said to be that: i) The process that must be executed at a general equivalent and a -intersection between two -curves is snaxel to keep topology under control, is extremely one which cannot be removed by replacing the curves by simple, in the case of the loop-snakes; ii) The number of equivalent ones. topological changes is only a small fraction of the To represent a -curve S = [si; i= 0 ... I-1] it suffices to number of snaxels that is generated; it can be concluded represent points in the relative interior of the grid edges. that Loop snakes are really a valid option to implement Here we will use the Cell - Edge of the cell - Point of the topologically adaptable snakes. edge (CEP) system where each si is represented by: (a) The cell coordinate C(si) indicating the cell containing 3. Loop Snakes [si , si+1]; (b) The edge coordinate E(si) indicating which of the four edges of C(si) contains si (the left, top, right Let S j= [sk, k=1,...,K(j)] , j=1,...J , be the snakes that and bottom edges are numbered 0, 1, 2 and 3, must be transformed at a certain stage. TC j = [t,k = T(sk), respectively); (c) p(si), the distance between si; and its k=1,...,K(j)] and PC j = [s,m, m=1,...,M(j)] will be burnt-vertex expressed in pixels. The use of CEP ,respectively, the transformed and projected curve coordinates makes it easier not only to enforce that the obtained from S j. Also let TC and PC be the union of all projected curve has appropriate properties but, also, to TC j and and PC j, respectively. detect and treat loops. The Loop-snakes approach is based in the following If S is an evolving snake the burnt-vertex of si, termed ui reasoning: is the vertex of the mesh edge containing si which is on 1) At first we enforce that every PC j is the result of the side of S that has already been explored. applying a mapping of a special class to a dilated version of the snake S j. That curve and the mapping will be The -Dilation of S – D(S) – is the curve obtained by characterized in section 5. The use of CEP coordinates, replacing every si by wi = ui + (si – ui), where is a given in section 4, makes it simpler to assure that PC j small positive number. The idea is to obtain a -curve has the property above . equivalent to S that passes very close to the burnt- 2) If PC j has the property given in 1, then the label of a vertices of si; i= 0 ... I-1. loop L can be obtained in a straightforward way from that of any loop adjacent to it that has been found earlier. If no such a loop exists, the label of L can be si determined by looking into its connection with the E(s)=1 i 2 remainder of PC. Finally, if PC j, itself, is a loop, its label will be found by verifying the position of its first vertices in relation to S j and the other snakes of the C(s) si+1 i stage. The whole labeling process is described in section 0 S 7. Part of that process is based on the concept of Loop- Tree of a curve, which is precisely characterized in 3 D(S) section 6. (A) 3) Splits – treated in section 8 – must be made before the (B) merges– focused in section 9. While splitting does not present any special difficulty, merging requires a more Figure 3: (A) Elements used in the CEP system. elaborate approach by the following simple fact: If PC j (B) A -curve and its -dilation. has the property indicated in 1, only a merge can change the contour of an open loop after its determination. The 5. PC as the image of an adequate mapping complexity of the specific processes of the merging phase, however, depends only on the number of loops We will consider that the projected curve obtained by generated at a stage. This makes the time spent by them evolving a topological snake Sj is the image of a negligible in comparison to that required by processing mapping applied to the -Dilation of that snake. the usually much larger number of snaxels generated Making the domain of be D(Sj), instead of Sj, reduces during the whole evolution process. the effort to make that mapping have some desirable properties. 4. Regular Curves and CEP coordinates Those properties must include that is a continuous order-preserving piecewise linear mapping which Hereafter, will refer to the mesh employed to partition associates points close to each other. To establish this the image domain. We call a -curve any polygonal line last requirement in a more formal way and to avoid that a such that: (a) Its vertices are the points where it intersects snake gets back to a cell it has already totally swept, we the mesh edges. (b) No vertex of the curve coincides require that for every vertex – ui , ; i= 0 ... I-1 – of D(S), with any vertex of the mesh. A regular -curve is oneProceedings of the Ninth International Conference on Information Visualisation (IV’05)1550-6037/05 $20.00 © 2005 IEEE
  • 4. ( ui) is in one of the 4 cells which are adjacent to the The second configuration to be avoided concerns to the other node of the mesh edge containing it. existence of reverse sweeping quadrilaterals. It is shown To characterize a last attribute that must have, some in Figure 5(B), where: i) The snaxels si and si+1 of S j and definitions are necessary : vertices sj and sj+1 of PC j lay on the 4 edges adjacent to 1)A mapping *: D(S) 2 is said to be equivalent to the non-burnt node of si . ii)The pairs (sj ,si) and (sj+1, if its image is a -curve PC* = [ s*j , j= 0 ... J-1] such si+1) lay on edges with the same direction. iii) [sj , sj+1] that:1) s*j and s’j are on the same mesh edge. 2) -1( s’j ) [ti-1, ti]. The occurrence of that configuration makes it and ( *)-1(s*j) are on the same edge of D(S). impossible to define in a way that it has no reverse 2) Let z and z be two points on the same edge of D(S) sweeping quadrilaterals. The correction, in this case, such that *(z) and *(z) are in the same mesh cell. consists, merely, of replacing ti by sj. Both cases are simultaneously handled by the procedure The quadrilateral [z, z, *(z), *(z)] is called a given below which must be applied at the creation of sweeping quadrilateral of *. every new vertex of PC j. The following notation is used: 3) * is said to be direct if none of its sweeping s, s and t will refer to the current vertex of S j, PC j and quadrilaterals is reverse. Figure 4 illustrates this concept. TC j, respectively. x.prev indicates the antecessor of vertex x on the polygonal line where it is. c is the last cell that has been crossed by PC j and t(c) is the final vertex of the last edge of TC j already generated, which intersects the cell c. Procedure Making Adequate {If(t =t(c)) then If (E(s) = (E(s)+2)mod.4) t = s; Else If (E(s)=(E(s)+1)mod.4 ) If(C(s)=C(s)) Figure 4 - Non-Direct (a-b) and Direct Mappings(c-d). {s.prev= s.prev; s = s}} The last requirement on is exactly, that it is equivalent This procedure embodies all that must be done when to a direct mapping *. If satisfies all the requisites computing a new vertex of PC in order to ensure that indicated above it is called adequate and has the is adequate. As it is shown in section 10 in most of the following good features: 1) The border of the strip vertices the first test results false which means that nothing more has to be done. covered by the sweeping quadrilaterals of is formed by D(S j) and a set of loops of PC j. 2) A series of results, given in Section 7 can be explored to label these loops. 6. Loop trees The main result of the theory supporting the Loop- A Loop-tree of a closed curve C with no multiple self- snakes approach states that will be equivalent to a intersection points, is a graph that can be obtained by the direct mapping, iff we manage to avoid the two following simple process: Choose a point s in C and a undesirable configurations involving snaxels of S j and direction D (either clockwise or counter-clockwise). vertices of PC j , which are depicted in figures 5-A and Traverse C in that direction starting at s. Every time a 5-B. In the configuration of figure 5-A, PC j crosses point x is revisited create a node to represent the loop D(Sj) which makes not monotonous. That formed by the part of C between the two visits to x, configuration is characterized by the fact that snaxels si concentrate that loop thoroughly at x and continue the and si+1 of S j and vertices sj and sj+1 of PC j lay on the 4 tour. After having completed it, for every loop L1 which edges adjacent to the burnt node of si . If such a has been concentrated on a point of another, L2, create an configuration is detected, the intersection between PC j oriented edge from the node of L1 to the node of L2. and D(S j) is eliminated by replacing sj-1 and sj by si-1 A curve and its loop-tree are shown in figure 6. and si, respectively. Loop-Trees of different topologies or with the same topology, but with different loop-node associations can be obtained for the same curve depending on the initial point taken and the circulation chosen to traverse the curve. This could make the snakes of the next stage – which are the open loops of PC j – depend on the vertex at which the construction of PC j starts and on the circulation chosen to generate that curve. Fortunately, if is adequate that problem will not exist. In this case, given an open loop L of PC j, in every loop-tree of that curve, there is a node representing L or another open Figure 5- Undesirable configurations loop equivalent to it.Proceedings of the Ninth International Conference on Information Visualisation (IV’05)1550-6037/05 $20.00 © 2005 IEEE
  • 5. Moreover, L is disjoint to the other loops of PC j. This 1) When evolving a loop-snake, we check whether the means that, from the moment it is created on, L can only first elements of its transformed curve are in cells be modified through a merge of PC j with other projected already visited by other loop-snakes or by that same curve. snake at an earlier steps. If that is true we mark the PC curve generated from that snake. 2) Unmarked PC curves consisting of an isolated loop are labeled open and those which are marked, closed This simple process – which is O(1) for loop – avoids that a contracting loop snake passes by an expanding one or encloses a region already swept without having its evolution process stopped. 8. Splitting Phase j To be able to adequately merge PC with a connected j 1 component CCk of PC i , by only considering the figure 6 - A curve and its loop-tree i 0 intersections between PC j and the open loops in CCk, it 7. Labeling the loops is necessary to process PC j separately – as if it was the only curve composing PC – identifying all its loops, To simplify the way of labeling the loops, contracting labeling them and splitting it , if necessary. However , to and expanding loop snakes must be traversed in different not have to traverse PC j a second time, its intersections j 1 directions so that the region yet to be explored is always on the same side of them. Here, we will consider that with components of PC i are also found during that i 0 contracting snakes are traversed in the positive direction and expanding ones in the clockwise one. process. At the end of it, those intersections which occur Also, for the sake of concision we will consider in this within a closed loop are discarded. From the remaining article that the initial vertex of any loop which is not the ones we obtain the loops generated by merges involving root of the loop tree of a connected component of PC, PC j. Figure 7 shows the result of the splitting of an has an antecessor- that is, a vertex generated before – in expanding snake. that curve1. Considering this assumption, the directions chosen for traversing snakes and the fact that PC j is obtained by applying an adequate mapping to D(S j), then, all non-root loops can be labeled through the following simple rule: Loops whose antecessor of its initial vertex is on its right side are open and need to be explored. If that antecessor is on the left side the loop is closed and can be discarded. If the root has children its label can be obtained in function of the label of any child by employing the four Figure 7 - The splitting of an expanding snake rules below: 1)If there is no -intersection separating parent and child 9. Merging Phase at their junction their labels must be the same. 2)If there is such an intersection, the parent of an open The first valid intersection of PCj with a connected loop is always closed. j 1 3) So does the parent of a closed loop which intersects it component CCk of PC i – xjk – does not form a loop. out of the junction. i 0 4) Finally, if no such an intersection exists the parent of a Instead of creating a new loop at that intersection, the closed loop is open. process appends the loop in CCk where it is, to the part of PCj generated until xjk. That concatenation must be made If a connected component of PC has a single loop it in a way that the resulting curve has no self -intersection means that: 1) It has no self-crossings nor intersections at xjk. That is achieved by adequately changing the links with other components; 2) It is the result of evolving a between the vertices of the segments of PCj and CCk single loop-snake. determining xjk. Figure 8 indicates how this can be done. In view of that isolated loops are labeled as follows: The fact that the first intersection of PCj and CCk – 1 which determines that a new merge occur – must be This assumption, however, is not necessary for the loop distinguished from the others determines that every snakes model work.Proceedings of the Ninth International Conference on Information Visualisation (IV’05)1550-6037/05 $20.00 © 2005 IEEE
  • 6. vertex of a projected curve must have an indicator that employed in this work which spends minimum effort allows to identify, directly or indirectly , the connected when processing a plain snaxel and delay all the J complication to the moment a loop may be found. component of PC i where it is. As the set of Figures 9-A and 9-B represent examples where the i 0 connected components of PC varies during the method has been applied. construction of that curve, keeping those indicators updated is a version of the classical “union-and-find” problem which is only quasi-linear. This non-linearity, however, is not a problem considering that the number of connected components is bounded by that of the initial snakes, which is too small in comparison to the number of snaxels generated in the whole process. First intersection point External open loop (B) CCk (A) PCj Figure 9 - Examples where the method has been applied. Closed Loop Starting point 11. Conclusions and future works j of PC We described a method for controlling the topology of a family of evolving snakes, which can be both contracting Figure 8 - How the merge of two snakes is performed. and expanding . The whole process can be implemented by examining only contours – without the need of 10. Statistics and Examples of Segmentation considering their surroundings – and in a form that the curves relative to a step are traversed only once. As the A program for evolving loop-snakes has been processing essentially requires only data produced at the implemented and applied to a series of test examples. current step, it is easier to refine the cells mesh during The statistics obtained in these validation tests are the the process, revert the evolution direction of a snake and best argument in favor of the approach introduced here. even incorporate the structure used to control the For better evaluating the overall computational effort topology into the very representation of the curves. required by the approach, the vertices of PC have been Differently from the existing approaches there is no grouped in the following classes: A) vertices at which the directional bias or need of reducing the time lag for first test made by the procedure Making Direct, given controlling the topology. Finally, in view of the results in section 5 results false. B) Vertices at which a curve expressed in Table 1, we can consider that it has a PCj revisits a cell. Four classes of images have been computational gain in relation to these earlier considered - Synthetized images, Noisy images, Images alternatives. with many segments and Cells images with a textured Future work will address , specially, the construction background. The results obtained are presented in Table of models that evolve in 3D-images. 2D models not 1. requiring the projection of TC onto the grid edges is also a line to be explored. Table 1 Images I Images II Images III Images IV References A 414.677 1.909.476 822.413 787.013 B 6.359 8.540 12.541 3.805 [1] S. Bischoff and L. Kobbeit; Snakes with topology control, The Visual Computer, 2003. Overall 557.282 2.847.313 1.183.100 1.212.631 [2] M. Kass, A. Witkin and D. Terzopoulos - Snakes:Active contour models; Int. J. of Computer Vision, vol. 1, 321- 331, 1988. It can be observed in that table that the number of most [3] T. McInerney and D. Terzopoulos, Topologically costly vertices of PC, that is, those whose cell is being adaptable contour models; Proc. of Int. Conf of revisited, is extremely small in relation to the total Computer Vision, 840-845, 1995. number of them, never reaching 1.2%. Moreover, in any [4] A. Oliveira, S. Ribeiro, G. Giraldi, C. Esperança and R. case the vertices in group A are less than 64% of the Farias; Loop Snakes: Snakes with enhanced topology overall number of them. All the processing, specific of control, Proc. of the XVIII Brazilian Symp. on Comp. the approach described here, which is executed at the Graphs. and Image Process, 364-371 ,2004 creation of these vertices, resumes to a single test. The [5] A. Yuille and A.Black; Active Vision. MIT Press, 1993. numbers of Table I attest to the adequacy of the strategyProceedings of the Ninth International Conference on Information Visualisation (IV’05)1550-6037/05 $20.00 © 2005 IEEE