Архитектура Аудит Военная наука Иностранные языки Медицина Металлургия Метрология Образование Политология Производство Психология Стандартизация Технологии |
Error in magnitude and direction
The principal problem with all types of edge detectors is that on a dis- crete grid a derivative operator can only be approximated. In general, two types of errors result from this approximation (Fig. 12.2). First, edge detection will become anisotropic, i. e., the computation of the magni- tude of the gradient operator depends on the direction of the edge. Sec- ond, the direction of the edge deviates from the correct direction. For both types of errors it is useful to introduce error measures. All error measures are computed from the transfer functions of the gradient fi lter operator. 12.3 Gradient-Based Edge Detection† 321
Figure 12.2: Illustration of the magnitude and direction error of the gradient vector.
The magnitude of the gradient is then given by
, (12.16) ˆ . . where d ( k ) is the vectorial transfer function of the gradient operator. The anisotropy in the magnitude of the gradient can then be expressed by the deviation of the magnitude from the magnitude of the gradient in x direction, which is given by
In a similar way, the error in the direction of the gradient can be computed. From the components of the gradient, the computed angle φ ' of the 2-Dgradient vector is
dˆ x(k, φ ) The error in the angle is therefore given by
φ dˆ x(k, φ ) In higher dimensions, angle derivation can be in diff erent directions. Still we can fi nd a direction error by using the scalar product between a unit vector in the direction of the true gradient vector and the computed gradient vector d ˆ (k) (Fig. 12.2):
cos eϕ = k ¯ T d ˆ ( k ) d ˆ ( k )
with k ¯ =
k | k |
. (12.20)
322 12 Edges Figure 12.3: Application of the fi rst-order symmetric derivative fi lters Dx and Dy to the test image shown in Fig. 11.4.
In contrast to the angle error measure (Eq. (12.19)) for two dimensions, this error measure has only positive values. It is a scalar and thus cannot give the direction of the deviation. A wide variety of solutions for edge detectors exist. We will discuss some of them carefully in Sections 12.3.3–12.3.5.
12.3.3 First-Order Discrete Diff erences First-order discrete diff erences are the simplest of all approaches to com- pute a gradient vector. For the fi rst partial derivative in the x direction, one of the following approximations for ∂ g(x1, x2)/∂ x1 may be used: Backward diff erence g(x 1, x 2) − g(x 1 − ∆ x 1, x 2) ∆ x1 Forward diff erence g(x1 + ∆ x1, x2) − g(x1, x2) ∆ x1 Symmetric diff erence g(x1 + ∆ x1, x2) − g(x1 − ∆ x1, x2). 2∆ x1
(12.21) 12.3 Gradient-Based Edge Detection† 323
A b
C d
E f
These approximations correspond to the fi lter masks Backward − D x = [1• − 1] Forward + D x = [1 − 1•] Symmetric D 2x = 1/2 [10 − 1].
(12.22) 324 12 Edges
− dˆ x = exp(iπ k˜ x/2) Σ 1 − exp(− iπ k˜ x)Σ = 2i sin(π k˜ x/2), (12.23) where the fi rst term results from the shift by half a grid point. Using Eq. (12.10), the transfer function of the symmetric diff erence operator reduces to dˆ 2x = i sin(π k˜ x) = i sin(π k˜ cos φ ). (12.24) This operator can also be computed from D 2x = − D x 1 B x = [1• − 1] ∗ 1/2 [1 1•] = 1/2 [10 − 1]. The fi rst-order diff erence fi lters in other directions are given by sim- ilar equations. The transfer function of the symmetric diff erence fi lter in y direction is, e. g., given by dˆ 2y = i sin(π k˜ y ) = i sin(π k˜ sin φ ). (12.25)
Unfortunately, these simple diff erence fi lters are only poor approx- imations for an edge detector. From Eqs. (12.24) and (12.25), we infer that the magnitude and direction of the gradient are given by 1/2
and | d ˆ |=.sin2(π k˜ cos φ ) + sin2(π k˜ sin φ )Σ (12.26) sin2(π k˜ sin φ ) φ ' = arctan sin(π k˜ cos φ ) , (12.27)
em(k˜, φ ) ≈ (π k˜ )3 sin2 2φ 12 O(k˜ 5). (12.28) 12.3 Gradient-Based Edge Detection† 325 A b 10° 5° 0 -5° -10°
0.2
0.4
0.6
0.8 ~ k 1 0
0.5
1.5 q 1 Figure 12.5: a Anisotropy of the magnitude and b error in the direction of the T gradient based on the symmetrical gradient operator Σ D2x, D2yΣ . The para- meters are the magnitude of the wave number (0 to 1) and the angle to the x axis (0 to π /2).
eφ (k˜, φ ) ≈
(π k˜ )2 sin 4φ 24
As observed in Fig. 12.5b, the angle error is zero for φ = nπ /4 with n ∈ Z, i. e., for φ = 0°, 45° 90°, … 12.3.4 Spline-Based Edge Detection‡ The cubic B-spline transform discussed in Section 10.6.5 for interpolation yields a continuous representation of a discrete image that is also continuous in its fi rst and second derivative: g3(x) =.cnβ 3(x − n), (12.30) where β 3(x) is the cubic B-spline function defi ned in Eq. (10.60). From this continuous representation, it is easy to compute the spatial derivative of g3(x):
cn n ∂ β 3 (x − n). (12.31) ∂ x For a discrete derivative fi lter, we only need the derivatives at the grid points. From Fig. 10.20a it can be seen that the cubic B-spline function covers at most 5 grid points. The maximum of the spline function occurs at the central grid point. Therefore, the derivative at this point is zero. It is also zero at the two 326 12 Edges
A b 0.2 0.1 0 -0.1 -0.2
0.2
0.4
0.6
0.8 ~ k 1 0
0.5
1.5 q 1 1° 0.5° 0 -0.5° -1°
0.2
0.4
0.6
0.8 ~ k 1 0
0.5
1.5 q 1 Figure 12.6: a Anisotropy of the magnitude and b error in the direction of the gradient based on the cubic B-spline derivative operator according to Eq. (12.33). Parameters are the magnitude of the wave number (0 to 1) and the angle to the x axis (0 to π /2).
outer grid points. Thus, the derivative is only unequal to zero at the direct left and right neighbors of the central point. Therefore, the derivative at the grid point xm reduces to ∂ g3(x) . = (cm+1 − cm− 1)/2. (12.32) ∂ x.xm
D ˆ x = i sin(π k˜ x) ˜ = iπ k˜ x − i 5 ˜ 5 x + O(k˜ 7 ). (12.33) 2/3 + 1/3 cos(π kx) 180 x The errors in the magnitude and direction of a gradient vector based on the B-spline derivative fi lter are shown in Fig. 12.6. They are considerably less than for the simple diff erence fi lters (Fig. 12.5). This can be seen more quantitatively from Taylor expansions for the relative errors in the magnitude of the gradient
and the angle error
em(k˜, φ ) (π k˜ )5 2 ≈ − 240 sin 2φ + O(k˜ 7) (12.34) eφ (k˜, φ ) ≈ (π k˜ )4 sin 4φ 720 + O(k˜ 6). (12.35) The error terms are now contained only in terms with k˜ 4 (and higher powers of k˜ ). Compare also Eqs. (12.34) and (12.35) with Eqs. (12.28) and (12.29).
12.3.5 Least-Squares Optimized Gradient‡ In this section fi rst-order derivative fi lters are discussed that have been opti- mized using the least squares technique already used in Section 10.6.6 to op- timize interpolation fi lters. The basic idea is to use a one-dimensional 2R + 1 12.3 Gradient-Based Edge Detection† 327 A b 0.2 0.1 0 -0.1 -0.2
0.2
0.4
0.6
0.8 ~ k 1 0
0.5
1.5 q 1
1° 0.5° 0 -0.5° -1°
0.2
0.4
0.6
0.8 ~ k 1 0
0.5
1.5 q 1
rameters are the magnitude of the wave number (0 to 1) and the angle to the x axis (0 to π /2).
fi lter mask with odd symmetry in the corresponding direction w and to vary the coeffi cients so that the transfer function approximates the ideal transfer function of a derivative fi lter, iπ k˜ w , with a minimum deviation. Thus the target function is tˆ (k˜ w ) = iπ k˜ w (12.36)
Rdˆ (k˜ w ) = − i 2dv sin(vπ k˜ w ). (12.37) v=1 As for the interpolation fi lters in Section 10.6.6, the coeffi cients are determined in such a way that Rdˆ ( k ˜ ) shows a minimum deviation from tˆ ( k ˜ ) in the least- squares sense:
w(k˜ w 0 ). d(kw ) − tˆ (k˜ w
2
. (12.38)
and
R
v=2
d1 = 1 − vdv. (12.40) v=2 As a comparison of Figs. 12.6 and 12.7 shows, this fi lter exhibits a signifi cantly lower error than a fi lter designed with the cubic B-spline interpolation. 328 12 Edges
A b 0.2 0.1 0 -0.1 -0.2
0.2
0.4
0.6
0.8 ~ k 1 0
0.5
1.5 q 1 1° 0.5° 0 -0.5° -1°
0.2
0.4
0.6
0.8
~ k 1 0
0.5
1.5 q 1
rameters are the magnitude of the wave number (0 to 1) and the angle to the x axis (0 to π /2).
Derivative fi lters can be further improved by compensating the decrease in the transfer function by a forward and backward running recursive relaxation fi lter (Section 4.3.5, Fig. 4.4b). Then the resulting transfer function is
(R, β )dˆ =
R
v=2 1 + β − β cos(π k˜ w )
(12.41) with the additional parameter β. Figure 12.8 shows the errors in the magnitude and direction of the gradient for R = 2. A more detailed discussion on the design of optimal derivative fi lters including tables with fi lter coeffi cients can be found in Jä hne [81].
|
Последнее изменение этой страницы: 2019-05-04; Просмотров: 234; Нарушение авторского права страницы