Elham Sakhaee March 4, 14 1 Introduction I prepared this technical report as part of my preparation for Computer Vision PhD qualifying exam. Here we discuss derivation of curve evolution function for some well-known energy functionals. Parametric Curves A parametric curve is represented by C(s) (x(s),y(s)) with s being the arc length parametrization. Beitaspacecurveoraplanarcurve, onecanchangearc length parametrization to any arbitrary parametrization p using the following: ds dx +dy ds 1+( dy dx ) dx 1+y dx or ds ( dx dp ) +( dy dp ) dp x p +ypdp (1) WeknowthatcurvelengthisdefinedtobeL dsinarclengthparametrization. Replacing from the given infinitesimal length element ds we get L x p +y pdp C p dp Let s first show that minimizer of such length functional is κ. n L C p dp x p +y pdp () 1
Euler-Lagrange Formula L C(p) { L x d L dp x p L y d L dp y p d x p dp x p +yp d y p dp x p +yp x pp x p +yp x p xpp+xpypypp x p +y p x p +y p y pp x p +yp xpypxpp+y p ypp x p +y p x p +y p x ppy p+x py pp (x p +y p )3 y ppx p y px pp (x p +y p )3.( y p ).(x p ) x ppx p +xppy p x p xpp xpypypp (x p +y p )3 y ppx p +yppy p xpypxpp y p ypp (x p +y p )3 y ppx p y p x pp. n κ. n (x p +yp) 3 The above formula is the length minimization problem for a 3D curve. 3 Geodesic Active Contours x ppy p xpypypp (x p +y p )3 y ppx p xpypxpp (x p +y p )3 As we discussed in Differential Geometry tutorial, geodesics are minimal length space curves lying on a surface and connecting two points on that given surface. (3) Figure 1: a geodesic curve on a cone (blue) The formula derived in(3) is for a length minimization problem, however in geodesic active contours we are interested in finding a minimizer that takes the image characteristics (e.g. edges) into account. Let s define a general edge detector function g(c(s)) which can be any function that decreases at edges and increases elsewhere. 1 For example g(c(s)) 1+ I or more traditionally g(c(s)) I The energy functional that we are looking for would be: E α C p dp+λ g( I(C(p)) ) dp (4)
Let s define L α C p + λg(c) C p. It can be shown through Maupertuis Principle and Fermat s Principle from dynamicall systems, that minimizing the above energy functional is equivalent to minimizing intrinsic problem g(c(p)) C p dp. The details of proof of this equivalence is out of scope if this report, we refer the reader to ([1]) section.. and appendix A. Asdiscussedabove, solutionof(4)isgivenbyageodesiccurveinriemannian space. In order to minimize L R g(c(p)) C p dp we search for its gradient descent direction which is a way of minimizing the weighted length via steepest descent method. To do so we need to compute Euler-Lagrange formula. g(c(s))ds g(c(p)) C p dp we note that g p g x x p + g y y p g xx p +g y y p g(x(p),y(p))( x p +yp) dp L R C(p)... y ppx p y px pp (x p +y p )3 L R x(p) g x. x p +yp d dp ( x p x p +yp).g(x(p),y(p)) L R y(p) g y. x p +yp d dp ( y p x p +yp).g(x(p),y(p)) g x ( y p )+(g x ( y p )+g y x p )( y p ) y ppx p y px pp g x (x p )+(g x ( y p )+g y x p )(x p ) (x p +y p )3 (κ.g(c(p)) < g(c(p)), n > ) ( y p ) (κ.g(c(p)) < g(c(p)), n >)(x p ) (5) C t (κ.g < g, n >) n Where the n is the inward normal vector at any point of the curve. The geometric intuition of this gradient descent equation is that if we want to reach at a curve with minimal length the best way to evolve the curve C is to follow C(p) t (κ.g(c(p)) < g(c(p)), n >) n since it is the steepest descent equation and will lead to local minimum length curve. The detected object is the steady state solution of (5) when C(p) t. 4 Level-set framework Suppose a planar curve C(t) is represented by cross section of a 3D surface. 3
Figure : A curve can be implicitly defined as a level set of a surface Such representation of curve C is advantageous since it is independent of parametrization and hence is intrinsic. On the zero level-set plane, assume φ(x,y,t) is negative inside the zero level-set and positive outside, and by definition zero on the front(curve) itself. One can think of signed distance function as a potential φ. 4.1 Leve-set properties By definition (above) φ(x,y,t i ) is zero along the curve C for any fixed t i. Taking derivative with respect to t, we will get φ x x t +φ y y t hence [x t,y t ] T φ. But we know that the vector [x t,y t ] T is the tangent to the curve, therefore from [x t,y t ] T. φ we conclude that φ is normal to the curve. Accordingly, one can replace the inward normal n by normalized gradient of zero level-set as: φ φ n (6) Now, let s turn our attention to curvature of a level-set. From geometry of curves and surfaces we know that C s is the tangent to curve and C ss is the curvature of the curve. Given above definition for level-set, curvature of a level-set is also φ s in arc length parametrization. φ s s (φ xx s +φ y y s ) (φ xx x s +φ xy y s )x s +φ x x ss +(φ yx x s +φ yy y s )y s +y ss φ y φ xx x s +φ xy y s x s +φ yy y s+ < φ,c ss > (7) In order to simplify this equation we note that C ss κ n and φ φ n which allows for replacing x s with φy φ and y s with φx φ. Therefore we get the curvature of level-set to be κ φ xxφ y φ xy φ x φ y +φ yy φ x φ 3 (8) 4
One can simply work this out and get the well-known equation for curvature of the level-set, κ, to be κ. φ φ div( φ φ ) (9) 4. Level-set evolution Now we need to derive evolution equation of the embedding function φ such that evolving curve (C(t)) is represented by evolution of zero level-set of φ. by definition of zero level-set, we have φ(x,y,t) taking total derivative with respect to t we get φ x x t + φ y y t + dφ dt φ t (φ x x t +φ y y t ) [x t,y t ] T φ C t φ (1) In section (3) we derived C t (κg < g, n >) n. Replacing this in (1) we get: φ t (κg < g, n >) n. φ (κg < g, n >) φ φ. φ (κg < g, n >) φ κ φ g+ < g, φ > Replacing κ from (9) we finalize level-set evolution equation φ t as: (11) φ t div( φ ) φ g+ < g, φ > (1) φ 5 Closed Active Contours Beyond Gradient Vector Flow [] and traditional snakes, there are closed active contours that align themselves with the contour of the smoothed gradient vector field [3]. In order to intuitively understand why this alignment improves object detection, we can draw the following image: Figure 3: contour normal being aligned with image gradient 5
which shows that boundaries are more likely to lie where gradient of the object is aligned with the contour normal. Maximizing the alignment of the normal vector and gradient of the image is equivalent to minimizing the negative of the inner product of the two. 5.1 a simple case of closed active contours In case of closed active contours the functional to be minimized can be written as[3]: E ρ(< v, n >)ds (13) here n is the inward normal vector and v (u,v) is a vector flow. For now let s assume ρ(α) α. In the next section we deal with a more robust case where ρ(α) α and general case ρ(α). To derive the minimizer of the following energy functional: < v, n > ds [u(x,v),v(x,y)] T.[ y s,x s ]ds [u(x,y),v(x,y)] T 1. C p [ y p,x p ] C p dp [u(x,y),v(x,y)] T.[ y p,x p ] dp v(x,y)x p u(x,y)y p dp (14) d using chain rule for dp v(x,y) and d dpu(x,y), we find the Euler-Lagrange formula to be: { E E C(p) x d dp v(x,y) E y d dp u(x,y) { vx x p u x y p (v x x p +v y y p ) v y x p u y y p +(u x x p )+u y y p ) { (ux +v y )y p (u (u x +v y )x x +v y ). n p if one chooses v I E C(p) I. n { ux y p v y y p v y x p +u x x p (15) As described in section(3), the object edges are steady state solution of I. n E when C(p) since n we conclude that the object edges are I which are zero crossings of Laplacian of the image. 6
5. Generalized Closed Active Contours Now assume that ρ(α) α and note the fact u sign(u).u < v, n > ds v(x,y)x p u(x,y)y p dp { E sign(< v, n C >).(vx x p u x y p ) d dp (sign(< v, n >).v(x,y)) sign(< v, n >).(v y x p u y y p ) d dp (sign(< v, n >).u(x,y)) We also note that d dp sign(g(p)) g.δ(g(p)) and is assuming g(p) { sign(v(x,y)xp u(x,y)y p ).( u x y p v y y p ) sign(v(x,y)x p u(x,y)y p ).(v y x p +u x x p ) sign(v(x,y)x p u(x,y)y p )div(v). n Now Let s derive the evolution equation for a generic function ρ(α). ψ ρ (C) ρ(α)ds ρ(α) C p dp ψ C dρ dα. α C C p d dp ( C p C p.ρ(α)+ dρ dα. α C p C p ) We notice the following unities:... C p 1 C p C p.c p t unit tangent α 1 C p C p < v, t >. n (16) (17) (18) (19) 6 Region Based Active Contours Figure 4: Region-Based Image Segmentation 7
We assume that there are two regions in the image. we represent their average intensities with µ 1 and µ. The goal is to find the evolution equation of the contours in terms of known values µ 1 and µ and I(x,y). First Let s pose Green s theorem which we find useful in relating line integral along curve C to double integral on the region Ω enclosed by curve C L dx+m dy M x L y dx dy () C Just keep in mind what follows is Chan-Vese segmentation model WITHOUT regularization terms. Although not the exact Chan-Vese model [4] but gives an idea how region-based models can be worked out. Exact Chan-Vese segmentation model is given by: F(µ 1,µ,C) γ.length(c)+ν.area+λ 1 Ω (I µ 1 ) dxdy +λ Ω/ (I µ ) dxdy (1) And is minimzed through level set formulation which is beyond scope of this tutorial. So without regularization terms and setting λ 1 λ 1, energy functional of segmentation model would be: F(C) 1 (I µ 1 ) 1 dxdy + (I µ ) dxdy () Ω/ Opening the integrals, we get: F(C) 1 (I µ 1 ) 1 dxdy + (I µ ) dxdy (I µ ) dxdy (3) Ω and finally: 1 F(C) (µ µ 1) I(µ 1 µ ) dxdy µ +µ 1 (µ µ 1 )(I ) dxdy (4) We now apply Green s theorem to show that evolution equation is F(C) (µ µ 1 )(I µ+µ1 ). n Let M x f(x,y) and L y f(x,y) by Green s theorem we get: C 8
f(x,y) dxdy M x L y dxdy C L dx+m dy (5) Now use the fact that dx x s ds and dy y s ds replacing this into (5) we get L.x s +M.y s ds < [ M,L] T, n > ds (6) C From closed active contours section, we know that minimizer of C < v, n > ds is div(v). n,therefore minimizer of above functional is: C F(C) C div([ M,L]). n ( M x +L y ). n f(x,y). n (7) which is the desired result for evolving the regions. References [1] Caselles, V., Kimmel, R., Sapiro, G. (1997). Geodesic active contours. International journal of computer vision, (1), 61-79. [] Xu, C., Prince, J. L. (1998). Snakes, shapes, and gradient vector flow. Image Processing, IEEE Transactions on, 7(3), 359-369. [3] Kimmel, R., Bruckstein, A. M. (3). Regularized Laplacian zero crossings as optimal edge integrators. International Journal of Computer Vision, 53(3), 5-43. [4] Chan, T. F., Vese, L. A. (1). Active contours without edges. Image processing, IEEE transactions on, 1(), 66-77. 9