Last post, we looked at the intuition and the formulation of Level Set Method. It’s useful to create a physical simulation like front propagation, e.g. wave simulation, wildfire simulation, or gas simulation. In this post, we are going to see into Level Set Method application in Computer Vision, to solve image segmentation problem.

## Image Segmentation with Level Set Method

Recall that the Level Set PDE that we have derived in the last post is as follows:

Here,

As we want to segment an image, then we need to derive

As

One way to do it is obviously derive our

So, we could implement it with the code below:

So that’s it, we have our

And here’s the segmentation result after several iteration:

This is the naive method for Level Set image segmentation. We could do better by using more complicated formulation for

## Geodesic Active Contour

In Geodesic Active Contour (GAC) formulation of Level Set Method, we define the force as:

The first term is the smoothing term, it moves the curve into the direction of its curvature. The second term is the balloon term, controlling the speed of the curve propagation with parameter

Finally, here’s the result of using GAC formulation of Level Set Method for segmenting the same image above:

Notice that qualitatively the segmentation result is better than before, i.e. smoother and better fit.

## Conclusion

In this post we looked into the application of Level Set Method on Computer Vision problem, that is image segmentation. We saw the intuition on applying it for image segmentation. We also saw the example of implementation of it. Finally we saw the more complicated formulation, i.e. GAC, for better segmentation.

## References

- Richard Szeliski. 2010. Computer Vision: Algorithms and Applications (1st ed.). Springer-Verlag New York, Inc., New York, NY, USA.