[Image-SIG] floodfill routine ?

Joe Reinhardt jmr at engineering.uiowa.edu
Sun Feb 1 13:52:12 EST 2004


"François Mourougaya" <francois.mourougaya at laposte.net> writes:

> does anybody have a floodfill routine in python (i.e. takes a binary array
> and throws an array with labeled regions), that would not be too slow ?
> Thanks.

I have C code that works with PIL to do this.  I originally wrote
these functions in python, but found them too slow and rewrote them in
C.

I added a new module with two functions:

ImageRegion.rgrow(seed, neighborhood) - seeded region growing
ImageRegion.cclabel(neighborhood)     - connected components labeling

Both of these functions run in less than one second when applied to
1000x1000 images.  They both work well with the ImageStat module that
is available in PIL, so you can use the region growing or cc labeling
to find regions, and then use ImageStat to measure them, or to mask
out grayscale regions to measure their statistics.

If you are able to compile your own Image module you are welcome to
try to use these functions.  Also, if you use i386 Debian, I can send
you the deb file for the modified Image module.


- JMR



More information about the Image-SIG mailing list