A visual detection-based alignment and bonding method, system and medium
By using template matching and angle compensation calculation, high-precision alignment and bonding in large workpiece scenarios is achieved, solving the problem of insufficient precision in existing technologies and improving production efficiency and robustness.
Patent Information
- Application Number
- CN202211661868.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-12-23
AI Technical Summary
Existing alignment and bonding methods have poor accuracy in large workpiece scenarios, resulting in low production efficiency. Furthermore, the differences in shape and size of different workpieces lead to insufficient robustness, making them difficult to apply in actual production.
By acquiring workpiece images, performing template matching, calculating new reference point information, and performing point rotation, translation, and position compensation, combined with the OPTICS clustering method to calculate angle compensation values, precise alignment and bonding are achieved using a vision inspection system and a robotic arm.
It improves the fitting accuracy and robustness in large workpiece scenarios, and can better adapt to different workpiece shapes and sizes, thereby enhancing production efficiency.
Smart Images

Figure CN115847417B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automation production, and in particular to a visual detection-based alignment and bonding method, system and medium. BACKGROUND
[0002] The alignment and bonding method is an automatic production technology combining machine vision and motion control, and is widely used in product assembly and packaging in various industries. With the increasing development of automation technology, the alignment and bonding method is increasingly applied in workpiece production.
[0003] Existing alignment and bonding methods are almost related to specific industry applications, such as packaging of paper boxes and bonding of steel sheets. In different industries, the shapes, sizes and poses of different workpieces are not the same, which makes the robustness of these special visual alignment systems poor, and the resulting deviation is also large, which cannot be well applied to actual production, so it is necessary to suppress or eliminate such errors.
[0004] Most alignment and bonding related methods are generally for smaller workpieces, and can directly obtain the overall appearance of the workpiece in the vision system, so the entire visual alignment and bonding process can be better completed, but for larger workpieces, the workpiece outside the vision system cannot be accurately aligned, and zooming out the lens will inevitably lead to poor bonding precision, which also brings certain difficulties to the alignment and bonding method in the large workpiece scenario, and the precision cannot be guaranteed, which will have a series of effects on subsequent workpiece production and assembly, and reduce the production efficiency. SUMMARY
[0005] The purpose of the present application is to provide a visual detection-based alignment and bonding method, system and medium with high bonding precision.
[0006] To solve the above technical problems, the technical scheme of the present application is as follows:
[0007] In a first aspect, a visual detection-based alignment and bonding method is provided, comprising
[0008] S100: obtaining a pre-stored workpiece template after obtaining a workpiece image;
[0009] S200: obtaining an image of a target workpiece;
[0010] S300: template matching on the target workpiece image to obtain new reference point position information of the target workpiece;
[0011] S400: performing corresponding point position rotation, translation and position compensation calculation based on the new reference point as a target point to obtain final workpiece bonding point position information and output, and performing alignment and bonding.
[0012] Further, in step S100, a workpiece image is acquired. First, the search area is manually set, and then one or more standard workpiece templates are manually selected in the search area. The templates are trained and the template data is saved.
[0013] Furthermore, step S300 specifically includes:
[0014] The template matching operation is performed according to the template matching method to determine the template matching feature points in the image. Based on the spatial position information of these feature points in the image, the bounding rectangle is determined. The position information of the center point of the bounding rectangle is calculated, which is the reference point information of the target workpiece.
[0015] The template matching algorithm specifically includes: determining the detection area, determining the feature points used for template matching, and determining whether the workpiece is in place based on the template workpiece reference point information of these feature points.
[0016] Further, step S400 includes:
[0017] S410: Single-point alignment calculation of the original datum point and the new datum point, calculate the angular tolerance value of the template workpiece and the target workpiece, then calculate the angular compensation value to obtain the actual angular tolerance value of the template workpiece and the target workpiece;
[0018] S420: Calculate the rotation center of the point, obtain the rotation direction, and then perform rotation calculation on the reference point of the template workpiece based on the angle tolerance value, the rotation center of the point, and the rotation direction to obtain the position information after rotation;
[0019] S430: Calculate the point tolerance based on the position information of the template workpiece reference point after rotation and the position information of the target workpiece reference point to obtain the workpiece translation tolerance value;
[0020] S440: Calculates the position of the contact point of the target workpiece based on the angular tolerance value, rotation direction and translation tolerance value, and outputs the position information.
[0021] Further, in step S410, the method for calculating the angle compensation value is as follows: the OPTICS clustering method is used to cluster the set of compensation values generated each time, and the cluster center of the compensation value set is found, which is the required angle compensation value; specifically:
[0022] Representing the set of all angle compensation values as a sample set x θ ∈X θ Given a density's neighborhood radius ε and a neighborhood density threshold M, i.e., M points common to that density radius; make x θ The smallest neighborhood radius of the core point is called x. θ Core distance cd(x) θ ), represented as:
[0023]
[0024] wherein, denotes the nearest neighbor node of the node x ε in the set N θ (x θ ) if x θ is the core point, and there must be cd(x θ )≤ε; wherein denotes the Euclidean distance between two points;
[0025] The above formula means that if a neighborhood point is greater than the set density threshold, the current neighborhood point is discarded, and if the neighborhood point is within the density threshold, the Euclidean distance between the current neighborhood point and the node is calculated;
[0026] For the deviation problem, since the deviation value is relatively concentrated, the density is large, and the difference between the set elements is small, when using the clustering method, the minimum reachable distance is used for calculation, which is represented as:
[0027]
[0028] wherein, rd(x θ ,y θ ) represents the minimum radius that the core point x θ to another point y ε in the set N θ (x θ ) satisfies the reachable distance, and min(cd(),d()) represents the minimum value of the core distance and the Euclidean distance between two points;
[0029] The above formula means that if a neighborhood point is greater than the density threshold, the current neighborhood point is not calculated, and if it is in the neighborhood density, the Euclidean distance between the current neighborhood point and the current core point is calculated, and compared with the core distance of the current core point, and the smaller value is taken, and the minimum reachable distance is updated until all reachable distances are obtained;
[0030] Given the neighborhood radius ε and the neighborhood density threshold M, the M points inside ε are taken as the same category, and in the case of setting the radius ε, each element x ε in the set N θ (x θ ) is found by traversal, and the minimum radius ε when the density is M when the point P is taken as the clustering center, and the value represented by the point P at this time is the required angle compensation value θ 补 .
[0031] Further, step S420 comprises:
[0032] S421: Calculate a new reference point rotation center based on the rotation center point at the calibration time;
[0033] S422: Calculate the rotation direction; when the matching feature point angle during template matching is consistent with the input angle, the rotation direction is 1, otherwise the rotation direction is -1;
[0034] S423: In the reference point rotation transformation, the actual angle tolerance value is taken as the rotation angle, and the point rotation calculation is performed based on the reference point rotation center, the rotation direction and the rotation angle to obtain the position information of the template workpiece reference point after rotation.
[0035] Further, step S430 comprises:
[0036] S431: The target workpiece reference point found by using template matching is used to obtain the target workpiece reference point position information;
[0037] S432: A workpiece translation compensation value is preset;
[0038] S433: Calculate the difference between the target workpiece reference point position information and the position information of the template workpiece reference point after rotation and compensate by using the workpiece translation compensation value to obtain the workpiece translation tolerance.
[0039] Further, in step S440, the teaching fitting point coordinate information, i.e. the robot coordinate of the template workpiece standard fitting posture, is obtained; the translation tolerance value is compensated into the XY axis coordinate information of the teaching fitting point, the workpiece translation compensation value is compensated into the Z axis coordinate information of the teaching fitting point, and the angle tolerance value and the rotation direction are compensated into the rotation angle information around the Z axis of the world coordinate system to obtain the final point position information.
[0040] In a second aspect, a visual detection-based alignment fitting system is provided, comprising an industrial camera, a conveyor belt, a robot and an industrial computer;
[0041] The industrial camera is arranged above the workpiece and is used to collect workpiece images;
[0042] The conveyor belt is used to place the lower workpiece;
[0043] The robot is used to clamp the upper workpiece to make the upper workpiece fit the lower workpiece;
[0044] The industrial computer is used to control the industrial camera and the robot, and the industrial computer is used to implement the above-mentioned visual detection-based alignment fitting method.
[0045] In a third aspect, a computer readable storage medium having a computer program stored thereon is provided, and the computer program is executed by a processor to implement the above-mentioned visual detection-based alignment fitting method.
[0046] The present application has the following advantages:
[0047] The present application carries out template matching on the target workpiece image, obtains new reference point position information of the target workpiece, carries out corresponding point position rotation, translation and position compensation calculation for the target point based on the new reference point, obtains the final workpiece fitting point position information and outputs, and carries out alignment fitting; the present application includes the angle compensation value in the rotation coordinate conversion, and the compensation value also follows the rotation conversion and translation principle in the conversion, this method can effectively suppress the error, improves the accuracy and robustness of the workpiece fitting in different scenes, and can be more easily applied to various fields. BRIEF DESCRIPTION OF DRAWINGS
[0048] Figure 1 The flowchart of the fitting method of the present application is shown in the figure;
[0049] Figure 2 The specific flowchart of the fitting method of the present application is shown in the figure;
[0050] Figure 3 The principle diagram of the fitting method of the present application is shown in the figure;
[0051] Figure 4 The principle diagram of the core distance in the fitting method of the present application is shown in the figure;
[0052] Figure 5 The device connection diagram of the workpiece positioning and fitting system based on visual detection of the present application is shown in the figure.
[0053] The figure shows the following: 1, a bar light source; 2, an industrial camera; 3, a conveyor belt; 4, an upper workpiece; 5, a lower workpiece; 6, a mechanical hand; 7, a first network cable; 8, an industrial computer; 9, a display; 10, a second network cable; 11, a demonstration fitting point; 12, a template workpiece reference point; 13, a template feature; 14, a template workpiece; 15, a target workpiece reference point; 16, a target workpiece; 17, a mechanical hand; 18, a target workpiece fitting point; 19, a camera calibration starting point. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application is further described in detail below with reference to the figures and specific embodiments.
[0055] Please refer to Figure 1 The present application provides a visual detection-based alignment fitting method, which comprises:
[0056] S100: obtaining a pre-stored workpiece template after obtaining a workpiece image;
[0057] S200: obtaining an image of a target workpiece;
[0058] S300: carrying out template matching on the target workpiece image to obtain new reference point position information of the target workpiece;
[0059] S400: Based on the new reference point, the corresponding point rotation, translation and position compensation calculation is carried out for the target point, the final workpiece fitting point information is obtained and output, and the alignment fitting is carried out.
[0060] Specifically, the present application compensates and optimizes the conversion of rotation angle and the offset of position, mainly uses clustering calculation compensation value for angle offset and position offset in the running process, finds the angle compensation value and the position compensation, and is used for compensating the deviation generated in the calibration; the method for calculating the deviation of the present application is to automatically calculate the compensation value of the angle and the position in the calibration process. In the scene of multiple cameras and multiple mechanical hands, the mechanical hand under each camera can automatically adjust the compensation value in the actual situation due to the addition of the deviation value of the angle and the displacement, and it is not necessary to unify the coordinate system, and only the pre-assembly of the fitting device of the present application is needed to complete the respective fitting positions.
[0061] The steps in Figure 1 will be described in detail below.
[0062] In step S100, the workpiece template is pre-stored after the workpiece image is acquired.
[0063] Specifically, an industrial camera is used to acquire a workpiece image, and when the image acquisition is completed and transmitted to the workpiece fitting algorithm. In the algorithm process, first, the search area is manually set, and one or more standard templates are manually selected in the search area by using the graphical interface, the template is trained and the template data is saved, and the trained workpiece visual detection template is called by the subsequent algorithm.
[0064] In step S300, the template matching is performed on the target workpiece image to obtain the new reference point position information of the target workpiece.
[0065] Specifically, the template matching operation is performed according to the template matching method in the visual detection method, the template matching feature points of the workpiece in the image are determined, and then the reference points of the workpiece are calculated according to the matching points. Specifically, the center point position information of the circumscribed rectangle is determined according to the spatial position information of the feature points on the image, that is, the reference point information of the target workpiece.
[0066] The template matching algorithm specifically includes: determining the detection area, determining the feature points for template matching, and determining whether the workpiece is in place based on the template workpiece reference point information of the feature points.
[0067] In step S400, based on the new reference point, the corresponding point rotation, translation and position compensation calculation is carried out for the target point, the final workpiece fitting point information is obtained and output, and the alignment fitting is carried out.
[0068] Further, the step S400 comprises:
[0069] S410: single-point alignment calculation of the original reference point and the new reference point, calculation of the angle tolerance value of the template workpiece and the target workpiece, recalculation of the angle compensation value, and obtaining of the actual angle tolerance value of the template workpiece and the target workpiece;
[0070] S420: calculation of a point rotation center, obtaining of a rotation direction, and then performing template workpiece reference point rotation calculation based on the angle tolerance value, the point rotation center, and the rotation direction to obtain position information after rotation;
[0071] S430: point tolerance calculation based on the position information of the template workpiece reference point after rotation and the position information of the target workpiece reference point to obtain a workpiece translation tolerance value;
[0072] S440: point position calculation of the target workpiece fitting point based on the angle tolerance value, the rotation direction, and the translation tolerance value and output of point position information.
[0073] In one embodiment, the method provided by the application comprises the following in the step S410:
[0074] All angle compensation value sets are expressed as a sample set x θ ∈X θ , a given density neighborhood radius ε and a neighborhood density threshold M, i.e. M common points in the density radius; make x θ The minimum neighborhood radius of the core point is called the core distance cd(x θ ) of x θ , which is expressed as:
[0075]
[0076] Among them, represents the i-th nearest neighbor node of node x ε in the set N θ (x θ ), if x θ is the core point, then cd(x θ )≤ε must be satisfied; wherein represents the Euclidean distance between two points;
[0077] The above formula means: if a neighborhood point is greater than the set density threshold, discard the current neighborhood point, if the neighborhood point is within the density threshold, calculate the Euclidean distance between the current neighborhood point and the node;
[0078] For the bias problem, since the bias values are relatively concentrated, have a high density, and the differences between set elements are small, the minimum reachability distance is used for calculation when using clustering methods, expressed as:
[0079]
[0080] Where, rd(x) θ ,y θ ) represents x θ From the core point to the set N ε (x θ Another point y in ) θ The minimum radius that the reachable distance satisfies, min(cd(),d()) represents the minimum value of the core distance and the Euclidean distance between the two points;
[0081] The above formula means: if a neighboring point is greater than the density threshold, then the current neighboring point is not calculated; if it is within the neighborhood density, then the Euclidean distance between the current neighboring point and the current core point is calculated and compared with the core distance of the current core point. The smaller value is taken, and the minimum reachable distance is updated until all reachable distances are found. This can be expressed as follows: Figure 4 As shown; assuming a density of 4 and a radius of ε, then the four points within ε can be considered as belonging to the same category. This value is based on the set N with a radius of ε (i.e., the core distance). ε (x θ Each element x in ) θ By iterating through the cluster, we find the minimum radius ε (calculated using Euclidean distance) when the density is 4, with point P as the cluster center. The value represented by point P at this point is the compensation value θ required in this invention. 补 .
[0082] Single-point alignment calculation is used to calculate the positional tolerance between two known points (in the same coordinate system). By performing single-point alignment calculations on the template workpiece reference point and the target workpiece reference point, the angular tolerance value Δθ between them is obtained. Then, an angular compensation value (which needs to be manually set in special cases) θ is added. 补 The actual angular tolerance value θ between the template workpiece and the target workpiece is obtained.
[0083] In one embodiment, the method step S420 provided by the present invention includes:
[0084] S421: Calculate the new reference point rotation center based on the rotation center point during calibration;
[0085] like Figure 3 As shown, the robot coordinates P of the standard bonding posture of the template workpiece, recorded when creating the template workpiece 14, are the teaching bonding point 11. 11(X, Y, Z, R), the camera calibration starting point 19, that is, the coordinates P of the manipulator at the beginning of camera calibration 19 (X, Y, Z, R), wherein X, Y and Z represent the world coordinate system, and R represents the rotation angle around the Z axis of the world coordinate system.
[0086] Considering that the teaching fitting point 11 and the camera calibration starting point 19 exist in the case of point coincidence and non-coincidence, the reference point rotation center calculation formula is:
[0087] (x0, y0) = P 11 (X, Y) - P 19 (X, Y)
[0088] S422: Calculate the rotation direction alpha; when the matching feature point angle in template matching is consistent with the input angle, the rotation direction alpha is 1, otherwise the rotation direction alpha is -1;
[0089] S423: In the reference point rotation transformation, the actual angle tolerance value is taken as the rotation angle, and the point rotation calculation is carried out based on the reference point rotation center, the rotation direction and the rotation angle, to obtain the position information of the template workpiece reference point after rotation. Specifically:
[0090] The workpiece positioning and fitting method used in the application follows the principle of first rotation transformation and then translation transformation in the calculation of workpiece fitting point information, and the angle compensation value (the workpiece fitting angle compensation value set artificially in special cases) θ 补 is contained in the rotation transformation. In the reference point rotation transformation, the rotation angle is Δθ+θ 补 , the rotation center is (x0, y0), and the rotation direction is alpha, so the point rotation formula is as follows, and the position information P' 12 of the template workpiece reference point 12 (P 12 (X, Y)) after rotation is:
[0091] P' 12 (X) = (P 12 (X) - x0) * cos(alpha * (Delta theta + theta 补 )) - (P 12 (Y) - y0) * sin(alpha * (Delta theta + theta 补 )) + x0
[0092] P' 12 (Y) = (P 12 (X) - x0) * sin(alpha * (Delta theta + theta 补 )) + (P 12 (Y) - y0) * cos(alpha * (Delta theta + theta 补 )) + y0
[0093] In one embodiment, the method provided by the present application comprises the following step S430:
[0094] S431: find the target workpiece reference point 15 using template matching, and obtain the target workpiece reference point position information P 15 (X, Y); S432: preset workpiece translation compensation value;
[0095] S433: calculate the difference between the target workpiece reference point position information and the position information of the template workpiece reference point after rotation, and compensate using the workpiece translation compensation value to obtain the workpiece translation tolerance; the workpiece translation tolerance is calculated according to the following formula:
[0096] ΔX = P 15 (X) - P' 12 (X) + X 补
[0097] ΔY = P 15 (Y) - P' 12 (Y) + Y 补
[0098] In the formula, X 补 , Y 补 , and Z 补 are the workpiece translation compensation values set by the user in special cases.
[0099] In one embodiment, the method provided by the present application comprises the following step S440:
[0100] Obtain the teaching fitting point coordinate information, i.e., the robot coordinate of the template workpiece standard fitting posture; compensate the XY axis coordinate information of the teaching fitting point by the translation tolerance value, compensate the Z axis coordinate information of the teaching fitting point by the workpiece translation compensation value, and compensate the rotation angle information around the Z axis of the world coordinate system by the angle tolerance value and the rotation direction, to obtain the final point position information. Specifically, the angle tolerance between the target workpiece 16 and the template workpiece 14 is Δθ + θ 补 , the direction is α, and the translation tolerance is (ΔX, ΔY). The position information of the target workpiece fitting point 18 calculated is:
[0101] (ΔX + P 11 (X), ΔY + P 11 (Y), P 11 (Z) + Z 补 , P 11 (R) + α*(Δθ + θ 补 ))
[0102] In the teaching point position cooperative scene requiring the use of multiple positions, the above method needs to be applied to the transformation of each point position, and the transformed new fitting point is taken as the final fitting point of each position.
[0103] Referring to Figure 5 The application also provides a visual detection-based alignment and bonding system, comprising an industrial camera 2, a conveying belt 3, a mechanical hand 6 and an industrial computer 8.
[0104] The industrial camera 3 is arranged above the workpiece and is used to collect the image of the workpiece.
[0105] The conveying belt 3 is used to place the lower workpiece 5.
[0106] The mechanical hand 6 is used to clamp the upper workpiece 4 so as to bond the upper workpiece 4 to the lower workpiece 5.
[0107] The industrial computer 8 is used to control the industrial camera 2 and the mechanical hand 6.
[0108] The bonding system further comprises a bar light source 1 arranged above the industrial camera 2, a display 9 connected to the industrial computer 8, a first network cable 7 used to connect the industrial computer 8 and the mechanical hand 6, and a second network cable 10 used to connect the industrial computer 8 and the industrial camera 2.
[0109] The industrial computer 8 is used to realize the visual detection-based alignment and bonding method.
[0110] In this embodiment, firstly, an image of a workpiece is acquired by the industrial camera, then a workpiece template is selected by using a graphical interface, and the template is trained and template data is saved. In the workpiece bonding stage, the workpiece is transported to a suitable position in the camera field of view by the conveying belt; when the lower workpiece 5 is moved to the camera field of view of the industrial camera 2 by the conveying belt 3, the industrial camera 2 triggers photographing and sends the acquired image to the industrial computer 8 through the second network cable 10; after receiving the image, the template matching is performed according to the established visual detection template, and the new reference point position information is calculated according to the matching result, and the corresponding point position rotation, translation and position compensation calculation are performed with the reference point as the target point, and finally the calculated workpiece bonding point coordinate information is obtained; the coordinate information is converted between the pixel coordinate system, the image coordinate system and the world coordinate system to obtain the final bonding point position information. After obtaining the bonding point position information, the industrial computer 8 sends the bonding point position information to the mechanical hand 6 through the first network cable 7, and then the upper workpiece 4 is moved to the bonding point position by the mechanical hand 6 to bond the upper workpiece 4 and the lower workpiece 5, thus the whole visual detection and alignment and bonding process is completed, and the visual detection-based workpiece alignment and bonding action is completed.
[0111] In the determination of the point position, the present application utilizes the angle tolerance value and the angle compensation value between the template workpiece reference point and the target workpiece reference point to obtain the actual angle tolerance between the template workpiece and the target workpiece, which is to compensate for the errors generated by the robot zero, the conveyor control, the encoder and the like. In the alignment and bonding system of the present application, the error is relatively fixed, and when the system is deployed, the coordinate deviation value is recorded by multiple bonding, the coordinates returned by the controller and the actual coordinates of the workpiece position, and the compensation value of the angle and the offset can be automatically obtained by clustering these deviation values. If the bonding is accurate, the clustering result is basically 0, and the compensation angle is 0, which indicates that the system has been applied in the current environment. In addition, if the angle compensation value is not calculated correctly in a bad environment or special situation, it can be manually set to ensure its effectiveness. The present application includes the angle compensation value in the rotation coordinate transformation, and the compensation value also follows the rotation transformation and translation principle in the conversion. This method can effectively suppress errors and improve the accuracy and robustness of workpiece bonding in different scenarios, and can be more easily applied to various fields.
[0112] To cope with the size of workpieces in different industries, the present application can use multiple templates to train different parts of the workpiece, obtain different bonding points from different position templates, and solve the alignment and bonding problem of workpieces of different sizes, further enhancing the use range of the present application in different fields. When facing large workpieces, due to the field of view limitation of the industrial camera, the entire workpiece cannot be mapped into an image, in order to solve this problem, the present application can use different templates at different positions of the workpiece, use multiple templates for multiple position bonding points of the workpiece, each point is applied to the rotation and translation rules of the point position as described above, to obtain bonding points at different positions, and use multiple position robots to move the workpiece, the present application can solve the problem of inapplicability caused by the size of the workpiece. At the same time, for the dual-camera application scenario, multiple workpieces on the conveyor belt are bonded at the same time, and the two cameras and the robot can run in parallel.
[0113] In another embodiment, the present application also provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the above-mentioned alignment and bonding method based on visual detection.
[0114] The parts not involved in the present application are the same as or realized by using the prior art.
[0115] The above is a further detailed description of the present application in combination with specific embodiments, and the specific implementation of the present application cannot be limited to these descriptions. For ordinary skilled persons in the technical field to which the present application belongs, without departing from the concept of the present application, a number of simple deductions or substitutions can be made, which should be regarded as falling within the protection scope of the present application.
Claims
1. A visual inspection based alignment and bonding method, characterized in that: Comprising S100: obtaining a workpiece image, pre-storing a workpiece template; S200: obtaining an image of a target workpiece; S300: template matching on the target workpiece image to obtain new reference point position information of the target workpiece; comprising: According to the template matching method, the template matching operation is performed, the template matching feature points in the image are determined, and the circumscribed rectangle of the feature points in the image is determined according to the spatial position information of the feature points in the image. The center point position information of the circumscribed rectangle is calculated, that is, the reference point information of the target workpiece; Wherein, the template matching algorithm specifically comprises: determining a detection area, determining feature points for template matching, and determining whether the workpiece is in place based on the feature points and the template workpiece reference point information; S400: based on the new reference point, corresponding point rotation, translation and position compensation calculation is performed for the target point, the final workpiece fitting point position information is obtained and output, and the alignment and fitting are performed, comprising: S410: single point alignment calculation of the original reference point and the new reference point, calculation of the angle tolerance value of the template workpiece and the target workpiece, and then calculation of the angle compensation value to obtain the actual angle tolerance value of the template workpiece and the target workpiece; S420: calculate the point rotation center, obtain the rotation direction, and then perform template workpiece reference point rotation calculation based on the angle tolerance value, point rotation center and rotation direction to obtain the position information after rotation; S430: based on the position information of the template workpiece reference point after rotation and the position information of the target workpiece reference point, point tolerance calculation is performed to obtain the workpiece translation tolerance value; S440: based on the angle tolerance value, the rotation direction and the translation tolerance value, the point position of the target workpiece fitting point is calculated and the point position information is output; In the workpiece fitting stage, the workpiece is transported to the appropriate position in the camera field of view by the conveying belt; when the lower workpiece moves to the camera field of view of the industrial camera through the conveying belt, the industrial camera triggers the shooting and sends the obtained image to the industrial computer. After receiving the image, the template matching is performed according to the established visual detection template, and the new reference point position information is calculated according to the matching result. The corresponding point rotation, translation and position compensation calculation are performed with the reference point as the target point. Finally, the calculated workpiece fitting point coordinate information is obtained. Through the conversion between the pixel coordinate system, the image coordinate system and the world coordinate system, the final fitting point position information is obtained. After obtaining the fitting point position information, the industrial computer sends the fitting point position information to the manipulator, and then moves the upper workpiece to the fitting point position through the manipulator to fit the upper workpiece and the lower workpiece. Thus, the whole visual detection and alignment fitting process is completed, and the workpiece alignment and fitting action based on visual detection is completed.
2. The visual inspection-based alignment and bonding method according to claim 1, characterized in that: In step S100, one workpiece image is obtained. First, the search area is manually set, and then one or more standard workpiece templates are manually selected in the search area. The template is trained and the template data is saved.
3. The visual inspection based alignment and bonding method according to claim 1, wherein: In step S410, the method for calculating the angle compensation value is: using the OPTICS clustering method to cluster each generated compensation value set to find the clustering center of the compensation value set, which is the required angle compensation value; specifically: Let all the angle compensation values be represented as a sample set x θ ∈ X θ , given a density neighborhood radius ε and a neighborhood density threshold M, i.e. there are M points in the density neighborhood; let x θ be the core distance of x θ , denoted as cd(x θ ). wherein, denotes the nearest neighbor of node x ε (x θ ) in the set N θ if x θ is the core point, then there must be cd(x θ )≤ε; wherein denotes the Euclidean distance between two points; The formula means that if a neighborhood point is greater than the set density threshold, the current neighborhood point is discarded, and if the neighborhood point is within the density threshold, the Euclidean distance between the current neighborhood point and the node is calculated; For the deviation problem, since the deviation values are relatively concentrated, the density is large, and the difference between the set elements is small, when using the clustering method, the minimum reachable distance is used for calculation, which is represented as: wherein rd(x θ ,y θ ) denotes the minimum radius of the reachable distance from the core point x θ to another point y ε in the set N θ (x θ ), and min(cd(),d()) denotes the minimum value of the core distance and the Euclidean distance between the two points. The formula means that if a neighborhood point is greater than the set density threshold, the current neighborhood point is discarded, and if the neighborhood point is within the density threshold, the Euclidean distance between the current neighborhood point and the node is calculated; Given the neighborhood radius ε and the neighborhood density threshold M, M points inside ε' are taken as the same class, and the radius ε is set to the set N ε (x θ ) for each element x θ By traversing, find the minimum radius ε' when the density is M, and the value represented by the point P is the required angle compensation value θ 补 .
4. The visual inspection based alignment and bonding method according to claim 1, wherein: Step S420 includes: S421: Calculate a new reference point rotation center based on the rotation center point at the calibration time; S422: Calculate the rotation direction; when the matching feature point angle at the template matching time is consistent with the input angle, the rotation direction is 1, and vice versa, the rotation direction is -1; S423: In the reference point rotation transformation, the actual angle tolerance value is taken as the rotation angle, and the point rotation calculation is performed based on the reference point rotation center, the rotation direction and the rotation angle to obtain the position information of the template workpiece reference point after rotation.
5. The visual inspection based alignment and bonding method according to claim 1, wherein: Step S430 includes: S431: Use the target workpiece reference point found by the template matching to obtain the target workpiece reference point position information; S432: Pre-set the workpiece translation compensation value; S433: Calculate the difference between the target workpiece reference point position information and the position information of the template workpiece reference point after rotation, and compensate by using the workpiece translation compensation value to obtain the workpiece translation tolerance.
6. The visual inspection based alignment and bonding method according to claim 1, wherein: In step S440, the teaching fitting point coordinate information, i.e. the robot coordinate of the template workpiece standard fitting posture, is obtained; the translation tolerance value is compensated to the XY axis coordinate information of the teaching fitting point, the workpiece translation compensation value is compensated to the Z axis coordinate information of the teaching fitting point, and the angle tolerance value and the rotation direction are compensated to the rotation angle information around the Z axis of the world coordinate system, to obtain the final point position information.
7. A visual inspection based alignment and bonding system, characterized by: The system comprises an industrial camera, a conveyor belt, a robot and an industrial computer; The industrial camera is arranged above the workpiece and is used to collect the workpiece image; The conveyor belt is used to place the lower workpiece; The robot is used to clamp the upper workpiece to make the upper workpiece fit the lower workpiece; The industrial computer is used to control the industrial camera and the robot, and the industrial computer is used to realize the visual detection-based alignment fitting method of any one of claims 1-6.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the visual detection-based alignment fitting method of any one of claims 1-6. The computer program is executed by the processor to realize the visual detection-based alignment fitting method of any one of claims 1-6.
Citation Information
Patent Citations
A method for automatically registering bent bone fracture and pre-bending modeling of an internal fixation steel plate
CN109035311A
Visual guiding-based robot workpiece grabbing method
CN110315525A