Active contours are a method of image segmentation. They are well-loved for their accuracy, ease of implementation, and nice mathematical underpinnings. However, a full level-set implementation can be quite slow, especially when dealing with large data! Here are some tips to speed things up. By combining these ideas and solid programming techniques I’ve been able to get active contour trackers running at hundreds of frames per second!
- Use Fast Level-Sets
Start by using a fast level-sets implementation that minimizes the number of required computations [code]. This will already save a huge number of computations per iteration and speed things up quite a bit!
- Create better initializations.
The farther the initial contour is from its final position, the more computations must be done for the contour to converge. Hence, if you can start the contour in almost the right place, you’ll drastically reduce the time needed for segmentation. You can use prior knowledge, user input, or other segmentation techniques to create a rough guess that is close to the right answer. Another initialization that can leads to quick initialization is ‘bubbles’ on an evenly-spaced grid.
- Use a multi-scale approach.
This is a way to quickly get good initializations using active contours. Say your data is MxN. Instead of segmenting the full data set, downsample the data so that you are dealing with an (M/8)x(N/8) volume. The segmentation should run much quicker on the smaller volume. Next, upsample the result back to MxN and use this as an initialization for the full data. The idea is that the time saved on the full segmentation by having a good estimate based on downsampled data will make up for the time needed to downsample, segment on the small data, and upsample.
- Use approximate active contours.
Using an approximate solution for all or part of your segmentation can be helpful. As in 2 and 3, you can use an approximate active contour technique to quickly get close to the right answer. Then you can use an accurate level sets implementation to get the right answer quickly. Alternatively, the discrete methods can work quite well alone! James Malcolm proposed a nice method in “Fast Approximate Surface Evolution in Arbitrary Dimension” [code].
- Use another technique entirely.
Active contours are “variational,” so they give nice, principled solutions with analytic geometry, etc. However, if you just want fast segmentations, other techniques such as thresholding/morphology, graph cuts, region growing, etc. can all be viable solutions.
Any other tips or links to good implementations? Leave them in the comments.