Matting

来源:互联网 发布:软件架构怎么做 编辑:程序博客网 时间:2024/06/16 23:25

前景抠图:将图像的前景和背景分离
合成方程:

Ii=αiFi+(1αi)Bi

I 表示合成图像
F 表示前景图像
B 表示背景图像
α 表示alpha matte,每个素点的不透明度,或每个像素点的颜色值中含前景颜色的百分比。α=0表示背景,α=1表示前景,0<α<1表示未知

1.Sampling-based(基于采样的抠图算法)
Pick out the optimal foreground and background sample pairs from known regions for each unknown pixel, then figure out α value directly based on matting equation.
· 基本思想:假设任何未知像素的前、背景颜色值均可直接由用户提供的近邻像素来估计。(需要用户提供trimap图)
· 算法步骤:
1)对于未知区域中的每个像素点,在其附近选取已知的前景和背景的颜色样本
2)利用样本点计算出前景和背景颜色的统计信息
3)使用相应的计算公式计算未知像素点的前景和背景颜色以及α值

2.Propagation-based(基于传播的抠图算法)
Use the relativity of pixels in a certain distance to build an effective constraint, then obtain alpha matte by solving an optimization problem.
· closed form
核心思想:将图像看作一个场,每个点只与邻域的像素点有关。
·算法步骤:
1)利用一定范围之内像素间的相似性建立抠图拉普拉斯矩阵
2)利用已有的前景和背景信息构成约束条件来对α进行求解

J(α)=αTLα+λ(αβ)TD(αβ)

α 待求解的不透明度列向量
L 抠图拉普拉斯矩阵
λ 约束参数,一个较大值
β 已知的不透明度列向量,其中1为前景,0为背景
D 对角矩阵,对角线上的元素分别为0和1,1为已知点,0为未知点

3.machine learning-based(基于机器学习的抠图算法)
Put image matting into a supervised learning or semi-supervised learning framework, and establish an image matting model to calculate the alpha matte through a learning process.

原创粉丝点击