Research on edge detection algorithm of tiny parts based on visual images

Publisher:心灵捕手Latest update time:2011-09-20 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction
The edge refers to the part with the most significant local intensity change. It mainly exists between targets, targets and backgrounds, and regions. It is an important basis for image analysis such as image segmentation, texture features and shape features. How to quickly and accurately extract the edge information of an image has always been a hot topic of research at home and abroad. There are currently many edge detection algorithms, among which the most classic algorithm is the Sobel algorithm. This algorithm is widely used in many fields due to its small amount of calculation and fast speed, but its detection direction is limited and its anti-noise ability is low. Therefore, this algorithm also has certain limitations. Moreover, in practical applications, the pixel level can no longer meet the accuracy requirements, and only sub-pixel level subdivision algorithms can be used.
Here, an extended Sobel operator in four directions is given, that is, a template in four directions is used to refine its gradient direction map. In view of the characteristics of small amount of calculation and high accuracy of the interpolation method, the quadratic polynomial interpolation method is used to achieve sub-pixel subdivision.

2 Extended Sobel refinement operator
2.1 Two extended templates
The edge of an image target reflects grayscale discontinuity, and its types can be roughly divided into: step edge and layer top edge. The grayscale values ​​of the pixels on both sides of the former are significantly different, while the latter is located at the turning point where the grayscale value changes from increasing to decreasing. In order to more accurately describe the edge points of the image, reduce the influence of noise on its detection results, and improve the anti-noise ability of the operator, two 3x3 templates are reconstructed based on the horizontal and vertical templates. The weight of each position of the template is determined by the distance from the position to the center point and the direction of the position in the template. Points with equal distance have the same weight, as shown in Figure 1. Here, the edge gradient value corresponding to the highest output template is selected as the pixel edge gradient intensity.

2.2 Sobel operator to refine the edge
The edge of the image contains a lot of information about the image, but the value calculated by the template is only the gradient image corresponding to the image. The edge appears at the position with a large gradient. If you want to extract the edge of the image, you must set a threshold to binarize it. The gradient image obtained by the first-order gradient operator generally has a coarse edge. If you directly set a threshold to binarize the gradient image, it is difficult to find a suitable threshold. It is also not convenient for post-processing such as edge connection and edge feature extraction. Therefore, before binarizing the image gradient image, the detected gradient edge must be refined. The refinement principle is based on the definition of the classic Sobel operator:


The gradient direction is:


The elements in the Sobel operator template represent the weight factors of the corresponding pixels in the formula. The Sobel operator is an edge detection operator, so the sum of the factors in its processing template is zero. On the other hand, since the sum of the positive and negative factors is 4 and -4 respectively, the processing result may overflow in extreme cases. Therefore, in actual use, the Sobel operator usually uses a set threshold for binarization, that is, the processing result is a binarized edge map. This result will cause the edges with smaller amplitudes in the edge map to be lost. In order to overcome this defect, an attenuation factor Scale is introduced to remove the calculation result to eliminate data overflow without binarization processing, and the result is a distortion-free grayscale edge map, thereby retaining all edge values. After adding the extended template, we can get:


The factor Scale is 4, which is also the normalization factor, that is, the step of two grayscale layers. The processing result at the junction is the grayscale difference.
The steps of grayscale image refinement are as follows: ① Perform Sobel processing with an attenuation factor on the grayscale image to obtain a grayscale edge map. Sobel processing uses formula (3); ② Perform Sobel processing with an attenuation factor on the obtained grayscale edge map; ③ Subtract the Sobel processing result from the grayscale edge map, and then change the value of the edge point corresponding to the negative value part to zero to obtain a refined edge map.

3 Precise positioning of sub-pixel subdivision
by polynomial interpolation The gradient direction of edge points is obtained by using the direction template improved by the Sobel refinement operator. The gradient direction of the known edge points can be used to approximately replace the gradient direction of the unknown sub-pixel points, and quadratic polynomial interpolation is performed in this direction to obtain the sub-pixel position of the edge.
[page]

The gradient amplitude of any point in the grayscale image is represented by R. Let R0 be the modulus of the grayscale gradient direction of the edge point P0(m,n), R-1 and R1 are the gradient amplitudes of the two pixel points P-1 and P1 adjacent to P0 in the gradient direction, respectively. The coordinates of the sub-pixel point (xe, ye) can be deduced as follows:


Where: W is the distance from the adjacent pixel to the edge point, and θ is the angle between the gradient direction and the positive direction of the x-axis.
It can be concluded from formula (4) that the prerequisite for sub-pixel subdivision and edge positioning is: R0>R-1 and R0>R1.
The extended Sobel refinement operator is used to search for single-pixel edges. During the search process, the non-maximum values ​​of the gradient direction of the edge point are eliminated to ensure that the prerequisite for sub-pixel subdivision and positioning is met. The corresponding table of the direction template and the coordinates of points P-1 and P1 is shown in Table 1.

4 Experiment and result analysis
In order to verify the algorithm, the images of tiny parts collected online in real time were extracted for experiments.
(1) Verification of the scalable Sobel refinement operator After the grayscale Sobel operator is introduced, the edge map obtained is still a grayscale image. At this time, the Sobel operator is used to process and obtain the edge map of the edge. On the new edge map, new edges are obtained on both sides of the original edge, while the middle part becomes the background, and its width is smaller than the original edge. This feature is used to refine the original edge, that is, the new edge map is subtracted from the original edge, and the edge corresponding to the negative part in the result is changed to zero. Finally, an edge map close to a single pixel width is obtained, thereby achieving the effect of refining the edge, as shown in Figure 2.

(2) Sub-pixel subdivision algorithm positioning After the Sobel refinement operator of the extended direction template, the edge close to a single pixel is extracted, and the sub-pixel subdivision algorithm is used to further locate the edge of the image in its gradient direction.
Figure 3 is a coordinate diagram of a circular arc taken on the basis of the original edge before and after subdivision. It can be seen that the pixel edge obtained after positioning by the sub-pixel subdivision algorithm is relatively smooth. Compared with no subdivision, its accuracy is improved.

(3) Calculation of standard deviation: The pixel coordinate value of a single point is taken as the standard coordinate value, and the coordinate difference between the located single point and the corresponding point is taken as the algorithm deviation. The calculated standard deviation is about 0.20 pixel.

5 Conclusions
The edge detection algorithm used is to obtain a distortion-free grayscale edge map by introducing an attenuation factor through the extended 4-directional Sobel operator, and then using the Sobel operator for refinement, which can make the steeper edge part smooth and continuous, and close to the edge of a single point width; the quadratic polynomial interpolation method is used to interpolate in the gradient direction to obtain a smooth edge, and the positioning accuracy reaches 0.20 pixel, which is suitable for visual systems with high accuracy requirements.

Reference address:Research on edge detection algorithm of tiny parts based on visual images

Previous article:Application of SOPC Technology in Vision Measurement
Next article:Multi-focus color image fusion preprocessing

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号