Ii = αi*Fi + (1-αi)*Bi,
where Ii, αi, Fi, Bi, respectively represents to the the composite value, the matte value, the foreground value, the back ground value of pixel i.All variable on the right of the matting equation are unknown. Hence the problem is under-constrained. So a rough segmentation of foreground and background is required to extract a good matte. This segmentation can be in form of trimap or scribbles. The close form solution is a scribble based matting algorithm. It makes two assumptions:(1) F and B are locally smooth over a small window. (2) Each of F and B is a linear mixture of two colors in a small window.
By assumption(1), we could rewrite the matting equation as:αi = a*Ii + b ∀i∈w, where w is a small window a = 1/F-B b = -B/F-B
Our goal is to find a set of parameters (α, a, b) that minimizes the cost function
,where w is a small window.
A 3X3 window is adopted to enable propagation of the information between neighbouring pixels. The cost function is quadratic in α, a and b, with 3N unknowns for an image with N pixels. However, a and b may be eliminated , leaving us with a quadratic cost in only N unknown alpha values of the pixels:
J (α) = α’ L α, where a’ is the transpose of α
where L is an N × N matrix, whose (i, j)-th entry is:
For color images we replace the linear model with a 4D linear model assuming that for a small window each of F and B is a linear combination of two colors.
With 4D linear model the cost function is define as:
The equation for Matting Laplacian in color line model becomes:
The cost function can be optimized by solving a sparse linear system:
Second Result is a picture of a pineapple. Since it’s texture is similar to the back ground, we can find the scibbles in the first picture sets aren’t enough. The pixels in the upper left side cannot be distinguished properly. Then, we add some scibbles in the second picture sets to make the result better.
Third Result is a picture of a plant. The leaves of the plant have a lot of boundaries along with the background. Because that the color is so different between them, the result is still good.