views:

90

answers:

1

I have image with some object at not solid background. I want to extract this objects like in gimp using "fuzzy select". This can be an example:

http://img249.imageshack.us/gal.php?g=25750902.png

Question is what is the best way to do it using python/PIL...

+2  A: 

I suppose you would need some flood-fill algorithm (such as breadth-first-traversal) in which you stop exploring pixels with different color than black.

Wikipedia has an excellent explanation with animations and pseudo-code

http://en.wikipedia.org/wiki/Flood_fill

aioobe