Chip identification image edge detection method for optimizing Canny operator based on particle swarm optimization
By introducing particle swarm algorithm to optimize multi-threshold combinations in Canny operator, the problem of inaccurate edge detection in high noise and complex texture images is solved, and higher detection accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202411889265.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-05-23
AI Technical Summary
The traditional Canny operators are inaccurate in edge detection when processing high-noise and complex texture images, which is prone to false edges or missed detection.
The method of optimizing the Canny operator based on particle swarm algorithm (PSO) is adopted, and the best multi-threshold combination is automatically selected through image preprocessing, gradient calculation, non-maximum suppression, multi-threshold selection and edge connection strategy to improve the accuracy and robustness of edge detection.
It significantly improves the accuracy and robustness of edge detection of chip identification images, reduces false edges and missed detection phenomena, and outputs more complete edge detection results.
Smart Images

Figure CN120031901A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of image detection, and in particular relates to a chip identification image edge detection method based on particle swarm algorithm optimization of Canny operator. Background Art
[0002] In the modern electronic manufacturing industry, edge detection of chip identification images is a key link to ensure product quality and production efficiency. Chip identification usually includes various marks, symbols and texts, which are essential for chip identification, classification and defect detection. Accurate edge detection not only helps to identify chip identification, but also can be used to detect defects in the manufacturing process, such as cracks, scratches, etc., to ensure the performance and reliability of the chip. In the semiconductor manufacturing process, edge detection technology is widely used in wafer inspection, packaging testing and automated assembly to improve production efficiency and quality control level. However, chip identification images usually contain complex textures and high noise, which makes it difficult for traditional edge detection algorithms to accurately identify edges. Therefore, an efficient, accurate and robust edge detection method is needed.
[0003] As a classic edge detection algorithm, the Canny operator has been widely used in the fields of image processing and computer vision. The Canny operator implements edge detection through four steps: Gaussian filtering, gradient calculation, non-maximum suppression, and double threshold processing. Although the Canny operator performs well in many application scenarios, it has some limitations when processing high-noise and complex-texture images. First, the fixed Gaussian filter may smooth out important edge information while removing noise, resulting in blurred edges. Second, the fixed double threshold method may not be flexible enough when processing different images, and it is easy to produce false edges or miss detections. For example, in a high-noise image, the fixed double threshold may not be able to effectively distinguish between true edges and noise points. In addition, the Canny operator may not be able to extract all important details when processing complex-texture images, resulting in incomplete edge detection results. Therefore, it is necessary to improve the Canny operator to improve its accuracy and robustness in practical applications. Summary of the invention
[0004] The purpose of the present invention is to provide a chip identification image edge detection method based on particle swarm algorithm to optimize the Canny operator, so as to solve the problem that the traditional Canny operator has inaccurate edge detection in high noise and complex texture images, and is prone to false edges and missed detections.
[0005] To achieve the above purpose, the present invention adopts a chip identification image edge detection method based on particle swarm algorithm optimization Canny operator, the main steps are:
[0006] Step 1: Image preprocessing: Preprocess the chip identification image and use a filtering algorithm to smooth the image to reduce noise.
[0007] Step 2: Gradient calculation: Calculate the gradient magnitude and gradient direction of the smoothed image.
[0008] Step 3: Non-maximum suppression: Apply non-maximum suppression technology to determine the local maximum by comparing the pixel values in the gradient direction, thereby streamlining the edges.
[0009] Step 4: Multiple threshold selection.
[0010] Step 4A, determining the number of thresholds in the multi-threshold combination;
[0011] Step 4B: Use the PSO algorithm to automatically search for the best multi-threshold combination;
[0012] Step 5: Through multi-threshold processing and edge connection strategy, remove false edges and connect real edges, and finally output the complete edge detection result.
[0013] Step 6: Image post-processing: Through post-processing steps of the final edge detection results, such as edge refinement and edge closure, the quality and usability of the detection results can be improved.
[0014] Preferably, in step 1, the filtering algorithm adopts a bilateral filtering method, and its spatial domain kernel function and pixel value domain kernel function are adjusted according to the characteristics of the chip identification image to achieve an optimal noise suppression effect.
[0015] Preferably, in step 2, the calculation of the gradient amplitude and gradient direction is performed using a Sobel operator.
[0016] Preferably, in step 3, the non-maximum suppression technique compares the gradient values of each pixel point with its two neighboring points in the gradient direction, and only retains those pixel points that are larger than both of its two neighboring points as edge points.
[0017] Preferably, in step 4, the PSO algorithm is used to search for the best multi-threshold combination to enhance the accuracy and robustness of edge detection. Specifically, by setting multiple particles, each particle represents a set of possible multi-threshold combinations, calculating the corresponding image entropy as the fitness value, and finding the global optimal solution by iteratively updating the position of the particles.
[0018] Preferably, in step 5, the multi-threshold processing is specifically performed by setting multiple thresholds, that is, based on the segmented image corresponding to the best multi-threshold combination output in step 4, identifying the gradient amplitude of each pixel point;
[0019] Points above the highest threshold are considered strong edge points, while points below the lowest threshold are considered non-edge points and are directly discarded.
[0020] Preferably, the points between the highest threshold and the lowest threshold are weak edge points, and are considered for retention through the screening mechanism. Specifically, the comprehensive weight of the threshold interval ranking and its connectivity with the strong edge points is calculated for weak edge point screening to more accurately identify and retain edge information.
[0021] Preferably, in step 5, the edge connection strategy adopts a recursive or non-recursive method, starting from the strong edge points, and gradually connecting the weak edge points that meet the conditions to form a continuous edge line.
[0022] Preferably, step 5 further includes a post-processing step for the final edge detection result.
[0023] Compared with the prior art, the advantages of the present invention are:
[0024] 1. Introduce particle swarm optimization algorithm to automatically select multiple threshold combinations.
[0025] The present invention automatically selects a multi-threshold combination by introducing a PSO algorithm, which searches for a global optimal solution by iteratively updating the position of particles, and can search for the best multi-threshold combination, thereby improving the accuracy and robustness of edge detection.
[0026] 2. Optimize multi-threshold processing to improve the completeness and accuracy of detection results.
[0027] The present invention uses multi-threshold processing and edge connection strategy to remove false edges and connect real edges, and finally outputs complete edge detection results. Compared with traditional single-threshold and double-threshold processing, multi-threshold processing can more accurately identify and retain edge information, reduce false detection and missed detection, and improve the integrity and accuracy of detection results.
[0028] In summary, the present invention improves the Canny operator, introduces a particle swarm optimization algorithm to automatically select a multi-threshold combination, and optimizes the multi-threshold processing method, thereby significantly improving the accuracy and robustness of chip identification image edge detection. Compared with the prior art, the present invention has higher detection accuracy and robustness, and provides strong technical support for quality control in the chip manufacturing process. In addition, the method of the present invention also has wide applicability and flexibility, is suitable for a variety of application scenarios, and provides a new solution for image processing and defect detection in chips and other fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is the overall flow chart of the chip identification image edge detection method based on particle swarm algorithm to optimize the Canny operator.
[0030] Figure 2 It is a flow chart of the present invention based on PSO optimization of multi-threshold combination.
[0031] Figure 3 It is a schematic diagram of multi-threshold processing of the present invention. DETAILED DESCRIPTION
[0032] The chip identification image edge detection method based on particle swarm algorithm optimization Canny operator of the present invention is described in more detail below in conjunction with the schematic diagram, wherein the preferred embodiment of the present invention is shown, and it should be understood that those skilled in the art can modify the present invention described herein, while still achieving the advantageous effects of the present invention. Therefore, the following description should be understood as being widely known to those skilled in the art, and not as a limitation of the present invention.
[0033] Figure 1 This is the overall flow chart of the chip logo image edge detection method based on the particle swarm algorithm to optimize the Canny operator. As shown in the figure, the specific steps are as follows:
[0034] Step 1: Image preprocessing.
[0035] The chip identification image is preprocessed and a filtering algorithm is used to smooth the image to reduce noise.
[0036] Preferably, a bilateral filtering method is used. First, the similarity between the spatial neighborhood and the pixel value range of each pixel is calculated. Then, the smoothing parameters of the bilateral filtering are dynamically adjusted so that the filtering process can better adapt to the noise characteristics of different regions. Finally, the bilateral filtering algorithm is applied to smooth the image to reduce noise and retain image details.
[0037] Step 2: Gradient calculation.
[0038] Preferably, the Sobel operator is used to calculate the gradient magnitude and gradient direction of the smoothed image.
[0039] Step 3: Non-maximum suppression.
[0040] The non-maximum suppression technique is applied to determine the local maximum by comparing the pixel values in the gradient direction, thereby streamlining the edges.
[0041] Specifically, for each pixel point P, determine its two neighboring points P in the gradient direction 1 and P 2 .
[0042] Compare the gradient magnitude G(P) of point P with the two neighboring points P 1 and P 2 The gradient amplitude G(P 1 ) and G(P 2). If G(P) is the largest, point P is retained as an edge point; otherwise, point P is set as a non-edge point, that is, G(P) = 0.
[0043] Step 4: Multiple threshold selection.
[0044] Step 4A, determining the number of thresholds in the multi-threshold combination;
[0045] Step 4B: Use the PSO algorithm to automatically search for the best multi-threshold combination to enhance the accuracy and robustness of edge detection.
[0046] Specifically, the particle swarm is initialized, and each particle represents a set of possible multi-threshold combinations. The particle speed update formula is set, including the cognitive part, the social part, and the inertial part, to balance the capabilities of local search and global search. The specific formula is:
[0047] v i (t+1)=ω·v i (t)+c 1 ·r 1 ·(p i -x i (t))+c 2 ·r 2 ·(p g -x i (t))(1)
[0048] Among them, v i (t) is the velocity of particle i at the tth iteration, ω is the inertia weight, c 1 and c 2 is the learning factor, r 1 and r 2 is a random number, p i and p g are the historical optimal position and global optimal position of particle i, respectively, and x i (t) is the position of particle i at iteration t.
[0049] By iteratively updating the position of particles, the global optimal solution, that is, the best multi-threshold combination, is found.
[0050] Step 5: Based on the best multi-threshold combination, multi-threshold processing is performed to select edge points, and then the edge connection strategy is executed to remove false edges and connect real edges, and finally the complete edge detection result is output.
[0051] Multi-threshold processing is performed by setting multiple thresholds, and multiple thresholds are the best multi-threshold combination.
[0052] That is, based on the segmented image corresponding to the best multi-threshold combination output in step 4, the gradient amplitude of each pixel is identified; the gradient amplitude has been calculated in step 2.
[0053] Pixels with gradient magnitudes higher than the highest threshold are considered strong edge points; pixels with gradient magnitudes lower than the lowest threshold are considered non-edge points and are discarded directly; points between the highest and lowest thresholds are weak edge points and are considered for retention through a screening mechanism. Specifically, the comprehensive weight of the threshold interval ranking and its connectivity with strong edge points is calculated for weak edge point screening to more accurately identify and retain edge information.
[0054] Preferably, the edge connection strategy adopts a recursive or non-recursive method, starting from the strong edge points, and gradually connecting the weak edge points that meet the conditions to form a continuous edge line.
[0055] Step 6: Image post-processing: Through post-processing steps of the final edge detection results, such as edge refinement and edge closure, the quality and usability of the detection results can be improved.
[0056] Figure 2 This is a flow chart of the present invention based on PSO optimization of multi-threshold combination. Because there are still many noise points after non-maximum suppression processing, multiple thresholds are set for further detection and screening.
[0057] First, define the image entropy H, which satisfies:
[0058]
[0059] Where L is the number of gray levels (taking an 8-bit grayscale image as an example, L = 256), n i is the number of pixels with grayscale value i in the image, and N is the total number of pixels.
[0060] In order to determine the appropriate threshold number, the threshold number is gradually increased starting from 1, and the total entropy of each segmented sub-image is calculated using formula (2).
[0061] As the number of thresholds increases, the image is divided into more parts, and the entropy of each part will gradually decrease. The entropy change rate ΔH is defined as the absolute value of the entropy change between two adjacent thresholds divided by the entropy value under the previous threshold, that is:
[0062]
[0063] Where H(t) represents the total entropy under the tth threshold. When the entropy change rate ΔH is continuously lower than the preset threshold ε, it is considered that a reasonable threshold number has been reached. Generally, when ΔH < ε = 0.005 (i.e. 0.5%), the entropy value change is considered to be flat. This shows that further increasing the number of thresholds has limited improvement on the image segmentation effect, and the threshold number at this time is selected as the threshold number s in the final multi-threshold combination.
[0064] After determining the number of thresholds s, the PSO algorithm is used to optimize the specific values of these thresholds. It mainly includes the following steps:
[0065] Step A: Initialize the population. Define the parameters including population size, number of iterations, inertia weight, individual learning factor and social learning factor. For each particle, randomly generate a set of initial thresholds as its position, and initialize the velocity to 0 or a small random number.
[0066] Step B, calculate fitness. According to the multi-threshold combination represented by each particle, calculate the corresponding image entropy as the fitness value. Specifically, for each particle, use the threshold represented by it to perform image segmentation, and then calculate the entropy of the segmented image.
[0067] Step C: Update position and speed. For each particle, record its best historical position; at the same time, record the global best position. Update the speed of each particle based on the current speed, the particle's own best historical position, and the global best position. Update the position of each particle based on the new speed.
[0068] Step D: Iterative optimization: Repeat the above steps until the termination condition is met (such as the maximum number of iterations or the fitness is no longer significantly improved).
[0069] Figure 3 Schematic diagram of multi-threshold processing of the present invention, i.e., step 5. As shown in the figure, in order to more accurately identify and retain edge information, multiple thresholds T are set. 1 ,T 2 ,...,T s , where T 1 <T 2 <...<T s .
[0070] The pixels are classified according to the gradient amplitude, and those above the maximum threshold T s Points below the minimum threshold T are considered strong edge points, the total set is defined as O, and all are retained. 1 The points between T s and T 1 The points between are weak edge points and need to be retained based on their comprehensive weights.
[0071] Specifically, the threshold T 1 ,T 2 ,...,T s The gradient amplitude range of the image is divided into s-1 intervals. For the weak pixel D, let it be in the kth interval (k∈[1,s-1], k is an integer), that is, the gradient amplitude T D Satisfy range T D ∈[T k ,Tk+1 ), calculate its gradient amplitude weight ω g (D):
[0072]
[0073] Among them, α represents the adjustment parameter, and its value range is [0.7, 0.9]. The first item is designed as the interval ranking proportion, and the second item is designed as the relative position influence within the interval.
[0074] Next, in order to further enhance the accuracy of edge detection, the connectivity weights with strong edge points are calculated. Specifically, for the set of strong edge points O and the point to be detected D, all known strong edge points are traversed, the Euclidean distance between point D and each strong edge point is calculated, and the minimum distance is recorded as d(D,O).
[0075] After obtaining the distance d(D,O) from point D to the nearest strong edge point, calculate the connectivity weight ω c (D):
[0076]
[0077] Among them, σ is a tuning parameter used to control the influence range of distance. The connectivity weight reflects the spatial proximity between weak edge points and strong edge points, thus helping to distinguish true edge points from noise points.
[0078] Then, consider the gradient amplitude weight ω comprehensively g (D) and connectivity weight ω c (D), calculate the comprehensive weight ω(D) of pixel D:
[0079] ω(D)=ω g (D)×ω c (D) (6)
[0080] Normalize the comprehensive weights to be in the range [0,1]:
[0081]
[0082] Among them, max(ω) is the maximum value of the comprehensive weights of all pixels.
[0083] Furthermore, the pixel is screened based on the comprehensive weight to determine whether it is retained as an edge point. Specifically, a threshold ω is set vote , if ω(D) is greater than ω vote , then retain D as an edge point; otherwise, set D as a non-edge point. In this way, edge information can be more accurately identified and retained, reducing false detection and missed detection.
[0084] After all pixels are screened, a recursive or non-recursive method is used to gradually connect weak edge points that meet the conditions starting from the strong edge points to form a continuous edge line.
[0085] Taking the non-recursive method as an example, first, create an empty queue queue to store the strong edge points to be processed, and create a label matrix visited with the same size as the input image to record which pixels (that is, all edge points selected after multi-threshold processing in step 5) have been visited to avoid repeated processing. Initially, all elements are set to False.
[0086] Next, find all the strong edge points: traverse the entire image and check whether the gradient amplitude of each pixel (i.e., all edge points selected after multi-threshold processing in step 5) is greater than the high threshold T s If it is greater than , it is a strong edge point. If it is a strong edge point, its coordinates are added to the queue and the corresponding position is marked as visited in the visited matrix.
[0087] When the queue is not empty, do the following:
[0088] Take a strong edge point (y, x) from the front of the queue. Check the eight neighboring points of this point (up, down, left, right and four diagonal directions). If a neighboring point (ny, nx) is a weak edge point and its comprehensive weight ω'>ω vote , and the point has not been visited, it is considered a weak edge point that needs to be connected. Such a weak edge point (ny,nx) is marked as a strong edge point, and its coordinates are added to the tail of the queue. At the same time, the visited matrix is updated to mark the point as having been visited.
[0089] This process continues until the front of the queue becomes empty, which means that all connectable weak edge points have been processed. In this way, the weak edge points that meet the conditions can be gradually connected to form a continuous edge line.
[0090] Through the above steps, the present invention can more accurately identify and retain edge information, thereby improving the accuracy and robustness of edge detection.
[0091] The above is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any technician in the relevant technical field, without departing from the scope of the technical solution of the present invention, makes any form of equivalent replacement or modification to the technical solution and technical content disclosed in the present invention, which does not depart from the content of the technical solution of the present invention and still falls within the protection scope of the present invention.
Claims
1. A chip identification image edge detection method based on particle swarm algorithm optimized Canny operator, characterized in that: The following steps are involved: Step 1: pre-process the chip identification image and use a filtering algorithm to smooth the image; Step 2, calculating the gradient magnitude and gradient direction of the smoothed image; Step 3: Apply non-maximum suppression technology to determine the local maximum by comparing the pixel values in the gradient direction; Step 4: Multi-threshold selection: Step 4A, determining the number of thresholds in the multi-threshold combination; Step 4B: Use the PSO algorithm to automatically search for the best multi-threshold combination; Step 5: Based on the best multi-threshold combination, multi-threshold processing is performed to select edge points, and then the edge connection strategy is executed to output the complete edge detection result.
2. According to claim 1, the chip identification image edge detection method based on particle swarm algorithm optimized Canny operator is characterized in that: In step 1, the filtering algorithm is bilateral filtering, and its spatial domain kernel function and pixel value domain kernel function are adjusted according to the characteristics of the chip identification image.
3. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 1 is characterized in that: In step 2, the gradient magnitude and gradient direction are calculated using the Sobel operator.
4. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 1 is characterized in that: In step 3, the non-maximum suppression technique compares the gradient amplitude of each pixel point with the gradient amplitudes of its two neighboring points in the gradient direction, and only retains the pixel points with a gradient amplitude greater than that of its two neighboring points as edge points.
5. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 1 is characterized in that: In step 4, the particle swarm optimization algorithm sets a plurality of particles, each particle represents a set of possible multi-threshold combinations, calculates the corresponding image entropy as the fitness value, and searches for the global optimal solution by iteratively updating the position of the particles.
6. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 1 is characterized in that: In step 5, the multi-threshold processing specifically includes the following steps: Based on the segmented image corresponding to the best multi-threshold combination output in step 4, the gradient amplitude of each pixel is identified. Pixels with gradient magnitudes higher than the highest threshold are considered strong edge points; pixels with gradient magnitudes lower than the lowest threshold are considered non-edge points and are directly discarded.
7. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 6 is characterized in that: Pixels between the highest threshold and the lowest threshold are weak edge points, and are considered for retention through the screening mechanism; The screening mechanism specifically includes the following steps: The comprehensive weight of the threshold interval ranking and its connectivity with strong edge points is calculated for weak edge point screening to more accurately identify and retain edge information.
8. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 1 is characterized in that: In step 5, the edge connection strategy adopts a recursive or non-recursive method, starting from the strong edge points, and gradually connecting the weak edge points that meet the conditions to form a continuous edge line.
9. The chip identification image edge detection method based on particle swarm algorithm optimized Canny operator according to claim 1, characterized in that: After step 5, a post-processing step for the final edge detection result is also included.