Edge is one of the most basic and important features of an image. In a digital image, edge refers to the collection of pixels with a step-change in the greyscale of surrounding pixels, which exists in the target and background, target and target, region and region, elements and elements . So, the essence of image edge detection is to detect the change of position feature in the image. Edge detection has always been a hotspot and focuses in image processing technology, and has become one of the most standard research topics in image processing, image analysis, automatic target recognition, and computer vision .
In recent years, a variety of new edge detection theories and methods have emerged in an endless stream, and academic ideas have been very active. Traditional edge detection methods include differential algorithm, Robert operator, Sobel operator, Prewitt operator, Kirsch operator, etc. Prewitt and Sobel’s operators are examples of gradient-based edge detectors  . Marr and Hildreth  proposed the Laplacian of Gaussian (LoG) operator for edge detection, which uses Gaussian function for image smoothing, then calculates the second derivative, the zero-crossing points are considered to be edge points. Canny presented an optimal edge detector, especially for two-dimensional images. Canny operators can give the edge information of both intensity and direction . There are also new edge detection methods based on fuzzy mathematics, statistical analysis, wavelet transform, mathematical morphology, the genetic algorithm, neural network, etc. Edge is an important feature of the image, which is a greyscale mutation, and these greyscale mutations constitute the edge. The classical operator uses a derivative operator combined with the grey level change to detect the edge. The grey system is a model with incomplete information. Grey relevancy analysis is to analyze the grey system with mathematical theory. Its characteristic is “the data is little, the information is poor”, take the known information as the reference, the quantitative acquisition unknown information development trend. Aiming at the problem that the detection effect of the classical edge detection operator on the image with sufficient edge information and the weak edge image is not ideal, the traditional Sobel operator is improved and optimized by combining the grey relevancy degree.
In this paper, a new edge detection algorithm based on an improved eight- direction Sobel operator combined with a grey relevancy degree is proposed. This algorithm firstly improves and expands the traditional Sobel, and then uses the improved Sobel operator as a reference sequence to calculate the relevant degree of each point in the image for edge detection. The experimental results show that this method can accurately detect useful edge information, and has a certain anti-noise ability, and is an effective new edge detection method.
This paper is divided into the following parts. Section 1 introduces the research background, significance, and innovation points. Section 2 introduces traditional Sobel operators. Section 3 introduces how to improve and extend the Sobel operator. Section 4 introduces the concept of grey relevancy degree. Section 5 introduces how to combine the improved Sobel operator and grey relevancy degree. Section 6 compares and analyzes the method of this paper with other traditional detection methods. Section 7 introduces the feasibility and disadvantage of the edge detection method based on the Sobel eight-direction operator and grey relevancy degree.
2. Sobel Edge Detection Operator
Sobel proposed the Sobel edge detection method in 1970. In 2012, HE et al.  improved the traditional Sobel operator detection algorithm. In 2014, SUN et al.  expanded the Sobel operator into eight directions. In 2016, SHI et al.  added 6 templates with different directions to Sobel operator. The traditional Sobel edge detection is to do 3 × 3 pixel area through the corresponding template convolution operation. It is concluded that the centre pixel gradient values; it is greater than the threshold criterion for determining the pixel image edge pixels, the opposite is not.
The operator uses two 3 × 3 kernels, which are convolved with the original image to calculate approximations of the derivatives one for horizontal changes and one for vertical. If we define A as the source image, and and are two images which at each point contain the horizontal and vertical derivative approximations respectively, the computations are as follows :
The corresponding calculation process is as follows:
where, is the grey value at in image A.
The Sobel operator is the magnitude of the gradient computed by
The gradient direction is calculated as follows:
3. Improved Sobel Edge Detection Operator
3.1. Eight-Direction Edge Detection 5 × 5 Template
Edge detection is similar to difference operation, its essence is to detect the change of image brightness, so noise will inevitably affect the detection effect. To avoid the influence of noise, not only difference processing but also smoothing processing should be considered when constructing edge detection operators. Similar to the first-order difference template, the Roberts crossover operator only considers difference factors. The Prewitt operator expands the first-order difference template to size 3 × 3, introducing the mean operation. In the edge detection algorithm, the Sobel operator is used as the detection template, which considers both the difference factor and the optimal smoothing coefficient .
The theoretical basis of constructing the Sobel operator is a pascal triangle. The pascal’s triangle can calculate a set of coefficients of the smoothing operator, which is roughly the same as that of the gaussian smoothing operator in the limit case .
For different counts, the coefficient of position is Pascal :
For the template window size of winsize, the smoothing coefficient is:
For the template window size of winsize, the difference coefficient is:
A new Sobel operator is calculated by using Pascal’s triangle to obtain a significant image detection effect. An eight-direction 5 × 5 edge detection template is reconstructed. The weight of each position in the template is determined by the distance from the position to the centre point and the direction in which the position is located in the template. Equidistant points have the same weight. The eight-direction 5 × 5 edge detection template of the improved Sobel operator is respectively:
3.2. Template Convolution Calculation
In the above improved Sobel operator detection template, each template is composed of symmetric numbers that are opposite to each other and equal in absolute value. The current pixel in the original image is convolved with a certain template in the eight-direction Sobel operator detection template to obtain the grayscale value of the image in all directions .
Improved Sobel operator edge template:
After convolution calculation of and the grey value of pixel point on the image, the form is , and each element in this form is the corresponding weight on the edge template is the product of the value and the grey value of the corresponding pixel in the image, where
4. Edge Detection Grey Relevancy Degree
Grey system theory , which is found by the Chinese scholar professor Deng Julong in the 1980’s, is a method of studying the small sample and the uncertainty system of poor information. If we view a digital image as a random sequence, we can view an image as a grey system. Grey relevancy analysis is an important part of the grey system theory. Its basic idea is to measure the correlation degree among factors by the similarity degree of geometric relation or curve. The curvilinear relationship or geometric relationship between the comparison sequence and the reference sequence, if they are similar in shape, the degree of correlation is greater. The reference sequence is the representation of the change of system characteristics, while the comparison sequence is the description of the change of the affected system. Qi, Yingjian et al.  proposed a new image edge detection algorithm based on the grey system theory. When edge detection is carried out on a grayscale image, a certain pixel and its 8-field pixels can be arranged to form a sub-sequence , and the ideal non-edge points and their 8-field pixels can be formed into a mother sequence . When the correlation degree of and is large, it means that the geometric shapes of the two sequences are relatively similar. Therefore, it is considered that the intensity of grey value change of pixel point at adjacent pixel point is similar to that of an ideal non-edge point. So the pixel can be considered as a non-edge point. Similarly, when the correlation between two sequences is small, pixel can be regarded as the edge point.
Grey relevancy calculation procedure  as follows:
1) Select the reference sequence , and find the conversion sequence of the sequence .
2) Because the data in each factor column in the system may differ in dimension, it is not easy to compare, or it isn’t easy to get the correct conclusion when comparing. In grey relevancy analysis, and data should be processed dimensionless. [i)]
i) Initial value processing:
ii) Averaging treatment:
where k corresponds to a time period, and i corresponds to a column in the comparison sequence.
3) Calculated correlation coefficient:
For , which is called the resolution coefficient, the smaller , the greater the resolution, The value range of is generally , The specific value depends on the situation. When , the resolution is the best. Usually .
4) Calculate the grey correlation degree between the comparison sequence formed with each pixel as the centre and the reference sequence and is the overall correlation the degree between the reference sequence and the comparison sequence at each moment
5) The judgment method of edge points is as follows: when is higher than given threshold of correlation degree, it indicates that this point has the same characteristics as the reference sequence and is not an edge point. Otherwise, it’s the edge point.
5. Image Edge Detection Based on Grey Relevancy Degree and Sobel Operator with Eight Directions
The edge extracted by the traditional Sobel operator has noise interference, the boundary between the edge and the background is fuzzy, and the continuity of the detected image edge is poor. The improved Sobel operator has enhanced noise resistance, the boundary between the edge contour and the background is clear, and the overall edge continuity is good. However, there still exists a phenomenon of too thick edge texture. In the improved Sobel operator, grey relevancy is introduced to solve the problem of edge thickness, so that the contour and texture details of the image can be improved .
In the Grey relevancy method of image edge detection, the grey values of pixels as reference sequences are equal. This paper presents a new method based on grey relevancy degree and eight-direction Sobel operator. It is mainly divided into the following steps:
1) Select eight templates of Sobel operator as the reference sequence and the behavioral sequence which consists of each pixel and neighborhood pixels as the comparative sequence.
2) Calculating the grey relevancy degree of the eight-direction for each pixel, for the .
3) Setting the threshold , when , then the pixel is the edge point, and the grey value is defined as 255; Otherwise, is not the edge point and the grey value is defined as 0.
4) It can get the edge point of the whole image with a 5 × 5 window over the entire image sequence, and then connect the edge points to get the edge of the image.
6. Experimental and Simulation Results
The feasibility of the proposed algorithm is verified by qualitative and quantitative analysis. The peak signal-to-noise ratio, average gradient and structural similarity index were used for quantitative comparison.
Peak signal to noise ratio (PSNR): provides an objective standard to measure image distortion or noise level. It is often used to evaluate image degradation before and after compression in areas such as image compression. It is often defined simply by mean square error (MSE). If one of the two monochromatic images and is the noise approximation of the other, then their mean square error is defined as:
The PSNR is defined as:
where MAXI is the maximum value representing the colour of the image points, if each sampling point is represented by 8 bits, then it is 255.
Average Gradient: also known as sharpness, it reflects the contrast and texture variations of tiny details in the image, as well as the sharpness of the image, the bigger, the better.
Structural similarity index (SSIM): is a measure of the similarity between two images.
7. Qualitative and Quantitative Analysis
1) To verify the effectiveness of the algorithm, we take Lena image with a size of 256 × 256 as an example to set the optimal threshold T = 0.54 for edge detection in the new method proposed in this paper. The test results are shown in Figure 1.
It can be seen from Figure 1 that the image edge lines detected by the improved
Figure 1. Comparison of various methods of edge detection. (a) Original image; (b) Eight-direction Sobel operator; (c) Grey relevancy degree; (d) Proposed method.
eight-direction Sobel operators are relatively thick and the edge details are obvious. The algorithm based on the grey relevancy degree has poor edge continuity and some real edge missing. The algorithm based on grey relevancy degree and eight-direction Sobel operator has better edge continuity and fewer non- edge points. Although the new algorithm has the missing phenomenon of the boundary image, the integrity of the main image edge is better than that of the traditional algorithm.
2) The algorithm can detect the edges of Lena images with different parameters. In the experiment, a threshold value is used for segmentation. If the threshold value is set too large, the edge contour may be discontinuous or not smooth enough. An initial threshold value is selected and continuously adjusted during the experiment to obtain the best threshold value. First, select T = 0.48. With the increase of the threshold, the extracted texture details gradually increase, as shown in Figure 2. However, after a certain threshold is exceeded, when more edges are detected, the image texture is too complex, resulting in the image edge contour is not smooth enough for better observation. Thus, when the threshold value is T = 0.54, the image can be observed with clear texture and smooth edges. In Table 1, it can be intuitively seen through structure similarity index (SSIM) and average gradient that with the increase of threshold, the value of SSIM also increases. Still, when it exceeds 0.54, SSIM starts to decrease, and the average gradient increases with the increase of threshold. The average
Figure 2. Edge detection results under different parameters. (a) Origin image; (b) Threshold value of 0.48; (c) Threshold value of 0.50; (d) Threshold value of 0.52; (e) Threshold value of 0.54; (f) Threshold value of 0.55.
Table 1. Comparison of objective evaluation indicators for edge detection.
gradient is the clarity, and the greater the value, the higher the clarity. Through experimental results and quantitative analysis, the optimal threshold value of this algorithm is T = 0.54.
3) Figure 3 is an image of a cell with salt & pepper noise added to it. See Figure 3(b) after the random noise, Figures 3(c)-(f) is the edge result extracted by combining Sobel and grey relevancy degree in eight directions under different parameters, obviously, with the increase of the threshold, the noise resistance gradually increases.
4) Firstly, a building image with rich texture is selected. Then, the traditional algorithm and the algorithm proposed in this paper are respectively used for edge detection to verify the effectiveness of the proposed algorithm. In order not to lose fairness, the parameter selection of each algorithm in the experiment is adjusted to the best value. Figure 4(a) shows images of buildings with rich textures,
Figure 3. Edge detection results of noisy images with different parameters. (a) Origin image; (b) Noise image; (c) Threshold value of 0.48; (d) Threshold value of 0.52; (e) Threshold value of 0.55; (f) Threshold value of 0.58.
Figure 4. Contrast of detection results with different method. (a) Origin image; (b) Roberts; (c) Sobel; (d) Prewitt; (e) Log; (f) Canny; (g) Eight-direction Sobel; (h) Grey relevancy degree; (i) Proposed method.
and Figures 4(b)-(i) shows the extraction effects of different algorithms.
5) Figure 5 shows the anti-noise comparison of the cell images and Figures 5(b)-(i) is the comparison of detection results. It can be seen from the experimental results that different edge detection operators have obvious differences in processing noisy images, and the traditional operators have a poor effect on edge extraction and lack of noise resistance. Although the improved Sobel operator enhances the edge extraction effect, the noise resistance is not very ideal. The algorithm proposed in this paper shows clear edges and good noise resistance. In Table 2, the entropy value of Prewitt algorithm is the lowest, which means that Prewitt makes the de-noised image lose some details. Through the table, it can be seen clearly that the PSNA value of the algorithm in this paper is the largest, indicating that the algorithm in this paper has good visual effect and noise resistance.
Figure 5. Contrast of noise immunity with different method. (a) Origin image; (b) Roberts; (c) Sobel; (d) Prewitt; (e) Log; (f) Canny; (g) Eight-direction Sobel; (h) Grey relevancy degree; (i) Proposed method.
Table 2. Comparison of objective evaluation indexes of edge detection denoising.
This paper mainly introduces the research background of digital image edge detection and introduces various researches on edge detection in recent years. The traditional edge detection operator is improved to achieve a better detection effect.
In this paper, a new image edge detection algorithm is constructed by combining grey correlation degree and eight-direction Sobel operator. The eight-direction Sobel operator is used as the reference sequence, and the grey value of the central pixel and the surrounding 25 pixels is used as the comparison sequence of 5 × 5 pixels in the template. The experimental results show that this method can accurately extract useful edge information compared with the traditional Prewitt, Sobel, and LOG operators, which have strong anti-noise performance, can improve the image edge PSNR, and has a better adaptive ability.
 Sun, L.H., Zhao, E.L., Ma, L., et al. (2014) An Edge Detection Method Based on Improved Sobel Operator. Advanced Materials Research, 971-973, 1529-1532.
 Sobel, I. (1978) Neighborhood Coding of Binary Images for Fast Contour Following and General Binary Array Processing. Computer Graphics & Image Processing, 8, 127-135.
 Shi, T., Kong, J.-Y., Wang, X.-D., et al. (2016) Improved Sobel Algorithm for Defect Detection of Rail Surfaces with Enhanced Efficiency and Accuracy. Journal of Central South University, 23, 2867-2875.
 Zadeh, L.A. (1973) Outline of a New Approach to the Analysis of Complex Systems and Decision Processes. IEEE Transactions on Systems Man and Cybernetics, 3, 28-44.
 Gao, W.S., Zhang, X.G, Yang, L. and Liu, H.Z. (2010) An Improved Sobel Edge Detection. 2010 3rd International Conference on Computer Science and Information Technology, Chengdu, China, 9-11 July 2010, 61-71.
 Qu, Y.-D. Cui, C.-S., Chen, S.-B. and Li, J.-Q. (2005) A Fast Subpixel Edge Detection Method Using Sobel-Zernike Moments Operator. Image and Vision Computing, 23, 11-17.
 Qi, Y.J., Li, Q., Wu, Z.P., Zhang, B. and Li, Y. (2011) An Algorithm of Image Edge Detection Based on Grey System Theory. 2011 Fourth International Joint Conference on Computational Sciences and Optimization, Kun Ming and Li Jiang, China, 15-19 April 2011, 835-837.
 Shi, J.-T., Zhu, Y., Chu, X.-L. and Chen, X. (2010) A Novel Approach of Edge Detection Based on Gray Weighted Absolute Correlation Degree and Prewitt Operator, 2010 International Conference on Intelligent Computing and Integrated Systems, Guilin, China, 22-24 October 2010, 232-234.
 Kim, D.S., Lee, W.-H. and Kweon, I.-S. (2004) Automatic Edge Detection Using Ideal Binary Pixel Patterns and Fuzzy-Based Edge Thresholding. Pattern Recognition Letters, 25, 101-106.