An electronic component positioning method based on improved SURF algorithm
Through the improved SURF algorithm and related technical means, the problem of long positioning time and low accuracy of workpieces in electronic components assembly is solved, the rapid and accurate positioning of workpieces is achieved, and the level of intelligent manufacturing is improved.
Patent Information
- Application Number
- CN202011190924.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2040-10-30
AI Technical Summary
During the assembly process of existing electronic components, there are problems of long time and low accuracy in workpiece positioning.
The improved SURF algorithm is adopted, combined with the principal component analysis algorithm PCA and K-mean clustering algorithm, feature point detection, dimensionality reduction, image segmentation and matching, and finally, center calculation and three-dimensional reconstruction are carried out through the target edge algorithm to achieve fast and accurate workpieces. position.
It improves the efficiency and accuracy of workpiece positioning, reduces the running time of the algorithm, and reduces the possibility of wrong matching, and improves the level of intelligent manufacturing.
Smart Images

Figure CN113554704B_ABST
Abstract
Description
Technical Field
[0001] The present invention is applicable to the field of intelligent manufacturing, and in particular relates to an electronic component positioning method based on an improved SURF algorithm. Background Art
[0002] Binocular structured light measurement technology can accurately obtain the distribution of scattered parts in space, and can be intuitively presented in the form of point clouds. This measurement method clearly establishes the relationship between two-dimensional images and three-dimensional point clouds. The target parts can be identified through image recognition technology, and the pose information of the parts can be accurately obtained through processing and analysis of the point clouds, so that the robot can be assisted to grasp the target parts completely autonomously. The pose information of the parts is a necessary condition for the robot to complete the grasping. The pose information is the relative relationship between the current position of the part to be grasped and the position of the template. The point cloud of the part to be grasped is obtained through the three-dimensional scanning device, and then the rotation and translation matrix between the part point cloud and the template point cloud is obtained by registering the part point cloud and the template point cloud. The obtained rotation and translation matrix is the pose of the part.
[0003] In 2012, Yang Yang et al. matched key points through image matching algorithms, calculated the three-dimensional coordinates of key points to complete the matching of three-dimensional key points, and finally obtained the pose information by decomposing the homography matrix. This method obtains the pose of point clouds by processing two-dimensional images. The technology is mature and the method is simple, but the image is easily disturbed by the external environment and the calculation results are unstable.
[0004] In 2014, Hao-Yuan Kuo et al. used depth images as input and simultaneously obtained depth images of parts in different postures. They extracted key points from the template and the currently acquired depth map, calculated the rotation image features (Spinimage) of the key points, and then used the RANSAC algorithm to match the template depth map to obtain the initial alignment result. Finally, ICP was used to optimize the alignment result.
[0005] In 2014, Jiang Lei et al. proposed a point cloud registration method based on "one face and two holes" for common geometric primitives on mechanical parts. This method constructs a local coordinate system through geometric primitives, and obtains the transformation relationship between the point cloud and the template local coordinate system through primitive matching to obtain the point cloud pose. This method is relatively reliable in calculating pose, but the extraction and matching of geometric primitives are uncertain and prone to mismatching. Summary of the invention
[0006] In order to overcome the problems of long time and low precision in workpiece positioning during the existing electronic component assembly, the object of the present invention is to provide an electronic component positioning method based on an improved SURF algorithm.
[0007] In order to achieve the above-mentioned invention objectives, the technical solution adopted by this patent is described as follows.
[0008] An electronic component positioning method based on an improved SURF algorithm comprises the following steps:
[0009] S1: The images of electronic components on the production line are acquired through a binocular camera, and then input into a computer for image preprocessing to eliminate the effects of light and noise in image acquisition;
[0010] S2: Use SURF algorithm to detect and describe feature points of workpiece images;
[0011] S3: Use K-means clustering algorithm to segment the image;
[0012] S4: Match the segmented images;
[0013] S5: The target edge algorithm is used to calculate the centroid, locate the centroid position of the workpiece in the left and right images, and perform three-dimensional reconstruction based on the camera calibration results to achieve spatial positioning of the workpiece.
[0014] In the above scheme, in step S2, the principal component analysis algorithm PCA is used to reduce the dimension of the feature point descriptor of the image, including the following process:
[0015] In order to improve the computational efficiency, the principal component analysis algorithm PCA is applied to feature point detection and reduce the dimension of features. The 64-dimensional SURF descriptor of the obtained feature points is divided, and the sample matrix is recorded as [x1, x2, L, x n ] T , de-center the sample and get the difference vector:
[0016]
[0017] Where, d i is the difference vector, n is the number of feature points, x i is the 64-dimensional descriptor of the i-th feature point; construct the covariance matrix and find the 64 eigenvalues λ i and the eigenvector e i , and i and the corresponding e i Arrange them in descending order, take the first 32 eigenvectors in the order of arrangement, standardize them, and form the eigenvector matrix W. For each sample x i , converted into a new sample, denoted as z i =W T x i , reducing the original 64-dimensional SURF feature descriptor to 32 dimensions.
[0018] In the above scheme, in step S3, the segmentation process is:
[0019] Step 1: According to the principle of maximization and minimization, select K data points as the initial class centers for K subclass divisions; suppose the data set consisting of n data points is X = {x i |x i ∈R d ,i=1,2,L,n}, each data point x i is a vector composed of d data points that represent its characteristics; the goal of K-means clustering is to divide these n data points into K categories to form a cluster set E = {e k |k=1,2,L,K}, where e k The class center of the class is set to O k ;
[0020] Step 2: Calculate the Euclidean distance from each data point to the class center, and divide it into subclasses represented by each class center according to the nearest neighbor principle to obtain K subclass data sets; define the data points divided into e k Class point x i To the class center O k The Euclidean distance is:
[0021]
[0022] Among them, x i is the data point, O k for e k Class center of class,e k is the kth subclass, x ij is the vector characterized by the jth feature, O kj is the class center of the jth class.
[0023] Step 3: Calculate the average value of each point in each subclass data set and use the average value as the new class center of the subclass;
[0024] Step 4: Calculate the sum of the Euclidean distances of all data points to the class center of their class, and determine whether the value of the sum of the class center has changed. If yes, go to step 2; if not, go to step 5;
[0025] All are divided into e k Class point x i Go to the class center O of this class k The sum of the Euclidean distances is
[0026] Among them, e k is the kth subclass, x i is the data point, O k for e k Class Center
[0027] The statistics in the formula are the k-th subclass O in the cluster set E. kThe sum of the Euclidean distances from the points in the cluster to the center of the cluster; then, by counting each subclass in the cluster, we can get the sum of the Euclidean distances of all points x in the data set. i The sum of the Euclidean distances to the class center of the class to which it belongs;
[0028]
[0029] in, It can be seen from this that in order to make S(x i ) is the smallest, and the cluster center O k The cluster subset e should be taken k The average value of each data point in ;
[0030] Among them, e k is the kth subclass, x i is the data point, O k for e k The class center of the class, M(e k ) for all the k Point x of class i Go to the class center O of this class k The sum of the Euclidean distances, D(x i ,O k ) is divided into e k Point x of class i To the class center O k The Euclidean distance, λ i is a variable coefficient.
[0031] Step 5: Terminate the iteration and the algorithm ends.
[0032] Beneficial effects of the present invention: The proposed algorithm introduces PCA into the SURF algorithm, retains only points with larger eigenvector values for the matching process, reduces the total algorithm running time, and reduces mismatches by introducing the K-means clustering algorithm, further improving the accuracy of recognition. The improved algorithm can realize fast and accurate recognition and matching of electronic components, and the matching results are combined with binocular vision technology to realize the positioning of electronic components, which has great application value for improving the level of intelligent manufacturing. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is the flow chart of the positioning algorithm.
[0034] Figure 2 This is the flow chart of the PCB image segmentation algorithm.
[0035] Figure 3 It is a binocular parallel system imaging model.
[0036] Figure 4 This is the stereo matching result of the traditional SURF algorithm image.
[0037] Figure 5 This is the image stereo matching result of the improved algorithm in the literature involved in the specific implementation method.
[0038] Figure 6 This is the image stereo matching result of the improved algorithm of the present invention.
[0039] Figure 7 PCB model reconstructed by traditional surf algorithm and reference model diagram.
[0040] Figure 8 The PCB model reconstructed by the algorithm of the present invention and the reference model diagram. DETAILED DESCRIPTION
[0041] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0042] The electronic component positioning method based on the improved SURF algorithm of the present invention is used in the automatic assembly process of electronic components.
[0043] like Figure 1 As shown, the method of the present invention includes the following steps: (1) using a binocular camera to obtain images of electronic components on the production line, and then inputting them into a computer for image preprocessing to eliminate the influence of factors such as lighting and noise in image acquisition; (2) using the SURF algorithm to detect and describe feature points of the workpiece image; the first step: comparing the target point in the Gaussian pyramid dimension space constructed based on the Hessian matrix with its 26 adjacent position points. If the target point is found to be the maximum or minimum value after comparison, it is considered to be a possible feature point. The second step: based on the SURF algorithm fast robust feature
[0044] Speeded-up robust In SURF, the main direction of the feature point is solved by rotating a 60-degree sector at a certain interval in the circular neighborhood with the feature point as the center. The circular area is divided into 72 groups, each 5° group. The sum of the horizontal and vertical responses in the window is calculated and represented by a new vector. After traversal, the direction of the longest vector is the main direction of the feature point. As long as the feature points are calculated one by one, the main direction of all feature points can be obtained. Step 3: The formation of the SURF algorithm feature descriptor is also through dividing a 4*4 area around the feature point. In each sub-area, the Haar wavelet response with a side length of 2s within the range of 5s*5s (sampling step size is s) is calculated. It is necessary to count the 4-dimensional Haar wavelet features composed of the horizontal sum ∑dx, the horizontal absolute value sum ∑|dx|, the vertical sum ∑dy and the vertical absolute value sum ∑|dy|. Finally, the ∑dx,∑dy,∑|dx|,∑|dy| in each sub-area are accumulated to form a 4-dimensional vector v.
[0045] v=(∑dx,∑dy,∑|dx|,∑|dy|) (1)
[0046] (3) Use K-means clustering algorithm to segment the image, such as Figure 2 As shown; Step 1: According to the maximization and minimization principle, select K data points as the initial class centers for K subclass divisions. Step 2: Calculate the Euclidean distance from each data point to the class center, and divide it into subclasses represented by each class center according to the nearest neighbor principle to obtain K subclass data sets. Step 3: Calculate the average value of each point in each subclass data set, and use the average value as the new class center of the subclass. Step 4: Calculate the sum S of the Euclidean distances of all data points to the class center of the class to which they belong, and determine whether the values of the class center and S have changed. If yes, go to Step 2; if not, go to Step 5. Step 5: Terminate the iteration and the algorithm ends.
[0047] (4) Match the segmented images. In SURF feature vector matching, the Best Bin First (BBF) method is usually used. Assume that A = (x l1 ,x l2 ,L,x ln ) and B=(x r1 ,x r2 ,L,x rn ) are the pair of feature vectors to be matched on the left and right images of the binocular camera. Then the Euclidean distance of the pair of matching points is
[0048]
[0049] D1 in formula (2) is called the nearest Euclidean distance;
[0050] Among them, x li is the feature to be matched on the left image, x ri is the feature to be matched on the right image.
[0051] Assuming that the Euclidean distance between vector C and A is second to that between vector B, it is called the second closest Euclidean distance D2, and the ratio η between the two is
[0052]
[0053] Among them, D1 is called the closest Euclidean distance, D2 is the second closest Euclidean distance, and the ratio of the two is η
[0054] The present invention uses a high threshold matching of η=0.8. When it is less than the threshold, it is determined as a matching point. Although the improved SURF description feature vector proposed in this section improves the number and accuracy of matches, mismatches are inevitable in the BBF high threshold matching process. In order to ensure that the number of matching point pairs meets the requirements of moving target positioning, it is necessary to ensure that the matching accuracy rate eventually reaches 100%. After completing the high threshold matching of the BBF algorithm, the Random Sample Consensus (RANSAC) algorithm is finally used to remove the mismatched points.
[0055] (5) Finally, the target edge algorithm is used to calculate the centroid and locate the centroid of the workpiece in the left and right images. The three-dimensional reconstruction is combined with the camera calibration results to achieve the spatial positioning of the workpiece.
[0056] The binocular vision camera used to collect images can be approximated as a binocular parallel vision system without considering lens distortion. The size of a single pixel is 3.0 μm × 3.0 μm, and the focal length is 3.1 mm. The focal length, image center point and other parameters of the two cameras in this system are the same. The imaging model is as follows: Figure 3 shown.
[0057] Assume the pixel coordinates of the left and right centroids in the image are p l (u l ,v l ), p r (u r ,v r ), the coordinate system of the left camera is defined as the world coordinate system, then the coordinates of point P in this coordinate system are (x, y, z), and the coordinates in the right camera coordinate system are (xb, y, z), then the positioning result can be obtained:
[0058]
[0059] In formula (4), (u0, v0) is the coordinate of the principal point, (fx ,f y ) is the effective focal length. The above parameters are obtained through camera calibration. b is the length of the baseline, from which the three-dimensional coordinates (x, y, z) of point P can be determined.
[0060] Among them, p l is the pixel coordinate of the left centroid in the image, u l is the horizontal coordinate of the pixel, v l is the vertical coordinate of the pixel,
[0061] p r is the pixel coordinate of the right centroid in the image, u r is the horizontal coordinate of the pixel, v r is the vertical coordinate of the pixel,
[0062] u0 is the abscissa of the main point, v0 is the ordinate of the main point,
[0063] b is the length of the baseline,
[0064] f x is the horizontal coordinate of the effective focal length, f y is the vertical coordinate of the effective focal length.
[0065] In order to verify the improved image matching algorithm of the present invention, the images collected by the binocular vision system were used to verify and compare the classic SURF image matching algorithm, the improved algorithm in the literature 5 [A Robust Subset-ICP Method for Point Set Registration] and the improved algorithm of this paper. The matching results are shown in Figure 2. Figures 4 to 6 And as shown in Table 1.
[0066] Table 1 Comparison of matching results of three algorithms
[0067]
[0068] Since the reconstruction accuracy of the 3D scanner is very high, reaching 0.02mm, the PCB is reconstructed by the 3D scanner and used as a reference model. The 3D deviation of the PCB model reconstructed by the traditional surf algorithm is compared with the reference model to generate Figure 7 and Figure 8 .
[0069] Table 2 PCB 3D point cloud reconstruction
[0070]
[0071]
[0072] In order to quantitatively calculate the accuracy of the reconstruction algorithm, the maximum distance, average distance and standard deviation between the PCB model reconstructed by the traditional surf algorithm and the reference model are listed. Similarly, the maximum distance, average distance and standard deviation between the PCB model reconstructed by the optimized surf algorithm and the reference model are listed, as shown in Tables 1 and 2. By comparing the experimental results, it can be seen that the optimized surf algorithm has higher accuracy and less time-consuming in reconstructing PCBs.
[0073] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. An electronic component positioning method based on an improved SURF algorithm, characterized in that: The steps include: S1: The images of electronic components on the production line are acquired through a binocular camera, and then input into a computer for image preprocessing to eliminate the effects of light and noise in image acquisition; S2: Use the SURF algorithm to detect and describe the feature points of the workpiece image; use the principal component analysis algorithm PCA to reduce the dimension of the feature point descriptor of the image, including the following process: In order to improve the computational efficiency, the principal component analysis algorithm PCA is applied to feature point detection and reduce the dimension of features. The 64-dimensional SURF descriptor of the obtained feature points is divided, and the sample matrix is recorded as [x1, x2, …, x n ] T , de-center the sample and get the difference vector: Where, d i is the difference vector, n is the number of feature points, x i is the 64-dimensional descriptor of the i-th feature point; construct the covariance matrix and find the 64 eigenvalues λ i and the eigenvector e i , and i and the corresponding e i Arrange them in descending order, take the first 32 eigenvectors in the order of arrangement, standardize them, and form the eigenvector matrix W. For each sample x i , converted into a new sample, denoted as z i =W T x i , reducing the original 64-dimensional SURF feature descriptor to 32 dimensions; S3: Use K-means clustering algorithm to segment the image; the segmentation process is: Step 1: According to the principle of maximization and minimization, select K data points as the initial class centers for K subclass divisions; suppose the data set consisting of n data points is X = {x i |x i ∈R d ,i=1,2,…,n}, each data point x i is a vector composed of d data that represent its characteristics; the goal of K-means clustering is to divide these n data points into K categories to form a cluster set E = {e k |k=1,2,…,K}, where e k The class center of the class is set to O k ; Step 2: Calculate the Euclidean distance from each data point to the class center, and divide it into subclasses represented by each class center according to the nearest neighbor principle to obtain K subclass data sets; define the data points divided into e k Point x of class i To the class center O k The Euclidean distance is: Suppose the data set consisting of n data points is X = {x i |x i ∈R d ,i=1,2,...,n}, each data point x i It is a vector composed of d data that characterize its characteristics. The goal of K-means clustering is to divide these n data points into K categories to form a cluster set C = {ck|k = 1,2,...,k}, where c k The class center of the class is set to μ k , the definition is divided into c k Point x of class i The cluster center μ k The Euclidean distance of Step 3: Calculate the average value of each point in each subclass data set and use the average value as the new class center of the subclass; Step 4: Calculate the sum of the Euclidean distances of all data points to the class center of their class, and determine whether the value of the sum of the class center has changed. If yes, go to step 2; if not, go to step 5; All are divided into e k Point x of class i Go to the class center O of this class k The sum of the Euclidean distances is Among them, e k is the kth subclass, x i is the data point, O k for e k the class center of the class; The statistics in the formula are the k-th subclass O in the cluster set E. k The sum of the Euclidean distances from the points in the cluster to the center of the cluster; then, by counting each subclass in the cluster, we can get the sum of the Euclidean distances of all points x in the data set. i The sum of the Euclidean distances to the class center of the class to which it belongs; in, It can be seen that in order to minimize the value of S(xi) in the formula, the cluster center O k The cluster subset e should be taken k The average value of each data point in ; Among them, e k is the kth subclass, x i is the data point, O k for e k The class center of the class, M(e k ) for all the k Point x of class i Go to the class center O of this class k The sum of the Euclidean distances, D(x i ,O k ) is divided into e k Point x of class i To the class center O k The Euclidean distance, λ i is the variable coefficient; Step 5: Terminate the iteration and the algorithm ends; S4: Match the segmented images; S5: The target edge algorithm is used to calculate the centroid, locate the centroid position of the workpiece in the left and right images, and perform three-dimensional reconstruction based on the camera calibration results to achieve spatial positioning of the workpiece.
Citation Information
Patent Citations
A fast matching algorithm for image feature points in printed circuit board detection
CN109472770A
Electronic component positioning and detecting method based on SURF feature matching
CN110706293A