Game Development Reference
InDepth Information
1.0
0.8
γ´(0)
f
(
a
)
0.6
1.0
0.5
0.0
0.5
2
0.4
γ´(0) =
a
0
0.2
γ
2
0
2
0.0
2
0.0
0.2
0.4
0.6
0.8
1.0
Figure 5.4.
Plots of the function
f
(
x
)=cos(
x
1
)cos(
x
2
). On the left, a 3D plot is shown.
The contour plot on the right shows various level sets and illustrates that, for regular
level sets, the gradient is orthogonal to the tangent of curves locally parameterizing the
level set.
A possible solution is to regularize the gradient computation by, for example,
smoothing the image prior to derivative computation or using Gaussian deriva
tives. However, since such approaches also remove highfrequency anisotropic
image structures, such as hair, they are generally not suitable for our purpose.
Instead, averaged gradient vectors in the leastsquares sense will be computed,
leading to the structure tensor [Brox et al. 06]—a wellknown tool in computer
vision.
5.2.1 Smoothed Structure Tensor
For each point
x
of a grayscale image, let
g
(
x
) be the gradient vector at
x
com
puted by convolving the image with a suitable derivative operator. As explained
earlier, for typical images, these gradients are not suciently smooth for our pur
poses. Simply smoothing the gradient vectors is not an option, since gradient
vectors have opposite signs in the neighborhood of extrema and would cancel
each other out (
Figure 5.5
)
. Hence, a more sophisticated approach is required.
For instance, one can seek a vector that approximates the gradient vectors in
a neighborhood. To measure how well a unit vector
v
approximates a gradient
vector
g
(
x
), the scalar product
may be used, which can be interpreted
as the length of the projection of
g
(
x
)on
v
. By squaring the scalar product, the
measure becomes independent of the sign of the gradient vectors. Moreover, mul
tiplying with a spatially varying weight gives less influence to gradients that are
farther away. Hence, the wanted unit vector is a vector whose sum of weighted
scalar products is maximal:
g
(
x
)
,v
1
2
.
v(
x
) = arg max
·
G
ρ
(
y
−
x
)
g
(
y
)
,v
(5.1)

G
ρ

v
=1
y
∈N
(
x
)
Search Nedrilad ::
Custom Search