[Image-SIG] Floodfill

Karsten Hiddemann karsten.hiddemann at mathematik.uni-dortmund.de
Fri Feb 19 21:53:25 CET 2010


Johan Forsberg wrote:
> Hello,
> 
> I have been using PIL to write a simple drawing program and it's been 
> great fun. The only thing I've really been missing from the library is a 
> fast flood-fill routine. The included python based floodfill, while 
> functional, is very slow (in 1.1.7), I guess due to the per-pixel access 
> required. Since I want interactive speed, I decided to try and hack in a 
> floodfill function in C.

Just wanted to add that I remember that somebody else did that as well. 
This is a post from the list by Douglas Bagnall on 01.06.2009 02:23, 
original title "[Image-SIG] remove an image background using PIL"

> Peter Yen <colorpyen at gmail.com> wrote:
> 
>> Thanks for your quick response. The background is unknown at the time of
>> processing. Actually I don't need a very accurate methodology to remove all
>> background, removing partially is good enough.
> 
> I once wrote a (GPL'd) C module that fairly reliably extracts the
> background of a photograph of a drawing on paper.  It is essentially the
> same as PIL's floodfill but it follows shallow gradients.
> 
> The public git browser[1] seems to be broken right now, but if this
> sounds like what you need download a tarball[2], and look for the
> expand_region function in the img-c directory.
> 
> [1] https://savannah.nongnu.org/git/?group=tetuhi
> [2] http://sourceforge.net/project/showfiles.php?group_id=217385
> 
> 
> Douglas

Cheers,
Karsten


More information about the Image-SIG mailing list