Keywords

1 Introduction

Edge detection is a fundamental process and remains widely used in image analysis and computer vision applications. Moreover, gradient and edge orientations are essential information for the interpretation and exploitation of digital images [19, 26]. Classical methods use first-order fixed operators [4, 5, 21, 24] or the structure tensor [11] to detect gradient and its orientation. Gradient-based edge and orientation estimators are frequently utilized. Among these operators, DoB (Difference of Boxes) filters [21] often remain implemented in many applications as in robotics. DoB simply computes the difference between two mean filters of same sizes on both sides of the considered pixel (usually represented by a list of 1 or \(-1\)). However, DoB filters are sensitive to noise and orientations not reliable. The robustness of the detection is generally improved by smoothing the image by a low pass filter followed by a gradient detection using vertical and horizontal masks of type [\(-1\) 0 1]. Edge detection methods differ in the types of smoothing filters that are applied [4,5,6, 24], as equations presented in Table 3. The computations of the gradient magnitude \(|\nabla I|\) and its orientation \(\eta \) are presented in Table 1(left). Among all the edge detectors, box [21] and exponential [4, 24] filters do not delocalize contour points [12], whereas they are sensitive to noise and blur while contours near a corner are rounded by Gaussian and Deriche filters (cf. Fig. 2(a)). In the orientation and edge detection domains, steerable feature detectors represent popular and efficient tools [8,9,10]. This concept provides valuable orientations and edges for many image processing applications, especially when the filter is elongated (cf. Fig. 2(b)). The concept was generalized in [20] by decomposing a given filter kernel optimally in a set of basic filters approximating an Anisotropic Gaussian Kernel (AGK). Mathematically, Table 1(middle column) presents the orientation and the gradient magnitude computation using this type of filter, corresponding to the maximum energy in the maximal response direction. The AGK possesses a common shortcoming, as a matter of fact, only one \(\pi \)-periodic orientation is extracted efficiently [20], so the impossibility of these filters to estimate in a relevant way several coexisting orientations at the same pixel, as illustrated in Fig. 1(d). Otherwise, multi steerable filters are designed and adjusted to a pattern of interest or a region to determine more precisely the directions of edges with \(2\pi \)-periodic templates [13, 18, 23]. On the other hand, the asymmetric filter developed in [16] estimates the homogeneity in multiple local directions. This filter consists in a network of several parallel lines in which a homogeneity is computed and enables an estimation of edge directions modulo 2\(\pi \). Lastly, wedge [18, 23] or asymmetric oriented filters [15, 16] sound better suited to multiple edge directions detection or modeling a template. The next section details the edge detection process using \(2\pi \)-periodic filters.

Fig. 1.
figure 1

Edge extraction around a blurred corner using different filters.

Table 1. Gradient magnitude and orientation computation for a scalar image I where \(I_\theta \) represents the image derivative at the \(\theta \) orientation (in radians).
Fig. 2.
figure 2

Representation of filter supports concerning edges and corners.

Fig. 3.
figure 3

Decomposition of half kernel (HK) in one dimension. Normalized signals in (e)–(g) represent the filter response (counter-clockwise rotation) of the centered pixel in (d), with D and S the derivative and smoothing parameters (cf. Tables 4 and 5).

2 Edge Detection Using Half Oriented Kernels

2.1 Advantages of Half Oriented Kernels

Edge detection techniques using elongated kernels are efficient to detect large linear structures correctly [9, 10, 20, 22]. The robustness against noise depends strongly on the smoothing parameters of the filter, i.e., the parameter of the filter elongation. If the filter length increases, the detection is less sensitive to noise, but small structures are considered as noise and their edges are not extracted. Consequently, the accuracy of the detected edge points decreases strongly at corner points and for non-straight object contour parts, as illustrated in Fig. 1(d). To bypass this undesirable effect, an anisotropic edge detection method is developed in [15, 17]. Indeed, the proposed technique is able to detect crossing edges and corners due to two elongated and oriented filters in two different directions. The simplest solution is to consider paths crossing each pixel in several directions. The idea proposed in [15, 17] is to “cut” the elongated kernel using a Heaviside function into two parts, i.e. two directions (see Fig. 2(c)). Then, the half kernel (HK) is rotated in several directions from 0 to \(2\pi \) (bilinear rotation) and computes a derivative information at each desired angle (illustrated in Fig. 3, for each \(\pi /36\) radian angle). Thus, in a contour direction, a half smoothing is performed, whereas in the perpendicular direction, a derivative information is computed, as illustrated in Fig. 3(a),(d)–(g). In order to better understand this technique to extract edge, the filter support of a HK on a straight contour is equivalent to 1/2 on both sides of the edge, as for elongated and circular or box filters, illustrated in Fig. 2. On the contrary, for a corner point with a \(\pi /2\) radian angle, the support of the half filter remains 1/2 on both sides of the edge, whereas it is around 1/4 and 3/4 concerning other filter supports. Such a manner to extract edges enables to compute a gradient of blurred contours, even corners as illustrated in Fig. 1(e), contrary to other filtering methods. Eventually, as detailed in Table 1(right), the gradient corresponds to the maximum value minus the minimum value of the convolution of the oriented half filter with the image. These two directions represent to the two main orientations of a contour and the gradient direction \(\eta \) corresponds to the bisector between these two directions (cf. Fig. 2(c)). These orientations are useful and efficient for image restoration via PDE [14], corner detection [3] or image descriptor [25].

Table 2. Different derivative filters. Parameters are available in Table 3.

2.2 Types of Implemented Filters

Edge detection using oriented half kernels is reliable, robust against noise, and, outperforms classical edge detectors [14, 15]. As pointed in [17] and illustrated in Figs. 5(l)–(q), the HK can be implemented using different equations:

  • a derivative part of the filter, represented by an equation in Table 2,

  • a half smoothing part, which corresponds to an equation in Table 3.

In order to create an elongated filter, the support of the half smoothing part must be higher than the derivative support. The parameters of the different filter equations can be chosen in Table 5 for the half smoothing part, where S represents the length of the support where 98% of the filtered information is computed, i.e., the width of the HK (cf. Fig. 3(c)). As for the derivative part, the parameters are available in Table 4, where D represents the length of the support where 98% of the filtered information is computed (i.e., width of the HK, cf. Fig. 3(b)). As an example, a half filter using Bourennane equation, of length \(S = 46\) pixels and \(D = 11\) pixels, the parameter corresponds to \(s = 3.22\) for the smoothing part and \(s = 0.33\) for the derivative part. The half filter can be generated using a half DoB, see first rows in Tables 2 and 3. Thus, S and D numbers, indicate directly the size of the half DoB, which is rotated from 0 to \(2\pi \). It is important to note that the parameters of the half smoothing parts in Table 5 correspond to parameters representing a pass bass filter centered at 0, and only the causal part is preserved here, so S corresponds to a smoothing support size of a half filter. As a result, the derivative part computes the oriented gradient information, whereas the half smoothing part enables a smooth along edges, preserving them and their directions. Finally, on the one hand, the length of the HK must be sufficiently large to be robust against noise. On the other hand, the width of the HK must be thin to ensure precise edge detection and orientations. As an example in Fig. 3(left), when S and D are small, all the signals are noisy, whereas when S increases, the edge directions highlight incrementally, even though Shen and Bourennane HK remain always sensitive to noise.

Table 3. Different low pass filters compared in this study.

The Matlab code is available on the MathWorks website: https://fr.mathworks.com/matlabcentral/fileexchange/66853-edge-detection-methods-based-on-oriented-half-kernels?s_tid=srchtitle.

3 Evaluation and Results

The aim of the experiments is to obtain the best edge map in a supervised way. In the experiments, 7 edge detection methods based on filtering gradient computation are compared: isotropic Gaussian filter [5], AGK [9] and HK formed by the DoB, Shen [24], Bourennane [4], Deriche [6], and Gaussian filters [15, 17]. These HK possess the same spatial support (AGK has two times the spacial support, Fig. 5(m)). Filters must be thin and elongated in order to compute accurate contours and associated directions (cf. Fig. 3(d)–(g)). Thus, the derivative parameter concerning isotropic Gaussian filter [5] remains the same than others (\(D=7\)), see Fig. 5(l)–(q). HK and AGK are rotated each \(\pi \)/72 radian angles. Finally, after a non-maximum suppression [26], an objective assessment is performed by varying hysteresis thresholds on normalized thin edges until the Relative Distance Error (RDE, inspired by [7]) evaluation obtains the minimum score [2]:

Table 4. Parameters of the filters in function of their support size, i.e., the number of pixels under the range of the filter. These parameters correspond to the derivative part. The first row is tied to the range of the derivative of the DoB filter.
Table 5. Parameters of the half filters in function of their support size. These parameters are used for the length of the 2D filters, i.e., smoothing part. The first row is tied to the range of the mean filter used in the DoB filter, i.e., number of pixels S.
$${\text{ RDE }} \left( G_t,D_{c} \right) = \sqrt{ \dfrac{1}{\left| D_{c}\right| } \cdot \sum \limits _{p \in D_{c}}d^2_{G_t}\left( p \right) } + \sqrt{ \dfrac{1}{\left| G_t\right| } \cdot \sum \limits _{p \in G_t}d^2_{D_c}\left( p \right) },$$

where \(D_c\) represents the desired contour map, \(G_t\) the ground truth edge image (Fig. 5(b)), \(|\cdot |\) the number of contour points of a set, and, \(d_{A} ( p)\) is the minimal Euclidian distance between a pixel p and a set A [1, 7]. These scores are recorded and plotted as a function of the noise level in the original image, as presented in Fig. 5(j). Hence, a plotted curve increases monotonously with the noise level (Gaussian noise). The second evaluation measure concerns the gradient angle, \(\eta \) (cf. Table 1). Once \(D_c\) is created, considering \(\mathcal{C}_{D_c}\) the set of contour chains in \(D_c\) (i.e., at least 2 pixels per chain), the gradient evaluation as follows:

$$ E(\mathcal{C}_{D_c}, \eta ) = \displaystyle { \frac{1}{|\mathcal{C}_{D_c}|} \cdot {\sum \limits _{p\in \mathcal{C}_{D_c} } {\sum \limits _{d_k\in W }} \left[ 1 - \frac{abs(\pi / 2 - abs(\overrightarrow{\eta _{p}} - \overrightarrow{\eta _{d_k}}))}{\pi /2} \right] /c_k}}, $$

where \(d_k\) represents a contour pixel belonging to W, a \(3\times 3\) window centered on p, \(\overrightarrow{\eta _{d_k}}\) the gradient orientation of \(d_k\) and \(c_k\) the number of contour pixels in W, minus the central pixel. This evaluation linearly ranges from 0 for identical angles of \(\overrightarrow{\eta _{p}}\) and \(\overrightarrow{\eta _{d_k}}\) to 1 for angles that differs (Fig. 4). Note that angles of \(\overrightarrow{\eta _{d_k}}\) and \(\overrightarrow{\eta _{p}}\) belong to \([0; \, \pi [\) and when one direction approximates 0 and the other direction \(\pi \), the evaluation of these two directions remains close to 0 (see Fig. 4(c)).

Fig. 4.
figure 4

Illustration of \({\eta _{p}}\) and \({\eta _{d_k}}\) directions, in a \(3\times 3\) window, where each white square represents a contour pixel of \(D_c\), whereas gray squares correspond to non-edge pixels. Example of angular single error computation \( e = 1 - {abs(\pi / 2 - abs( {\eta _{p}} - {\eta _{d_k}}))}/{\pi /2}\).

The presented segmentations in Fig. 5 correspond to the original image for a PSNR = 14 dB. Clearly, all the HK obtains better segmentations than the isotropic Gaussian. The HK using Gaussian outperforms six other compared filters, in terms of both RDE evaluation and visualization. AGK obtains good scores, but the contour image presents undesirable straight contours disturbing its interpretation. HK using DoB produces many false positive points, especially close to the true edges; it performs in presence of salt&pepper noise, but not concerning white Gaussian noise. Otherwise, HK using Shen and Bourennane filters obtain close the same results, however, they remain too sensitive to noise, and, especially, many edges are missing. HK with Deriche filter is more robust to noise but edges are still missing. Concerning \(\eta \) evaluation, \(E(\mathcal{C}_{D_c}, \!\eta )\) indicates that HK using Gaussian remains more reliable than other HK. This information means that HK using Gaussian is less disturbed by noise than other kernels. The gradient evaluation of AGK is close to 0 because almost all the edges obtained are straight; consequently, the gradient angle remains close the same for all the contour chain.

4 Conclusion

Oriented half kernels (HK) represent thin filters enable to describe the image information all around a considered pixel. As they are robust against noise and their edge directions are accurate, HK are utilized in the context of many image processing problems [3, 14, 25]. This study presents different manners to build HK devoted to edge detection in digital images. Five HK have been objectively compared and HK using Gaussian remains the most reliable. Especifically, this HK and the anisotropic Gaussian kernel obtain similar evaluation results kernel but the obtained edges are more usable with HK. For this purpose, we plan in a future study to implement multiscale and subpixel half Gaussian kernels.

Fig. 5.
figure 5

Edge detection corresponding of the minimum score of the RDE measure.