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...
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
And besides, if you want to add feature like "tolerance" in Photoshop, you should apply this method Connected-component_labeling when getting connected vertex on your graph while doing flood fill
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With