Electronic component positioning method based on improved SURF algorithm

文档序号:154504 发布日期:2021-10-26 浏览:24次 中文

阅读说明:本技术 一种基于改进surf算法的电子元器件定位方法 (Electronic component positioning method based on improved SURF algorithm ) 是由 顾寄南 黄则栋 李静 孙晓红 唐仕喜 于 2020-10-30 设计创作,主要内容包括:本发明公开了一种基于改进SURF算法的电子元器件定位方法,包括以下步骤:1)通过双目相机获取生产线上的电子元器件图像,然后输入计算机进行图像预处理,消除图像采集中存在的光照、噪声等因素的影响;2)使用SURF算法对工件图像进行特征点检测与描述;3)采用K均值聚类算法分割图像;4)对分割后的图像进行匹配;5)最后采用目标边缘算法进行形心计算,定位出左右图像中工件的形心位置,结合摄像机的标定结果进行三维重建,实现工件的空间定位。本发明的有益效果是:提出的算法减少了算法运行总时间,将匹配的结果结合双目视觉技术实现电子元器件的定位,对智能制造水平的提高有很大的应用价值。(The invention discloses an electronic component positioning method based on an improved SURF algorithm, which comprises the following steps: 1) electronic component images on a production line are acquired through a binocular camera and then input into a computer for image preprocessing, and influences of factors such as illumination, noise and the like existing in image acquisition are eliminated; 2) detecting and describing feature points of the workpiece image by using a SURF algorithm; 3) dividing the image by adopting a K mean value clustering algorithm; 4) matching the segmented images; 5) and finally, performing centroid calculation by adopting a target edge algorithm, positioning the centroid positions of the workpieces in the left and right images, and performing three-dimensional reconstruction by combining the calibration result of the camera to realize the spatial positioning of the workpieces. The invention has the beneficial effects that: the provided algorithm reduces the total operation time of the algorithm, realizes the positioning of the electronic components by combining the matching result with the binocular vision technology, and has great application value for improving the intelligent manufacturing level.)

1. An electronic component positioning method based on an improved SURF algorithm is characterized by comprising the following steps:

s1: acquiring an electronic component image on a production line through a binocular camera, and inputting the electronic component image into a computer for image preprocessing to eliminate the influence of illumination and noise in image acquisition;

s2: detecting and describing feature points of the workpiece image by using a SURF algorithm;

s3: dividing the image by adopting a K mean value clustering algorithm;

s4: matching the segmented images;

s5: and performing centroid calculation by adopting a target edge algorithm, positioning the centroid positions of the workpieces in the left and right images, and performing three-dimensional reconstruction by combining the calibration result of the camera to realize the spatial positioning of the workpieces.

2. The method for positioning electronic components based on the improved SURF algorithm as claimed in claim 1, wherein in step S2, the Principal Component Analysis (PCA) is used to perform dimensionality reduction on the feature point descriptors of the images, and the method comprises the following steps:

in order to improve the calculation efficiency, the PCA (principal component analysis) algorithm is applied to feature point detection and feature dimension reduction, 64-dimensional SURF descriptors of the obtained feature points are divided, and a sample matrix is recorded as [ x ]1,x2,L,xn]TAnd removing the center of the sample to obtain a difference vector:

in the formula (d)iIs a difference vector, n is the number of feature points, xiA 64-dimensional descriptor being the ith feature point; constructing a covariance matrix, and solving 64 eigenvalues lambdaiAnd a feature vector eiWill be λiAnd corresponding eiArranging according to the sequence from big to small, taking the first 32 eigenvectors of the arrangement sequence to carry out standardization to form an eigenvector matrix W, and carrying out normalization on each sample xiConverted into a new sample, denoted as zi=WTxiThe original 64-dimensional SURF feature descriptor is reduced to 32-dimensional.

3. The electronic component positioning method based on the improved SURF algorithm as claimed in claim 1, wherein in step S3, the segmentation process comprises:

the first step is as follows: selecting K data points as initial class centers of K subclasses according to a maximization minimization principle; let X be { X ] for a data set consisting of n data pointsi|xi∈RdI ═ 1,2, L, n }, for each data point xiIs a vector composed of d data characterizing its features; the goal of K-means clustering is to cluster these n data pointsGrouping into K groupsk1,2, L, K, where ekClass center of class is set to Ok

The second step is that: calculating Euclidean distances from each data point to a class center, and dividing the Euclidean distances into subclasses represented by the class centers according to a nearest neighbor principle to obtain K subclass data sets; definitions are divided into ekPoint x of classiTo class center OkThe Euclidean distance of (A) is:

let X be { X ] for a data set consisting of n data pointsi|xi∈Rd1, 2.. multidot.n., each data point xiIs a vector consisting of d data characterizing it. The goal of K-means clustering is to divide the n data points into a K-class composition cluster set C ═ Ck1, 2.., k }, wherein ckClass center of class is set as μkDefinition is divided into ckPoint x of classiTo class center μkThe Euclidean distance of;

the third step: calculating the average value of each point in each subclass data set, and taking the average value as a new class center of the subclass;

the fourth step: calculating the sum of Euclidean distances from all data points to the class center of the class to which the data points belong, judging whether the values of the data points and the class center change or not, and if so, turning to the second step; if not, turning to the fifth step;

all are divided into ekPoint x of classiClass center O to this classkHas a sum of Euclidean distances ofWherein e iskIs the kth subclass, xiAs data points, OkIs ekClass center of class;

the statistic in the formula is that the kth partition subclass O in the cluster set EkThe sum of the euclidean distances of the points in (b) to the center of the class; then it is determined that,all the subclasses in the clustering set are counted once to obtain all the points x in the data setiThe sum of the Euclidean distances to the class center of the class to which it belongs;

wherein the content of the first and second substances,it follows that S (x) in the formula is to be usedi) Has the smallest value of (C), class center OkShould take the cluster subset ekAverage of each data point in;

wherein e iskIs the kth subclass, xiAs data points, OkIs ekClass center of class, M (e)k) For all being divided into ekPoint x of classiClass center O to this classkSum of Euclidean distances of D (x)i,Ok) Is divided into ekPoint x of classiTo class center OkEuclidean distance of, λiIs a variable coefficient;

the fifth step: and terminating the iteration and finishing the algorithm.

Technical Field

The invention is suitable for the field of intelligent manufacturing, and particularly relates to an electronic component positioning method based on an improved SURF algorithm.

Background

The binocular surface structured light measurement technology can accurately acquire the distribution condition of scattered parts in the space and can visually present the scattered parts in a point cloud form. The measuring method definitely establishes the relation between the two-dimensional image and the three-dimensional point cloud, can finish the identification of the target part through the image identification technology, and can accurately acquire the pose information of the part through the processing and analysis of the point cloud, so that the robot can be assisted to completely and autonomously grab the target part. The pose information of the part is a necessary condition for the robot to finish grabbing. The pose information is the relative relation between the current position of the part to be grabbed and the position of the template. And acquiring point clouds of the part to be grabbed through a three-dimensional scanning device, registering the point clouds of the part and the template point to acquire a rotation and translation matrix between the point clouds of the part and the template point, and obtaining the rotation and translation matrix as the pose of the part.

Yang Yang Yang et al, 2012 matched the key points through the matching algorithm of the image, then calculated the three-dimensional coordinate of the key point and accomplished the matching of the three-dimensional key point, finally obtained the position and orientation information through decomposing the homography matrix. The method obtains the pose of the point cloud by processing the two-dimensional image, the technical mature method is simple, but the image is easily interfered by the external environment, and the calculation result is unstable.

Hao-Yuan Kuo et al 2014 uses a depth image as input, simultaneously obtains depth images of a part under different postures, respectively extracts key points from a template and the currently obtained depth image, calculates a rotating image feature (Spin image) of the key points, then uses a RANSAC algorithm to match with the template depth image to obtain an initial registration result, and finally uses ICP to optimize the registration result.

In 2014, Jianglie and the like, a point cloud registration method based on 'two holes on one surface' is provided for common geometric elements on mechanical parts, a local coordinate system is constructed through the geometric elements, and a conversion relation between a point cloud and a template local coordinate system is obtained through element matching so as to obtain a point cloud pose. The method is reliable in pose calculation, but the extraction and matching of geometric elements have uncertainty, and mismatching is easy to occur.

Disclosure of Invention

The invention aims to solve the problems of long time, low precision and the like of workpiece positioning in the process of assembling the conventional electronic component, and provides an electronic component positioning method based on an improved SURF algorithm.

In order to achieve the above purpose, the technical solution adopted by this patent is as follows.

An electronic component positioning method based on an improved SURF algorithm comprises the following steps:

s1: acquiring an electronic component image on a production line through a binocular camera, and inputting the electronic component image into a computer for image preprocessing to eliminate the influence of illumination and noise in image acquisition;

s2: detecting and describing feature points of the workpiece image by using a SURF algorithm;

s3: dividing the image by adopting a K mean value clustering algorithm;

s4: matching the segmented images;

s5: and performing centroid calculation by adopting a target edge algorithm, positioning the centroid positions of the workpieces in the left and right images, and performing three-dimensional reconstruction by combining the calibration result of the camera to realize the spatial positioning of the workpieces.

In the above scheme, in step S2, the principal component analysis algorithm PCA is used to perform dimensionality reduction on the feature point descriptors of the image, and the method includes the following steps:

in order to improve the calculation efficiency, the PCA (principal component analysis) algorithm is applied to feature point detection and feature dimension reduction, 64-dimensional SURF descriptors of the obtained feature points are divided, and a sample matrix is recorded as [ x ]1,x2,L,xn]TAnd removing the center of the sample to obtain a difference vector:

in the formula (d)iIs a difference vector, n is the number of feature points, xiA 64-dimensional descriptor being the ith feature point; constructing a covariance matrix, and solving 64 eigenvalues lambdaiAnd a feature vector eiWill be λiAnd corresponding eiArranging according to the sequence from big to small, taking the first 32 eigenvectors of the arrangement sequence to carry out standardization to form an eigenvector matrix W, and carrying out normalization on each sample xiConverted into a new sample, denoted as zi=WTxiThe original 64-dimensional SURF feature descriptor is reduced to 32-dimensional.

In the above scheme, in step S3, the segmentation process includes:

the first step is as follows: selecting K data points as initial class centers of K subclasses according to a maximization minimization principle; let X be { X ] for a data set consisting of n data pointsi|xi∈RdI ═ 1,2, L, n }, for each data point xiIs a vector composed of d data characterizing its features; the goal of K-means clustering is to divide the n data points into a K-class composition cluster set E ═ Ek1,2, L, K, where ekClass center of class is set to Ok

The second step is that: calculating Euclidean distances from each data point to a class center, and dividing the Euclidean distances into subclasses represented by the class centers according to a nearest neighbor principle to obtain K subclass data sets; definitions are divided into ekPoint x of classiTo class center OkThe Euclidean distance of (A) is:

wherein x isiAs data points, OkIs ekClass center of class, ekIs the kth subclass, xijAs a vector characterized by the jth, OkjClass center for class j.

The third step: calculating the average value of each point in each subclass data set, and taking the average value as a new class center of the subclass;

the fourth step: calculating the sum of Euclidean distances from all data points to the class center of the class to which the data points belong, judging whether the values of the data points and the class center change or not, and if so, turning to the second step; if not, turning to the fifth step;

all are divided into ekPoint x of classiClass center O to this classkHas a sum of Euclidean distances of

Wherein e iskIs the kth subclass, xiAs data points, OkIs ekClass center of class

The statistic in the formula is that the kth partition subclass O in the cluster set EkThe sum of the euclidean distances of the points in (b) to the center of the class; then, counting each subclass in the cluster set once to obtain all points x in the data setiThe sum of the Euclidean distances to the class center of the class to which it belongs;

wherein the content of the first and second substances,it follows that S (x) in the formula is to be usedi) Has the smallest value of (C), class center OkShould take the cluster subset ekAverage of each data point in;

wherein e iskIs the kth subclass, xiAs data points, OkIs ekClass center of class, M (e)k) For all being divided into ekPoint x of classiClass center O to this classkSum of Euclidean distances of D (x)i,Ok) Is divided into ekPoint x of classiTo class center OkEuclidean distance of, λiAre variable coefficients.

The fifth step: and terminating the iteration and finishing the algorithm.

The invention has the beneficial effects that: the provided algorithm introduces PCA into the SURF algorithm, only the points with larger eigenvector values are reserved for the matching process, the total operation time of the algorithm is reduced, and meanwhile, the error matching is reduced by introducing the K-means clustering algorithm, so that the identification accuracy is further improved. The electronic components can be quickly and accurately identified and matched through the improved algorithm, the matching result is combined with the binocular vision technology to realize the positioning of the electronic components, and the method has great application value for improving the intelligent manufacturing level.

Drawings

Fig. 1 is a flow chart of a positioning algorithm.

FIG. 2 is a flow chart of a PCB image segmentation algorithm.

Fig. 3 is a binocular parallel system imaging model.

Fig. 4 shows the image stereo matching result of the conventional SURF algorithm.

Fig. 5 shows the result of stereo matching of images by the improved algorithm in the document referred to in the detailed description.

Fig. 6 shows the result of image stereo matching of the improved algorithm of the present invention.

Fig. 7 is a diagram of a PCB model reconstructed by a conventional surf algorithm and a reference model.

FIG. 8 is a diagram of a PCB model and a reference model reconstructed by the algorithm of the present invention.

Detailed Description

The invention is further described with reference to the following figures and specific examples.

The electronic component positioning method based on the improved SURF algorithm is used in the automatic assembly process of the electronic components.

As shown in fig. 1, the method of the present invention comprises the steps of: (1) electronic component images on a production line are acquired through a binocular camera and then input into a computer for image preprocessing, and influences of factors such as illumination, noise and the like existing in image acquisition are eliminated; (2) detecting and describing feature points of the workpiece image by using a SURF algorithm; the first step is as follows: a target point in a Gaussian pyramid size space constructed based on the Hessian matrix is compared with 26 adjacent position points, and if the target point is found to be the maximum value or the minimum value through comparison, the target point is considered to be a characteristic point. The second step is that: fast robustness characterization in SURF algorithms

In the acceleration steady characteristics (speed-up robust features, in SURF, the main direction of the characteristic points is solved by rotating a 60-degree sector in a circular neighborhood taking the characteristic points as the circle center at certain intervals, wherein the circular neighborhood is divided into 72 groups, every 5 degrees of the circular neighborhood is divided into one group, the sum of horizontal direction response and vertical direction response in a window is calculated and represented by a new vector, after traversal is finished, the direction of the longest vector is the main direction of the characteristic points, the main directions of all the characteristic points can be obtained only by calculating the characteristic points one by one, and the formation of the SURF algorithm characteristic descriptor is also realized by dividing a region with the size of 4 & lt 4 & gt around the characteristic points, calculating haar wavelet response with the sampling side length of 2s in the range of 5s & lt 5s (the sampling step length is taken as s) in each subregion, and counting the sum of horizontal direction and absolute value of sum of horizontal direction of sum of, And finally accumulating the sigma dx, the sigma dy, the sigma | dx and the sigma | dy | in each sub-area to form a 4-dimensional vector v.

v=(∑dx,∑dy,∑|dx|,∑|dy|) (1)

(3) Dividing the image by adopting a K-means clustering algorithm, as shown in figure 2; the first step is as follows: and selecting K data points as initial class centers of K subclasses according to a maximization minimization principle. The second step is that: and calculating Euclidean distances from the data points to the class centers, and dividing the Euclidean distances into subclasses represented by the class centers according to a nearest neighbor principle to obtain K subclass data sets. The third step: and calculating the average value of each point in each subclass data set, and taking the average value as the new class center of the subclass. The fourth step: and calculating the sum S of Euclidean distances from all the data points to the class center of the class to which the data points belong, and judging whether the values of the class center and the S are changed. If so, go to Step 2; if not, go to Step 5. The fifth step: and terminating the iteration and finishing the algorithm.

(4) Matching the segmented images; in SURF feature vector matching, a nearest neighbor euclidean distance scaling (Best Bin First, BBF) is generally used. Let A ═ xl1,xl2,L,xln) And B ═ xr1,xr2,L,xrn) A pair of feature vectors to be matched on the left image and the right image of the binocular camera respectively. The Euclidean distance of the pair of matching point pairs is

D in the formula (2)1Called the nearest euclidean distance;

wherein x isliFor features to be matched on the left image, xriIs the feature to be matched on the right image.

Assuming that the Euclidean distance between vector C and A is second closest to vector B, it is called second-closest Euclidean distance D2The ratio of the two is

Wherein D is1Called the nearest Euclidean distance, D2Is a sub-Euclidean distance, and the ratio of the two is eta

The invention selects the matching with a high threshold value of 0.8 eta, and when the threshold value is smaller than the threshold value, the matching point is determined. Although the improved SURF description feature vectors proposed in this section improve the number and accuracy of matches, it is inevitable that mismatches occur during the BBF high threshold matching process. In order to ensure that the number of the matching point pairs meets the positioning requirement of the moving target, the matching accuracy rate is required to be ensured to reach 100% finally. After the BBF algorithm high threshold matching is completed, a Random Sample Consensus (RANSAC) algorithm is finally adopted to remove mismatching points.

(5) Finally, performing centroid calculation by adopting a target edge algorithm, positioning the centroid positions of the workpieces in the left and right images, and performing three-dimensional reconstruction by combining the calibration result of the camera to realize the spatial positioning of the workpieces;

the binocular vision camera used for collecting the image can be approximated to a binocular parallel vision system without considering lens distortion, the size of a single pixel is 3.0 μm × 3.0 μm, the focal length is 3.1mm, the focal lengths, the image center points and other parameters of two cameras in the system are the same, and the imaging model is as shown in fig. 3.

Let the left and right centroids be pl(ul,vl)、pr(ur,vr) Left video cameraIf the coordinate system is defined as the world coordinate system, the coordinates of the point P in the coordinate system are (x, y, z), and the coordinates in the right camera coordinate system are (x-b, y, z), the positioning result can be obtained:

in the formula (4), (u)0,v0) As the coordinates of the principal point, (f)x,fy) The above parameters are found by calibration of the camera for the effective focal length, and b is the length of the baseline, from which the three-dimensional coordinates (x, y, z) of point P can be determined;

wherein p islIs the pixel coordinate, u, of the left centroid in the imagelIs the abscissa, v, of the pixellIs the ordinate of the pixel and is,

pris the pixel coordinate, u, of the right centroid of the imagerIs the abscissa, v, of the pixelrIs the ordinate of the pixel and is,

u0is the abscissa of the principal point, v0Is the ordinate of the principal point and is,

b is the length of the base line,

fxabscissa of effective focal length, fyIs the ordinate of the effective focal length.

In order to verify the improved image matching algorithm of the invention, the image collected by a binocular vision system is used for verifying and comparing the improved algorithm in the classic SURF image matching algorithm, document 5A Robust Subset-ICP Method for Point Set Registration and the improved algorithm in the text. The matching results are shown in fig. 4 to 6 and table 1.

TABLE 1 comparison of matching results for three algorithms

Because the reconstruction precision of the three-dimensional scanner is very high and reaches 0.02mm, the PCB is reconstructed by the three-dimensional scanner and is used as a reference model, and the PCB model reconstructed by the traditional surf algorithm and the reference model are subjected to three-dimensional deviation comparison to generate a graph 7 and a graph 8.

TABLE 2 PCB three-dimensional Point cloud reconstruction

In order to quantitatively calculate the accuracy of the reconstruction algorithm, the maximum distance, the average distance and the standard deviation between the PCB model reconstructed by the traditional surf algorithm and the reference model are listed. Also, the maximum distance, the mean distance and the standard deviation between the PCB model reconstructed by the optimization surf algorithm and the reference model are listed, as shown in tables 1 and 2. Through comparison of experimental results, the accuracy of reconstructing the PCB by the optimized surf algorithm is higher, and the time consumption is less.

The above-listed detailed description is only a specific description of a possible embodiment of the present invention, and they are not intended to limit the scope of the present invention, and equivalent embodiments or modifications made without departing from the technical spirit of the present invention should be included in the scope of the present invention.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种变化场景下的激光雷达鲁棒定位方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!