Comparison of edge detection algorithms for electric wire recognition

Edge detection is the preliminary step in image processing for object detection and recognition procedure. It allows to remove useless information and reduce amount of data before further analysis. The paper contains the comparison of edge detection algorithms optimized for detection of horizontal edges. For comparison purposes the algorithms were implemented in the developed application dedicated to detection of electric line wires. The optimized algorithms were benchmarked on a set of images of electric wires.


Introduction
Detection and recognition of wires of electric lines in an image can be realized using shapes.The shape of a wire can be extracted using edges.Such approach is shown, for example, in [1,2].Accuracy and execution time of edge detection process can strongly affect the further image processing.In this paper we present and analyse a selected set of edge detection algorithms which are well suited for detection of edges representing electric lines in the image.We also suggest important modification that increases the performance of the wire detection.We have implemented individual algorithms and compared their execution time and accuracy.
In Section 2 a short review of selected edge detection algorithms is given and Section 3 contains the benchmarks and discussion of the results.

Review of edge detection algorithms
The digital image can be treated as a matrix with the entries that contain the pixels.In grayscale images small values represent dark pixels and large values bright.It is assumed that edges appear where there is a large difference in the values of neighboring pixels.The output of the edge detection algorithm is the matrix where edges are represented by relatively large values.The final step of the edge detection process is the thresholding which gives the binary image represented by an array of bits, where each bit corresponds to one pixel.The value of 1 represents the edge and 0 the area outside the edge.The core of algorithms is the twodimensional convolution of the part of image called window W x,y with the appropriate mask M.An example of M can be 3x3 mask that can provide satisfactory results without imposing heavy computational burden.The convolution result z x,y can be expressed as where W x,y is the window from the image V, x and y are the coordinates of the left upper corner and v x,y is the pixel of the input image V.The convolution result z x,y for mask 3x3 is calculated by using the following formula where m i,j is the coefficient of the mask M and w i,j is the pixel of the window W x,y .
In their basic form edge detection algorithms use the 3x3 mask to extract both vertical and horizontal edges.There are three types of basic edges: horizontal, vertical and diagonal oriented.For wire detection it can be assumed that wires are situated horizontally.It allows to simplify the algorithms that can be achieved by using a set of masks adjusted to horizontal edge detection.Below the directional masks of selected algorithms are shown.The masks with the highest sensitivity to horizontal edges have the following forms: where S is Sobel [3] mask, P -Prewitt [4], K N and K S -Kirsch [5], Sch -Scharr [6]  An example of the operator that uses masks smaller than 3x3 is Roberts operator [7].
Using these masks the new pixel value is calculated using the formula This algorithm has high sensitivity to all edges but the highest sensitivity to diagonal edges.
It can be shown that the simpler masks [9] can be used with the following form These masks provide relatively high sensitivity to horizontal edges and are insensitive to vertical edges.

Results
The comparison of edge detection algorithms has been carried out using the elaborated custom software for detecting of electric lines that uses OpenCV library [8] for elementary processing.The run-time environment included the PC based computer with i7 class four cores processor.It has been assumed that the basic assessment criteria are the noise level in the image and the algorithm execution time.We have applied as the figure of merit the efficiency function eff.This function computes the number of columns of the binary image in which the wire has been detected The internal functions f i (x) in (8,9) are equal to 1 when at least one pixel of the wire i in column x has been detected otherwise to 0. The full set of pixels of the wire i in the column i is represented by L i,x .The function eff has been used to select individually the threshold for each of the considered algorithms.In effect, the thresholds are selected for each image and algorithm, which results in eff equal to 90% of the maximum attainable value.The accumulated noise value N v was calculated as the count of pixels detected outside any wire.The noise level was calculated as N v divided by the image resolution.The 1% noise in the 10Mpx image means that 100 000 pixels are recognised outside all wires.Fig. 2 and Fig. 3 presents the comparison of the influence of the individual masks on the noise level.

Conclusion
The paper contains the analysis of performance of selected edge detection algorithms which are well suited for detection of electric wires in images.The execution times and accuracy for individual algorithms have been shown.As well certain modifications have been proposed to increase the efficiency detection of wire treated as horizontal edges.

Fig. 1 .
Fig. 1. a) Input image in gray-scale, b) Result of edge detection using mask K n .

Fig. 2 .
Fig. 2. Average noise in presented algorithms and times of execution in milliseconds on 10Mpx image.Roberts, 2x1 and 3x1 algorithms was significant faster than other algorihtms.The fastest alorithm (3x1) is eight times faster than the slowest (Kirsch with 2 masks).

Table 1
contains the sample data row with the highlighted edges.

Table 1 .
Sample data row.