The Grassfire Transform

The grassfire transform counts how far each pixel is from a region of interest. Although the algorithm requires two passes over the image, it can save computation by allowing a region to be grown or shrunk by any number of pixels in three passes. To grow a region by n pixels with other methods requires n passes. The grassfire transform is also useful because it identifies the borders of a region allowing one to "skeltonize" it.



The algorithm works as follows:

For professor Maxwell's explanation, go to http://www.palantir.swarthmore.edu/~maxwell/classes/e27/homework.htm. My code is in grassfire.c

The effect of the grassfire transform is illustrated on the following image. Unfortunately, some of the images may not show up well.



When the border is set to zero and the background is the region of interest, the grassfire transform becomes:



When the border is set to inf and the background is the region of interest, the grassfire transform becomes:



When the border is set to zero and the stopsign is the region of interest, the grassfire transform becomes:



When the border is set to inf and the stopsign is the region of interest, the grassfire transform becomes:



When the region is skeletonized, it becomes: