Game Development Reference
In-Depth Information
with standard deviation σ s , is chosen. Since the stream lines become less accu-
rate the longer they are, a comparatively short cutoff for the Gaussian function
is used. The stream lines are truncated after two times the standard deviation
rounded down to the next integer, L =
, corresponding to approximately
95% of the weights. The integral is approximated by a sum of rectangle functions
using the midpoint rule. Sampling of the image is thereby performed using bilin-
ear filtering. Thus, if x L , ...,x 0 , ...,x L denote the stream line points obtained
with step size h , as described in the previous section, then the result of the line
integral convolution at x 0
2 σ s
is given by
G σ s ( kh ) f ( x k ) ,
L
L
1
G σ s ( kh ) f ( x k )+ G σ s (0) f ( x 0 )+
|
G σ s |
k =1
k =1
where
L
L
|
G σ s |
=
G σ s ( kh )+ G σ s (0) +
G σ s ( kh )
k =1
k =1
denotes the corresponding normalization term. The implementation is shown in
Listing 5.5 .
5.3.3 Adaptive Smoothing
In the previous section, the length of the stream lines used for smoothing was
globally defined and proportional to the standard deviation of the Gaussian filter
kernel. This may lead to issues in high-curvature regions, as illustrated in Fig-
ure 5.9(c). If the stream lines are too long, they may wrap around, resulting in
some pixels being sampled more often than others. Moreover, due to rounding er-
rors and inaccuracies in the stream line computation, adjacent isophotes may be
sampled, which introduces additional blurring. To avoid these issues, the length
of the stream lines and, correspondingly, the size of the Gaussian filter kernel
must be controlled adaptively on a per-pixel basis. To this end, in [Kyprianidis
and Kang 11] the standard deviation of the filter kernel was adjusted in relation
to an anisotropy measure derived from the smoothed structure tensor. While this
approach works reasonably well in practice, it is purely heuristic and its exact
behavior is dicult to analyze.
An alternative and more intuitive approach is
therefore presented here.
Instead of adjusting the length of the stream lines in advance, their parame-
terization is adjusted by slowing down the parameter's velocity if necessary. To
this end, the angle between the previous and the current steps' minor eigenvectors
is computed:
θ k = arccos t k 1 ( x k 1 ) ,t k ( x k ) .
Taking the sum Θ = i =1 θ i of the angles measures the cumulated angular
change of the stream line. If Θ
π , the stream line is likely to wrap around or is
 
Search Nedrilad ::




Custom Search