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]
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.
Previous article:Application of SOPC Technology in Vision Measurement
Next article:Multi-focus color image fusion preprocessing
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Essential PCB wiring rules for electronic hardware engineers: basic theories of right-angle routing, differential routing, and serpentine routing
- 【EETALK】What is the difference between traditional Bluetooth and low-power Bluetooth? Will traditional Bluetooth be replaced by low-power Bluetooth in the future?
- How to select PCB isolated power supply
- Technical Articles | Frontline engineers explain to you: Tips for testing the dark current of passive device PD
- BSL source code for DM642EVM
- Teachers, what kind of amplifier should be used to amplify the mv level of this sensor?
- A record of the development experience of a new embedded CPU chip CC2540
- if(Data==1)start=1; Why is there no space after if and before start in this sentence? This will not cause errors during compilation.
- Xiaomi Robot Vacuum Cleaner Features and Chip Parameters
- Live: Embedded to Cloud Journey with PIC and AVR MCUs from the Microchip Ecosystem Part 2