    An automated threshold Edge Drawing algorithm

Parameter choosing in classical edge detection algorithms can be a costly and complex task. Choosing the correct parameters can improve considerably the resulting edge-map. In this paper we present a version of Edge Drawing algorithm in which we include an automated threshold choosing step. To better highlight the effect of this additional step we use different first order operators in the algorithm. Visual and statistical results are presented to sustain the benefits of the proposed automated threshold scheme.

Authors

09/16/2019

Extending simple drawings with one edge is hard

A simple drawing D(G) of a graph G = (V,E) is a drawing in which two edg...
06/10/2020

A different approach for choosing a threshold in peaks over threshold

Abstract In Extreme Value methodology the choice of threshold plays an i...
09/27/2018

Plane and Planarity Thresholds for Random Geometric Graphs

A random geometric graph, G(n,r), is formed by choosing n points indepen...
07/24/2018

Graph Compact Orthogonal Layout Algorithm

There exist many orthogonal graph drawing algorithms that minimize edge ...
10/27/2020

Contour Integration using Graph-Cut and Non-Classical Receptive Field

Many edge and contour detection algorithms give a soft-value as an outpu...
08/17/2015

Knuthian Drawings of Series-Parallel Flowcharts

Inspired by a classic paper by Knuth, we revisit the problem of drawing ...
06/25/2021

Objective: To investigate whether performance (number of correct decisio...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Extracting edge features from images is a problem that was tackled in many ways by researchers. The proposed solutions vary from classical Sobel  or Prewitt  to more complex algorithms like Canny  or Edge Drawing 

. Edges remain a basic yet important feature in the Computer Vision domain.

Edge Drawing -ED- proposes an edge segment detection algorithm that applies the high-level cognitive reasoning employed in dot-to-dot boundary completion puzzles to edge segment detection. First, we analyze the effect on the original ED algorithm when we use other first order derivative operators. Afterwards, we propose a scheme for selecting the threshold parameters that is dependent on the image.

For an algorithm such as ED algorithm, in which we can configure parameters (gradient threshold, anchor threshold, scan interval and Gaussian kernel size), we can easily reach over variants to fine tune it on a dataset. The fine-tuning phase is dependent on the image set and use case. From experience, the setting of parameters can become a lot more facile but it still remains a costly process.

Extensions of the ED algorithm exist in literature where additional steps are included, such as: edge segments are validated by an "a contrario" step due to the Helmholtz principle  or edge segments are linked based on the predictions generated from past movements . But for this research we attempt to maintain the real-time benefit of the original algorithm and adopt a less costly additional step. In this direction, we propose a scheme of choosing the ED threshold that is not user dependent but contextual of the image. The Otsu threshold in our opinion is a good starting point to adapt the necessary thresholds of the algorithm. Automated threshold selection phases were added to other edge detection algorithm as we can see in [7, 8, 9].

We consider that an automated threshold choosing algorithm is a important improvement considering the dependencies between the data we process and the gradients obtained in the processing phase.

The paper is organized as follows: in Section 2, we present the concepts needed as background for our modifications and simulation flow; in Section 3, the original and proposed ED algorithms are described; in Section 4, the results of our simulations are analyzed.

2 Research background

2.1 First Order derivative Operators

For our experiments, we use the following discrete differentiation operators: the Sobel Operator , the Prewitt Operator , the Kirsch operator  , the Kitchen Operator, the Kayalli Operator , the Scharr Operator , the Kroon Operator , and the Orhei Operator . All the used kernels are presented in Figure 1.

The gradient is a measure of change in a function, and an image can be considered to be an array of samples of some continuous function of image intensity, typically two-dimensional equivalent of first derivative. Gradient magnitude is calculated using Formula 1, where is the image and , are the components on and axis .

 G[f(x,y)]=√G2x+G2y≈|Gx|+|Gy| (1)

2.2 Otsu thresholding

Otsu’s thresholding method corresponds to the linear discriminant criteria, which assumes that the image consists of only two objects: foreground and background 

. Otsu’s method determines the threshold value based on the statistical information of the image where the variance of clusters

and can be computed. Otsu’s algorithm tries to find a threshold value (t) which minimizes the weighted within-class variance given by the relation observed in Equations 2.

 σ2σ(t)=ω0(t)∗σ20(t)+ω1(t)∗σ21(t) (2) =ω0(t)∗ω1(t)[μ0(t)−μ1(t)]2 (3)

Weights and

are the probabilities of the two classes separated by a threshold

and and are variances of these two classes. The class probability is computed from the bins of the histogram.

For two classes, minimizing the intra-class variance is equivalent to maximizing inter-class variance as we can see in Equation 2, which is expressed in terms of class probabilities and class means , where the class means , and are presented in Equation 4 - 6.

 μ0(t)=∑t−1i=0i∗p(i)ω0(t) (4)
 μ1(t)=∑L−1i=ti∗p(i)ω1(t) (5)
 μT(t)=L−1∑i=0i∗p(i) (6)

2.3 Benchmarking the edge operators

For highlighting the results obtained, we use BSDS500  which contains a dataset of natural images that have been manually segmented. The human annotations serve as ground truth for the benchmark for comparing different segmentation and boundary detection algorithms. For evaluating the images generated from algorithms to the ground truth images, the Corresponding Pixel Metric (CPM) algorithm  is used.

For each image, two quantities Precision () and Recall () will be computed, as were defined in . Precision, with Formula 7, represents the probability that a resulting edge/boundary pixel is a true edge/boundary pixel. Recall, with Formula 8, represents the probability that a true edge/boundary pixel is detected. In these formulas, (True Positive) represents the number of matched edge pixel, (False Positive) the number of edge pixels which are incorrectly highlighted and (False Negative) the number of pixel that have not been detected. Those two quantities are used to compute F-measure (F1-score) by applying the Formula 9.

 P=TPTP+FP. (7)
 R=TPTP+FN. (8)
 F−measure=2∗TP2∗TP+FP+FN. (9)

3 Proposed Edge Drawing algorithm

The ED edge detection algorithm presented good results for a traditional edge detection concept. But we are concerned with the amount of variants we need to test for fine tuning the parameters for a given dataset or scenario.

ED proposes an edge segment detection algorithm that applies the high-level cognitive reasoning employed in dot-to-dot boundary completion puzzles to edge segment detection .

The original ED algorithm consists of the following steps: first the image is smoothed using a Gaussian filter ; afterwards the horizontal and vertical gradients are calculated using Formula 1; the edge direction map is calculated by using the idea that ; suppression of the so called "weak" pixels is done and anchor points are extracted .

Anchors would be located at the peaks of the gradient map. To connect consecutive anchors, we simply go from one anchor to the next by proceeding over the cordillera peak of the gradient map mountain. This process is guided by the gradient magnitude and edge direction maps computed .

Otsu is an approach that separates the image into background and foreground, which makes a perfect candidate to take in consideration for choosing our thresholds. In this scenario, we propose that for an image we find the Otsu threshold and afterwards we choose the gradient threshold and anchor threshold accordingly to Equation 10 and Equation 11.

 Tanc=0.067∗Totsu (11)

We consider that the gradient pixels values of the background, which are divided by the Otsu method, vary in a normal curve probability distribution

 form. So we can choose the mean value of the distribution as our gradient threshold. It seems appropriate to choose this value as gradient threshold because it will eliminate noise caused by small background changes, or small features in the image. We consider that anchors should be at the margins of the distribution, as peaks of the gradient map mountains, so we choose the anchor threshold as percent of Otsu threshold.

Another modification we proposed, that resulted from experiments, is to set the value of to the scan interval. From our observation, varying this parameter does not bring actual benefits in this new concept.

In Algorithm 1, the proposed version of ED algorithm is described. If we look at the necessary input parameters, we can see that if we use this version we just have to set the smoothing kernel size.

We have chosen the weights for gradient and anchor thresholds from Otsu value using the assumption detailed in this section but other values can be experimented. With our proposed modification to the ED algorithm, we consider that the tuning phase of the algorithm is significantly reduced.

4 ED simulation results

All the simulation are done using EECVF - End-to-End Computer Vision Framework- [23, 24]

, an open-source solution based on Python programming language, by running the module

.

To find the optimal parameters for the best results, we vary the parameters as following: the Gaussian kernel size -- in the range of using a step of , the gradient threshold -- in range of with a step of , the anchor threshold -- in the following range with a step of and the scan interval -- in the range .

We observe, in Figure 4, that we obtain the best results using the following parameters: gradient threshold value of , anchor threshold value of , Gaussian kernel size of and scan interval of . As stated in the introduction, to be able to find this set of parameters we had to run variants.

Using the found parameters, we changed the operator used in ED algorithm to observe the difference that we obtain, as we can see in Figure 4. ED algorithm using operators like Sobel, Prewitt, Kroon , Orhei  have similar results. At the other end we can clearly see that using Kayyali , Kirsch  or Kitchen produces worse results. We have chosen to vary the parameters with value of so we can obtain more accurate results.

The changing of the operator can have an important contribution to the resulted edge-map but they cannot overcome the wrong selection of parameters. If we look in Figure 4, when changing the operator, we do not see usually a big change, but if we look in Figure 4, every change we did in one of the parameters produced a relevant change in metrics.

In Figure 4 we present the statistical result and in Figure 5 the visual results of the proposed ED algorithm. We can see that we obtain a slight decrease in the metrics, but we think it is an acceptable trade-off considering the amount of calculation we save by eliminating the fine-tuning phase. Figure 5: Proposed ED algorithm visual results; Columns: original image, Sobel, Prewitt, Kirsch, Kitchen, Kayyali, Scharr, Kroon, Orhei;

Actually, for some cases we see a decrease in appeared artifacts (see Figure 5). To some extent, this is an expected outcome when switching from a threshold chosen by a global analysis of the image set to one that is image dependent.

We presented a comparison of the ED results, original versus proposed, for each operator, in Table 1. The table reveals another important aspect: the proposed threshold finding method does not produce random results. Even if the results are lower, around 0.02 differences in score, the order of the operators remain the same.

5 Conclusion

In this paper we proposed a new Edge Drawing variant of the algorithm by adding an automated threshold choosing schema. This is an important aspect because it will reduce significantly the amount of preparation needed to use the algorithm. The proposed version can be used in different datasets or scenarios without the need of fine tuning first.

The results we obtain with the proposed variant of ED are lower than the best variant found in our experiments. But to obtain the best variant result for one operator we needed more than a thousand tries, so in retrospect we can consider it an acceptable loss in metrics.

As future work, we consider using a more fine segmentation of the image to determine the thresholds by using Multi-Otsu thresholding . Another aspect we wish to explore is the effect of dilated filters upon our proposed variant [26, 27].

References

•  I. Sobel and G. Feldman, “A 3×3 isotropic gradient operator for image processing,” Pattern Classification and Scene Analysis, pp. 271–272, 01 1973.
•  J. M. Prewitt, “Object enhancement and extraction,” Picture processing and Psychopictorics, vol. 10, no. 1, pp. 15–19, 1970.
•  J. Canny, “A computational approach to edge detection,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. PAMI-8, pp. 679–698, Nov 1986.
•  C. Topal and C. Akinlar, “Edge drawing: a combined real-time edge and segment detector,” Journal of Visual Communication and Image Representation, vol. 23, no. 6, pp. 862–872, 2012.
•  C. Akinlar and C. Topal, “Edpf: a real-time parameter-free edge segment detector with a false detection control,”

International Journal of Pattern Recognition and Artificial Intelligence

, vol. 26, no. 01, p. 1255002, 2012.
•  C. Akinlar and E. Chome, “Pel: a predictive edge linking algorithm,” Journal of Visual Communication and Image Representation, vol. 36, pp. 159–171, 2016.
•  Y.-K. Huo, G. Wei, Y.-D. Zhang, and L.-N. Wu, “An adaptive threshold for the canny operator of edge detection,” in 2010 International Conference on Image Analysis and Signal Processing, pp. 371–374, IEEE, 2010.
•  A. Azeroual and K. Afdel, “Fast image edge detection based on faber schauder wavelet and otsu threshold,” Heliyon, vol. 3, no. 12, p. e00485, 2017.
•  J. Cao, L. Chen, M. Wang, and Y. Tian, “Implementing a parallel image edge detection algorithm based on the otsu-canny operator on the hadoop platform,” Computational intelligence and neuroscience, vol. 2018, 2018.
•  J. M. Prewitt, “Object enhancement and extraction,” Picture processing and Psychopictorics, vol. 10, no. 1, pp. 15–19, 1970.
•  R. A. Kirsch, “Computer determination of the constituent structure of biological images,” Computers and biomedical research, vol. 4, no. 3, pp. 315–328, 1971.
•  L. Kitchen and J. Malin, “The effect of spatial discretization on the magnitude and direction response of simple differential edge operators on a step edge,” Computer vision, graphics, and image processing, vol. 47, no. 2, pp. 243–258, 1989.
•  E. Kawalec-Latała, “Edge detection on images of pseudoimpedance section supported by context and adaptive transformation model images,” Studia Geotechnica et Mechanica, vol. 36, no. 1, pp. 29–36, 2014.
•  H. Scharr, Optimal operators in digital image processing. PhD thesis, 2000.
•  D. Kroon, “Numerical optimization of kernel based image derivatives,” Short Paper University Twente, 2009.
•  C. Orhei, S. Vert, and R. Vasiu, “A novel edge detection operator for identifying buildings in augmented reality applications,” in International Conference on Information and Software Technologies, pp. 208–219, Springer, 2020.
•  R. M. Haralick and L. G. Shapiro, Computer and robot vision, vol. 1. Addison-wesley Reading, 1992.
•  N. Otsu, “A threshold selection method from gray-level histograms,” IEEE transactions on systems, man, and cybernetics, vol. 9, no. 1, pp. 62–66, 1979.
•  P. Arbelaez, M. Maire, C. Fowlkes, and J. Malik, “Contour detection and hierarchical image segmentation,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 33, pp. 898–916, May 2011.
•  M. Prieto and A. Allen, “A similarity metric for edge images,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 25, pp. 1265– 1273, 11 2003.
•  Y. Sasaki, “The truth of the f-measure.,” tech. rep., School of Computer Science, University of Manchester, 2007.
•  J. K. Patel and C. B. Read,

Handbook of the normal distribution

, vol. 150.
CRC Press, 1996.
•  C. Orhei, M. Mocofan, S. Vert, and R. Vasiu, “End-to-end computer vision framework,” in 2020 International Symposium on Electronics and Telecommunications (ISETC), pp. 1–4, IEEE, 2020.
•  C. Orhei, S. Vert, M. Mocofan, and R. Vasiu, “End-to-end computer vision framework: An open-source platform for research and education,” Sensors, vol. 21, no. 11, p. 3691, 2021.
•  P.-S. Liao, T.-S. Chen, P.-C. Chung, et al., “A fast algorithm for multilevel thresholding,” J. Inf. Sci. Eng., vol. 17, no. 5, pp. 713–727, 2001.
•  V. Bogdan, C. Bonchis, and C. Orhei, “Custom dilated edge detection filters,” in International Conference in Central Europe on Computer Graphics, Visualization and Computer Vision, WSCG, Václav Skala - UNION Agency, May 2020.
•  C. Orhei, V. Bogdan, and C. Bonchiş, “Edge map response of dilated and reconstructed classical filters,” in 2020 22nd International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC), pp. 187–194, IEEE, 2020.