active contours without edges tony chan luminita vese peter horvath – university of szeged...
TRANSCRIPT
![Page 1: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/1.jpg)
Active Contours without Edges
Tony ChanLuminita Vese
Peter Horvath – University of Szeged 29/09/2006
![Page 2: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/2.jpg)
Introduction
• Variational approach– The main problem is to minimise an integral
functional (e.g.):
– In the case f:, f’=0 gives the extremum(s)– In the case of functionals similary F’=0, where
F’=(F/u) is the first variation.– Most of the cases the solution is analyticly hard, in
these cases we use gradient descent to optimise.
VudxxuxuxfuF ,))(),(,()(inf
![Page 3: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/3.jpg)
Introduction
• Active Contour (Snake Model)– Kass, Witkin and Terzopoulos [Kas88]
- tension - rigidity– Eext – external energy– Problem is: infxE
+ Fast evaluation- But difficult to handle
topological changes
1
0
22))(()('')('
2
1dssxEsxsxE ext
![Page 4: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/4.jpg)
Introduction
• A typical external energy coming from the image:– Positive on homogeneous regions– Near zero on the sharp edges
p
0
0uG1
1ug
![Page 5: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/5.jpg)
Intoduction
• Level Set methods– S.Osher and J. Sethian [Set89]– Embed the contour into a higher dimensional space
+Automatically handles the topological changes
- Slower evaluation (., t) level set function• Implicit contour (=0)• The contour is evolved
implicitly by moving the surface
![Page 6: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/6.jpg)
Introduction
• The curve is moving with an F speed:
• The geometric active contour, based on a mean curvature (length) motion:
Ft
0ugt
![Page 7: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/7.jpg)
Chan and Vese model position
Chan and Vese model
Energy functionals for image segmentation
Representation/optimization
Contour basedgradient descent Level set based
gradient descent
Important to distinguish the model and the representation
•Model: describing problems from the real world with equations
•Representation: type of the description
•Optimization: solving the equations
![Page 8: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/8.jpg)
Chan and Vese model
• The model is based on trying to separate the image into regions based on intensities
• The minimization problem:
dxdyc)y,x(udxdyc)y,x(u
)C(inACLC,c,cF
)C(out
2
202
2
)C(in 101
21
C,c,cFinf 21C,c,c 21
![Page 9: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/9.jpg)
Chan and Vese model
• c1 and c2 are the average intensity levels inside and outside of the contour
• Experiments:
![Page 10: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/10.jpg)
Relation with the Mumford-Shah functional
• The Chan and Vese model is a special case of the Mumford Shah model (minimal partition problem) =0 and 1=2=
– u=average(u0 in/out)
– C is the CV active contour
• “Cartoon” model
C\
22
0MS duduu)C(L)C,u(F
![Page 11: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/11.jpg)
Level set formulation
• Considering the disadvantages of the active contour representation the model is solved using level set formulation
• level set form -> no explicit contour
0)y,x(:y,x)C(out
0)y,x(:y,x)C(in
0)y,x(:y,xC
![Page 12: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/12.jpg)
Replacing C with Φ
• Introducing the Heaviside (sign) and Dirac (PSF) functions
dxdyy,xH0A
dxdyy,xy,x0L
![Page 13: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/13.jpg)
Replacing C with Φ
• The intensity terms
dxdy))y,x((Hc)y,x(u
dxdyc)y,x(udxdyc)y,x(u
2
10
0
2
10
)C(in
2
10
dxdy)))y,x((H1(c)y,x(u
dxdyc)y,x(udxdyc)y,x(u
2
20
0
2
20
)C(out
2
20
![Page 14: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/14.jpg)
Average intensities
• We can calculate the average intensities using the step function
dxdy)))y,x((H1(
dxdy)))y,x((H1)(y,x(u
)(c
dxdy))y,x((H
dxdy))y,x((H)y,x(u
)(c
0
2
0
1
![Page 15: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/15.jpg)
Level set formulation of the model
2202
2101 )cu()cu()()(
t
Combining the above presented energy terms we can write the Chan and Vese functional as a function of Φ.
Minimization F wrt. Φ -> gradient descent
The corresponding Euler-Lagrange equation:
![Page 16: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/16.jpg)
Approximation of the Curvature
2/32y
2x
2xyyyxxy
2yxx
)(
2)(
s2
s2
m0p0y
0m0px
2
mmpmmpppxy
2
00m0p0yy
2
000m0pxx
s4
s
2s
2
![Page 17: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/17.jpg)
The algorithm
• Initialization n=0• repeat
– n++– Computing c1 and c2
– Evolving the level-set function
• until the solution is stationary, or n>nmax
![Page 18: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/18.jpg)
Initialization
• We set the values of the level set function– outside = -1– inside = 1
• Any shape can be the initialization shape
init() for all (x, y) in Phi if (x, y) is inside Phi(x, y)=1; else Phi(x, y)=-1; fi; end for
![Page 19: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/19.jpg)
Computing c1 and c2
• The mean intensity of the image pixels inside and outside
colors()
out = find(Phi < 0);
in = find(Phi > 0);
c1 = sum(Img(in)) / size(in);
c2 = sum(Img(out)) / size(out);
![Page 20: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/20.jpg)
Finite differences
for all (x, y)
fx(x, y) = (Phi(x+1, y)-Phi(x-1, y))/(2*delta_s);
fy(x, y) =…
fxx(x, y) =…
fyy(x, y) =…
fxy(x, y) =…
delta_s recommended between 0.1 and 1.0
![Page 21: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/21.jpg)
Curvature
grad = (fx.^2.+fy.^2);
curvature = (fx.^2.*fyy + fy.^2.*fxx - 2.*fx.*fy.*fxy) ./ (grad.^1.5);
Be careful! Grad can be 0!
![Page 22: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/22.jpg)
Force
gradient_m = (fx.^2.+fy.^2).^0.5; force = mu * curvature .* gradient_m - nu – lambda1 *
(image - c1).^2 + lambda2 * (image - c2).^2; We should normalize the force. abs(force) <= 1!
Main step:Phi=Phi+deltaT*force;
deltaT is recommended between 0.01 and 0.9. Be careful deltaT<1!
![Page 23: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/23.jpg)
Narrow band
It is useful to compute the level set function not on the whole image domain but in a narrow band near to the contour. Abs()<d
Decreasing the computational complexity.
![Page 24: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/24.jpg)
Narrow band
• Initialization n=0• repeat
– n++– Determination of the narrow band– Computing c1 and c2
– Evolving the level-set function on the narrow band
– Re-initialization• until the solution is stationary, or n>nmax
![Page 25: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/25.jpg)
Re-initialization
• Optional step
;G*)(sign*T
0)y,x(,1)d,cmax()b,amax(
0)y,x(,1)d,cmax()b,amax(G
);...0,amin(a);0,amax(a
;h
)y,x()1y,x(d;
h
)1y,x()y,x(c
;h
)y,x()y,1x(b;
h
)y,1x()y,x(a
2222
2222
H is a normalizing term recommended between 0.1 and 2.deltaT time step see above!
![Page 26: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/26.jpg)
Stop criteria
• Stop the iterations if:– The maximum iteration number were reached– Stationary solution:
• The energy is not changing• The contour is not moving• …
![Page 27: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/27.jpg)
Demonstration of the program
• Thanks for your attention
![Page 28: Active Contours without Edges Tony Chan Luminita Vese Peter Horvath – University of Szeged 29/09/2006](https://reader033.vdocuments.mx/reader033/viewer/2022051515/5516435b5503469d698b46c3/html5/thumbnails/28.jpg)
MATLAB tutorial
• Imread, imwrite
• .*, .^, ./
• Find
• Size, length, max, min, mod, sum, zeros, ones
• A(x:y, z:v)
• Visualization: figure, plot, surf, imagesc