next_inactive up previous


Snakes: Deformable Contour Segmentaion

Wei Liu (u0614581)
weiliu@sci.utah.edu


introduction

Implenmented snakes deformable contour for segmentation following Trucco and Verry's method. Discussed the effect of each energy functional term on the contour movement. Test on synthetic shape (circle, squares) and real image with different energy setting ($ \alpha$ , $ \beta$ and $ \gamma$ ).

Method

The snakes algorithm tries to move the landmark points by minimizing a energy function (or functional because it is the function of a vector field). The objective function is given by the summation of three terms:

$\displaystyle \mathcal{E} = \int \left (\alpha E_{cont} + \beta E_{curv} + \gamma E_{image} \right) ds$    

The $ E_{cont}$ force landmark points to be continuous. It penalize movement far away from neighbor landmarks. The $ E_{curv}$ enforce smoothness. It penalize movement that towards big curvature. The $ E_{mage}$ enforce points to move towards image boundary. If choosing gradient magnitude as energy for image, the points would prefer movement to big gradient magnitude.

With the objective function defined, we use greedy algorithm to find the local minimum of the function. Each point looks for a new position that minimize the energy function, assuming other points fixed. We iterate over all points, and update them together. The procedure is given in algorithm 1.

Normalizing energy functional: To apply a single set of parameter to different images, the three energy terms need normalization. $ E_{cont}$ and $ E_{curv}$ is normalized by deviding by the maximal energy in the local neighborhood, $ E_{image}$ is normalized by $ (\mynorm{\nabla I }- m)/(M-m)$ , where $ M$ and $ m$ is the maximal and minimal gradient magnitude in the local neighborhood.

Bonus question: Coarse-to-fine contour: Similar to scale space, we can use a big Gaussian filter to get gradient magnitude map on a higher scale, and run snakes algorithm on this scale. After the snake converges, we use smaller Gaussian kernel to get a finer scale gradient magnitude map, and continue to run snakes, with the previous converged snakes as the initial location. The benefit if this strategy is, at large scale, the snakes easily capture the image gradient magnitude even far away from the shape. At finer scale, the snakes converge to the less smoothed target shape, with higher precision than at coarse scale. Hence this method is both robust to noise, and precise. The following experiments will by default use this strategy unless otherwise stated.

I also note the greedy algorithm's solution is not global optimum. So one need to choose initial landmark points carefully.
\begin{algorithm}
% latex2html id marker 45\caption{Snakes deformable contour...
... to the new positions.
\ENDWHILE
\par
\ENDFOR
\end{algorithmic}\end{algorithm}

Experiments

Initialize a Contour: Initialization of the contour is implemented by using a Matlab function ginput to get the points I clicked on the figure.

Verify the $ E_{cont}$ term: To ensure that I understand the behavior of each individual energy function, I first only use $ E_{cont}$ and set $ \alpha$ and $ \beta$ to zero. Theoretically, if I just use two points, it will not move by all means. If I use three points, it will ends up with a equilateral triangle, because this gives minimal energy. The experiments confirmed my expectation in figure 1. In this figure I use a circle shape and initialize three points randomly. I see only the $ E_{cont}$ term force the contour to a equilateral triangle.

Figure: Snakes on circle shape. Left is initial contour with three points. Right is the results only by minimizing $ E_{cont}$ . A gif image show the dynamic result can be found at www.sci.utah.edu/~weiliu/class/aip/p5/ani_1one.gif
Image init_1onecircle          Image final_1onecircle

Verify $ E_{image}$ : Figure 2 shows the results that only $ E_{image}$ are minimized, without considering the internal energy. We see althrough the lanmark points converged to the boundary, they are not evenly spaced. The threee points are all on one half of the contour. The can pose problem, as there may not enough points to represent contour on part of the shape.

Figure: Snakes on circle shape. Left is initial contour with three points. Right is the results only by minimizing $ E_{image}$ . A gif image show the dynamic result can be found at www.sci.utah.edu/~weiliu/class/aip/p5/ani_2one.gif
Image init_2onecircle          Image final_2onecircle

Use both $ E_{cont}$ and $ E_{image}$ : When using both energy terms, we see the points can evenly converge to the shape boundary, as in figure 3.

Figure: Use both $ E_{cont}$ and $ E_{image}$ . Left is initial contour with three points. Right is the final results. A gif image show the dynamic result can be found at www.sci.utah.edu/~weiliu/class/aip/p5/ani_3one.gif
Image init_3onecircle          Image final_3onecircle

Verify $ E_{curv}$ : To see how $ E_{curv}$ works I use a square shape, and run snake with $ E{curv}$ and without $ E_{curv}$ respectively. From figure 4 and 6 I can see without $ E_{curv}$ the landmark points are able to detect the corners, and with $ E_{curv}$ it can not detect it. To say it in another way, $ E_{curv}$ tries to enforce a small curvature contour. sometimes we would want it, because sharp corner sometimes is indicator of noise. but for this square shape we want the snake to find the corner.

Figure: Use $ E_{cont}$ and $ E_{image}$ . Left is initial contour with 200 points. Right is the final results. A gif image show the dynamic result can be found at www.sci.utah.edu/~weiliu/class/aip/p5/ani_1squ.gif
Image init_1square          Image final_1square

Figure: Use $ E_{cont}$ , $ E_{curv}$ and $ E_{image}$ . Left is initial contour with 200 points. Right is the final results. A gif image show the dynamic result can be found at www.sci.utah.edu/~weiliu/class/aip/p5/ani_2squ.gif
Image init_2square          Image final_2square

Test on Real data:

Figure: Top let: $ \alpha = 1, \beta = 1, \gamma = 1$ ; The $ E_{curv}$ is high, which prevent contour get closer to the target shape. Top right: $ \alpha = 1, \beta = 0.3, \gamma = 1$ . Small $ \beta$ allow the contour close to target shape. Bottom left: $ \alpha = 0.3, \beta = 0.3, \gamma = 1$ . Small $ \alpha$ make some points clustered at certain boundary, while other boundary part are not fully covered, resulting in bad segmentation. A gif image show the dynamic result can be found at www.sci.utah.edu/~weiliu/class/aip/p5/ani_2tem.gif
Image final_1temple2          Image final_2temple2
Image final_3temple2         

Turn parameters: I found even I normalized the energy term, different image still need manually ture parameters to get best results. This is probably greedy algorithm is not the best optimization method. Or, we can use other information from image besides the gradient magnitude?

Possible Improvements: Definitely more landmark points have better results. Sometimes adjacent points move to same location, and I wonder if these points can be merged to simplify the following iteration.

Conclusion

My results are far from satisfying, especially compared some results I find on Youtube. The concept is important. However, small difference in implementation sometimes make huge difference. Looks like the `energy' based method (internal property, smoothness, and external property, closeness to data) is a mainstream method in 80's and 90's. The concept is still applicable today.

No References!


next_inactive up previous
Wei Liu 2010-04-16