GIMP 使用什么前景选择算法?

What foreground selection algorithm does GIMP use?

标题说明了一切。

本来以为文档里会有算法的引用,结果好像没有。

我可能可以从源代码中找到,但是......这是一个 huuuuge 代码库:-(

均匀颜色聚类

代码库有多大并不重要。查找所有包含单词 foreground 和 select 的文件是几秒钟的事情。几分钟后你发现:

https://github.com/GNOME/gimp/blob/5d79fba8238a27b8691556489898d33b3fa0dda0/libgimp/gimpdrawable_pdb.c#L1065

 * Extract the foreground of a drawable using a given trimap.
 *
 * Image Segmentation by Uniform Color Clustering, see
 * https://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf

Abstract. The following article presents an approach for interactive foreground extraction in still images. The presented approach has been derived from color signatures, a technique originated from image retrieval. The article explains the algorithm and presents some benchmark results to show the improvements in speed and accuracy compared to state-ofthe-art solutions. The article also describes how the algorithm can easily be adapted for video segmentation.

https://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf