Graphics Reference
In-Depth Information
in Figures
2.8
and
2.9
— the fitted Gaussians are generally long and skinny. Levin
et al. [
271
] exploited this observation in an elegant algorithm called
closed-form
matting
.
2.4.1
The Color Line Assumption
Let's assume that within a small window
w
j
around eachpixel
j
, the sets of foreground
and background intensities each lie on a straight line in RGB space. That is, for each
pixel
i
in
w
j
,
F
i
=
β
i
F
1
+
(
1
−
β
)
F
2
i
(2.19)
B
i
=
γ
i
B
1
+
(
1
−
γ
)
B
2
i
β
i
represents
the fraction of the way a given foreground color
F
i
is between these two points.
The same idea applies to the background colors. This idea, called the
color line
assumption
, is illustrated in Figure
2.12
.
Levin et al.'s first observationwas that under the color line assumption, the
Here,
F
1
and
F
2
are two points on the line of foreground colors, and
α
value
for every pixel in the window was simply related to the intensity by
a
I
i
+
α
i
=
b
(2.20)
where
a
isa3
1 vector,
b
is a scalar, and the same
a
and
b
apply to every pixel
in the window. That is, we can compute
×
for each pixel in the window as a linear
combination of the RGB values at that pixel, plus an offset. While this may not be
intuitive, let's show why Equation (
2.20
) is algebraically true.
First we plug Equation (
2.19
) into the matting equation (
2.2
) to obtain:
α
I
i
=
α
i
(β
i
F
1
+
(
1
−
β
i
)
F
2
)
+
(
1
−
α
i
)(γ
i
B
1
+
(
1
−
γ
i
)
B
2
)
(2.21)
If we rearrange the terms in this equation, we get a 3
×
3 systemof linear equations:
=
α
i
[
F
2
−
B
2
F
1
−
F
2
B
1
−
B
2
]
α
β
I
i
−
B
2
(2.22)
i
i
(
1
−
α
)γ
i
i
3 matrix on the left-hand side only depends on
F
1
,
F
2
,
B
1
, and
B
2
,
which we assumed were constant in the window. We multiply by the inverse of this
Note that the 3
×
blue
blue
B
1
F
2
B
i
F
i
F
1
β
i
γ
i
B
2
red
red
green
green
Figure 2.12.
The color line assumption says that each pixel
I
i
in a small window of the image
is a mix of a foreground color
F
i
and a background color
B
i
, where each of these colors lies on a
straight line in RGB space.