Sobel
Sobel
Abstract-Sobel algorithm is an important method of image edge many respects, Sobel operators are superior to others.
detection. Comparing the Sobel operator with several other However, the classical Sobel operator also has some
edge detection operators used frequently and making a further problems. The Sobel operator is sensitive only to the
study on the classical Sobel operator, the advantages of Sobel vertical direction and the horizontal direction. However, the
operator are its fast detection speed, meanwhile , it has an image information is not limited to the horizontal and
effect on smoothing and suppressing noise. Also, Sobel vertical direction; it can make part of the image information
operator has a good effect on edge detection. Although Sobel lose. In this paper, a new improved operator is proposed
operator has advantages in many aspects, it exists some based on the sobel operator. On the traditional Sobel
problems: the Sobel operator is a kind of edge detection in
operator, the 45 degrees and 135 degrees 2 direction
horizontal and vertical direction, so it neglects edge points in
other directions. It can not achieve a true detection for the
templates are added to realize multi- directional image
points on image edge. In this paper, the algorithm is based on acquisition. Then calculate the threshold by using the Otsu
the Sobel operator, an increase of 45 degrees and 135 degrees 2 method and refine the detected rough edges by using
direction template, while the main edge of the oblique, binarization method to achieve the results of image edge
re-assigned the weight of the operator template. At the same detection. Edge detection effect can be achieved better by
time, in order to achieve an effect of detection, binarization using Matlab simulation method.
method is used to make an edge thinning for detected image. A comparison table of various operators is shown in
According to simulation experiments, they show this method is Table 1:
simple and feasible, and the detective result is more concrete
and abundant than traditional Sobel edge detection. Some II. THE COMPARISON OF SEVERAL
problems are improved, such as traditional Sobel edge is rough TRADITIONAL OPERATORS
and detection is incomplete.
• Roberts operator: did not pass smooth calculation,
Keywords-sobel operator; binarization; edge detection; edge
so it is more sensitive to the noise.
thinning • Prewitt operator and Sobel operator: edge extraction
effect is almost the same. Prewitt operator is an
I. INTRODUCTION average filter, Sobel operator is a weighted average
filter; they have better detection effect on images
In digital image processing, edge feature is one of the
which have low gray level noise, but the detection
important features of the image, and it is an important part
effect is not obvious.
of image processing, pattern recognition and computer
vision. The results of image edge detection affect the further • LOG operator: detecting edge by using two order
image processing and pattern recognition directly. In recent derivatives zero crossing edge method. Smoothing
decades, the image edge detection technology has become effect is more significant, removing effect of noise
an important research topic in digital image processing is better, but the loss of image details is larger, the
technology. With the development of science and edge precision is lower. So there is a contradiction
technology, researchers have proposed some methods for between positioning edge accuracy and eliminating
image edge detection and evaluation of edge detection. At noise level.
the same time, these edge detection techniques are applied III. THE PRINCIPLES OF THE TRADITIONAL
to the field of computer vision and pattern recognition, SOBEL OPERATOR
which makes the application of edge detection technology
more and more widely [1]. Over the years, image Sobel cross-differential operator, because of its role in
segmentation has been attracting more and more attention. the template is small, the relative calculation is also small,
Thousands of segmentation algorithms have been put thus the image details of the contour can be obtained. But
forward. They can be divided into bit threshold method, because the template size is even, the pending pixel cannot
edge detection method and regional growth method [2]. be placed in the center position of the template, or the
Edge detection method includes: first order differential edge results will have half pixel fault. Sobel differential operator
detection operator includes Roberts operator, Prewitt is a directional differential operator in a basis of odd size
operator, LOG operator and Sobel operator.In contrast, in template. The expressions of formula as follow (3.1), (3.2):
G x (i, j ) = f [i − 1, j + 1] + 2 × f [i, j + 1] idea of Sobel operator algorithm: because the edge of the
image is located at the place in which the brightness
+ f [i + 1, j + 1] − f [i − 1, j − 1] (3.1) changes significantly, therefore in the neighborhood of the
− 2 × f [i, j − 1] − f [i + 1, j − 1]
pixel gray value of pixels exceeds a set threshold depending
on the specific steps for the edge [3]. The specific steps of
Sobel operator algorithm are as follows [4]:
G y (i, j ) = f [i + 1, j − 1] + 2 × f [i + 1, j ] • Moving the horizontal and vertical direction
templates from left to right, from top to bottom, and
+ f [i + 1, j + 1] − f [i − 1, j − 1] (3.2)
moving from one pixel to another, and the center of
the template corresponds to the corresponding
− 2 × f [i − 1, j ] − f [i − 1, j + 1] pixels in the image.
• Multiplying the coefficients in the template with the
corresponding pixel values in the image.
The convolution template of the Sobel operator is • The gradient value is calculated as a new gray value
expressed as the formula (3.3) and (3.4): by using 2 convolution values.
• Select the appropriate threshold TH, if the new pixel
− 1 − 2 − 1 value ≥ TH, the pixel points can be regarded as
G x = 0 0 0 (3.3) image edge points.
1 2 1 IV. THE IMPROVEMENT OF THE TRADITIONAL
SOBEL OPERATOR
Adding 45 degrees and 135 degrees direction template in
−1 0 1 a basis of the traditional Sobel operator, the direction
G y = − 2 0 2 (3.4) template are changed into four directions: the horizontal and
vertical direction and 45 degrees and 135 degrees direction.
− 1 0 1 It improved the weights of new template in the direction of
oblique edge. Specific details are as follows:
The calculating steps of Sobel operator: first, the edge According to the calculation of the four template
detection image is divided into matrix form (3.5): − 1 − 2 − 1 - 2 - 1 0
0 0 0 - 1 0 1
f1(x − 1, y − 1) f1(x − 1, y ) f1(x − 1, y + 1) 1 2 1 0 1 2
A = f1(x, y − 1) f1(x, y ) f1(x, y + 1) (3.5) horizontal direction 45 degree direction
f (x + 1, y − 1) f (x + 1, y ) f (x + 1, y + 1) − 1 0 1 0 1 2
1 1 1 − 2 0 2 - 1 0 1
Multiply horizontal direction by vertical direction of the − 1 0 1 - 2 - 1 0
template and then multiply the vertical direction by vertical direction 135 degree direction
horizontal direction of the template, Fx=Gx.*A, Fx=Gy.*A. directions and the calculating an image point by point, the
gradient size calculation, as shown in the formula (3.6): maximum value is regarded as the pixel gray values.
According to the threshold setting, edge point is determined.
The template maximum value corresponding to represents
G = G x2 + G 2y (3.6) the direction of edge direction of the pixel.
A. Edge Thinning Processing
The formula for calculating the gradient direction is shown The edge of the image contains a lot of image
in the formula (3.7): information, by the direction of the traditional Sobel
operator improvement, only the gradient information. The
Gy edge appears where the gradient value is large. To extract
θ = arctan
(3.7) the edge of the image, a threshold must be set and then
Gx binarized. In general, the gradient image obtained by the
gradient operator has a thicker edge. If the gradient image
When θ is equal to zero, there is a vertical edge on threshold is set directly to binarization, it is difficult to find
behalf of the image, the left side is dark er than right side. a suitable threshold, so that the detected edge can meet the
The Sobel operator introduced the weighted local requirements. This is not easy to edge processing and edge
average, it can not only affect the image edge detection but feature extraction and other post-processing.Therefore, it is
also suppress noise further, but the edge is wider. The basis necessary to refine the edge of the gradient before
130
Advances in Computer Science Research, (ACSR), volume 52
binarizing the image gradient [5]. separate Sobel operator for image edge detection, and then
The refinement process is to find the pixel (a, b) Max a use the algorithm for image edge detection; make a
maximum value in the neighborhood of (a, b), and set the comparison between them, Figure 1and4 shows the original,
threshold locally according to Max (a, b). According to the the sobel edge detection is shown in Fig2and5, in this paper
gradient value and the choice of the threshold, so that we edge detection is shown in Fig 3 and 6:
can achieve the refinement of gradient map, with the body is
shown in formula (4.1):
Max(a,b ) ( )
grade a,b > a ∗ Max a,b( )
( )
edge a , b = (4.1)
0 other
TH
p1 = ∑p
i =0
i (4.2)
Figure 5.
p2 = 1 − p1 (4.3)
δ b2 = p1 ∗ (µ1 − µ )2 + p 2 ∗ (µ 2 − µ )2 (4.4)
131
Advances in Computer Science Research, (ACSR), volume 52
TABLE I. TABLE
132