像gimp“模糊选择”之类的东西在python / PIL中 [英] something like gimp "fuzzy select" in python/PIL

查看:148
本文介绍了像gimp“模糊选择”之类的东西在python / PIL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图像中有一些物体不是固体背景。我想使用模糊选择在gimp中提取这些对象。这可以是一个例子:

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

问题是什么是最好的办法它使用python / PIL ...

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

这篇关于像gimp“模糊选择”之类的东西在python / PIL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆