最近工作中在研究抠像(chroma key),使用幕布进行抠图,这个领域和学术界Matting类似,都是在像素级进行图像分割,但比Matting要简单一点,毕竟背景更固定。当然做好,也不是那么简单的......不然Adobe也不需要花大价钱买keylight了。
我的理解,chroma key在影视制作领域用的更多,场景可控,得到更好的效果。Matting则用在背景不限定的PS领域,需要由用户简单勾画出部分前景和背景像素,生成一幅三色图(trimap),算法进一步分离前景和背景。
当然很明显,玩得好的话,Matting算法可以改进chroma key抠像的结果,不说了防止泄密。。。
chroma key可以做到实时,效果也不错,可大部分好的Matting算法实时就比较困难了。
Matting的公开的benchmark dataset 在这里http://www.alphamatting.com/,不过样本数量不过,就二十几副图像。
在其结果排行榜上,CVPR2017新出的Information-flow matting效果惊人,github上有人重新实现了其算法,Matlab代码,跑了下,还不错,就是时间比较长,一副1080P图像需要三十几秒。
对Matting感兴趣的朋友,可以去把玩一下。
https://github.com/yaksoy/AffinityBasedMattingToolbox
This toolbox includes a collection of common affinity-based image matting algorithms as well as matte refinement algorithms used by sampling-based image matting methods. It features the only public (re-)implementation of information-flow matting [AAP17], a faster matting Laplacian [LLW08] computation and a faster trimap trimming [SRPC13]. The parameters for each algorithm are easily customizable.
The included matting algorithms are:
Information-flow matting [AAP17]
KNN matting [CLT13]
Closed-form matting [LLW08]
The included matte refinement algorithms are:
Information-flow matte refinement [AAP17]
Shared matting matte refinement [GO10]
The included trimap trimming methods are:
Patch-based trimming [AAP17]
Trimming from known-unknown edges [SRPC13]
The toolbox is designed to be ease of use for an extended set of applications. Sparse affinity matrices defined and used in [AAP17, CLT13, CZZT12, LLW08] can be obtained by calling the corresponding functions inside 'affinity' directory. The functions in this directory allow defining regions for neighborhood search.
An example image-trimap pair from the alpha matting benchmark [RRW09] is provided. Basic features are demonstrated in the demo file. Each function features an explanation and definitions of related parameters.
The information-flow matting function in this toolbox is not the original implementation used in the paper. These are reimplementations of the original methods and may not give the exact same results as reported in the corresponding papers.
References
[AAP17] Yagiz Aksoy, Tunc Ozan Aydin, Marc Pollefeys, "Designing Effective Inter-Pixel Information Flow for Natural Image Matting", CVPR, 2017.
[CLT13] Qifeng Chen, Dingzeyu Li, Chi-Keung Tang, "KNN Matting", IEEE TPAMI, 2013.
[CZZT12] Xiaowu Chen, Dongqing Zou, Qinping Zhao, Ping Tan, "Manifold preserving edit propagation", ACM TOG, 2012
[GO10] Eduardo S. L. Gastal, Manuel M. Oliveira, "Shared Sampling for Real-Time Alpha Matting", Computer Graphics Forum, 2010.
[LLW08] Anat Levin, Dani Lischinski, Yair Weiss, "A Closed Form Solution to Natural Image Matting", IEEE TPAMI, 2008.
[RRW09] Christoph Rhemann, Carsten Rother, Jue Wang, Margrit Gelautz, Pushmeet Kohli, Pamela Rott, "A Perceptually Motivated Online Benchmark for Image Matting", CVPR 2009.
[SRPC13] Ehsan Shahrian, Deepu Rajan, Brian Price, Scott Cohen, "Improving Image Matting using Comprehensive Sampling Sets", CVPR 2013