A computer vision-based automatic identification and positioning method for chip components
By combining computer vision and robotic arms, the problems of universality and recognition accuracy of existing automatic testing technologies for chip components have been solved, enabling efficient automatic testing of various types of chip components and improving testing efficiency and device protection.
Patent Information
- Application Number
- CN202211370564.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-03
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-11-03
AI Technical Summary
Existing automated testing technologies for surface mount components have poor versatility, and suffer from problems such as breakage, difficulty in polarity identification, and high rejection rates, failing to meet the needs of efficient automated testing for various models.
By employing computer vision and robotic arm-based automated testing technology, a transformation relationship between the pixel coordinate system and the robotic arm coordinate system is established, a template is constructed, and feature extraction and rotation calibration are performed to achieve automatic identification and positioning of chip components.
It enables automatic identification and positioning of chip components of various sizes and specifications, improves testing efficiency, reduces the rejection rate, and ensures the integrity of the components and the accuracy of polarity identification.
Smart Images

Figure CN115760721B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer software and automatic testing technology for chip components, and particularly to an automatic identification and positioning method for chip components based on computer vision. Background Technology
[0002] Surface mount components (SMPs) are widely used in circuits for coupling, bypassing, and filtering. Furthermore, with the miniaturization and weight reduction of electronic devices, SMPs account for an increasingly larger proportion of electronic equipment; almost all electronic products require SMPs. Today, SMPs are among the most widely used basic electronic components in the industrial field. SMPs, specifically tantalum capacitors, are a type of SMP, characterized by good sealing, small size, light weight, polarized capacitors, excellent and stable electrical performance, high reliability, long lifespan, large capacitance, and good storage stability. They are suitable for surface mount DC or pulsating circuits in military electronic equipment with reliability requirements in fields such as aerospace, aviation, weaponry, electronics, shipbuilding, and communications. Because SMPs are widely used in military electronic equipment with reliability requirements, the secondary screening of SMPs is particularly important.
[0003] The performance of surface-mount components (SMCs) directly affects the reliability of products, leading to increasingly higher demands for SMC testing across the electronics market. This is particularly true in the military equipment sector, where the screening and testing of SMCs is essential, as their quality directly impacts the reliability of military equipment. Therefore, how domestic military weaponry research and production units can efficiently conduct SMC screening and testing has become a crucial research topic.
[0004] Because the second-stage screening process involves many different models and small batches, the current manual process accounts for a relatively high proportion, leading to frequent human-caused quality problems and low screening efficiency. Therefore, it is necessary to replace manual testing with efficient automated testing methods. However, existing automated screening solutions for surface mount components have not kept up with the latest developments in automated testing technology. Instead, they employ automated testing technology based on feed trays and sensors, resulting in low screening efficiency and several shortcomings. The disadvantages of existing automated testing technologies include the following four points:
[0005] First, automated testing technologies based on feed trays and sensors lack versatility. Feed trays are designed for specific device models and are only applicable to those models. To test other models, a special feed tray and conveying device need to be redesigned, along with appropriate sensors. The current trend in automated testing technology for surface mount components is to design highly versatile automated testing systems that can test a variety of surface mount components, thereby reducing testing costs.
[0006] Secondly, the automated testing technology based on the feed tray and sensors suffers from the phenomenon of breakage of the tested surface-mount components. In this automated testing scheme, the feed tray and the conveying device need to vibrate according to a specific pattern. Depending on the feeding requirements, the vibration direction of the feed tray and the vibration direction of the conveying device are inconsistent. When the tested component is conveyed to the junction of the feed tray and the conveying device, the inconsistent vibration directions of the feed tray and the conveying device can lead to the breakage of the tested component.
[0007] Third, automated testing technology based on feed trays and sensors cannot automate the testing process for polarized surface-mount components. This is because the polarity of surface-mount components is distinguished by the pattern on the front of their casing, and the positive and negative poles of a surface-mount component do not have any three-dimensional structural difference. Therefore, this automated testing technology cannot arrange the fed surface-mount components according to a specific polarity order.
[0008] Fourth, automatic testing technology based on feed trays and sensors has a high material rejection rate. Because the vibration directions of the feed tray and the conveying device are inconsistent, in addition to breaking the components, material rejection can also occur.
[0009] Currently, the development trend of automated testing is to use computer vision combined with robotic arms to achieve fully automated testing of identification, positioning, and grasping. Automated testing technology based on computer vision and robotic arms is characterized by strong scalability and high versatility; it can be fully adapted to the testing of devices of other sizes simply by changing small parts. This automated testing technology also has the advantages of high automation and unattended operation, which can achieve the effects of freeing up labor and reducing costs and increasing efficiency. Therefore, it is necessary to provide a new computer vision-based automatic identification and positioning method for chip components, so as to develop a system capable of automatically testing chip components of various sizes and specifications, achieving convenient operation, high efficiency, and reliable performance. Summary of the Invention
[0010] In order to overcome the shortcomings of existing automatic testing technologies, the present invention aims to provide a new computer vision-based automatic identification and positioning method for chip components, which can quickly and efficiently complete the secondary screening task of chip components.
[0011] A computer vision-based method for automatic identification and localization of chip components includes the following steps:
[0012] S1. Process Editing: Establish the transformation relationship from the pixel coordinate system to the robot arm coordinate system;
[0013] S2. Template Construction: Construct a matching template for identifying target chip components;
[0014] S3. Rotation Calibration: Through calibration, the angle recognition error is calculated so as to more accurately identify the angle of the target chip component;
[0015] S4. Target Recognition and Positioning: After the first three steps of basic work, the target chip component is formally identified, then positioned and its coordinates and angles in the robot's coordinate system are calculated.
[0016] Furthermore, in step S1, assuming the pixel coordinate system is the pixel coordinate system and the robot coordinate system is the robot coordinate system, after establishing the mapping relationship between the pixel coordinate system and the robot coordinate system, the coordinates determined in the pixel coordinate system can all have their corresponding coordinates in the robot coordinate system calculated. This step includes three sub-steps:
[0017] C1. Change the image orientation so that the X-axis of the pixel coordinate system is consistent with the X-axis of the robot coordinate system, and the Y-axis of the pixel coordinate system is consistent with the Y-axis of the robot coordinate system.
[0018] C2. Adjust the origin position so that the origin position of the pixel coordinate system is consistent with the origin position of the robot coordinate system;
[0019] C3. Hand-eye calibration: Calculate the scaling factor k and deflection angle θ between the robot coordinate system and the pixel coordinate system using hand-eye calibration.
[0020] The calculation of the proportionality coefficient k is given by formulas (1) and (2):
[0021]
[0022]
[0023] The calculation of the deflection angle θ is given in formulas (3), (4), (5), (6), and (7):
[0024]
[0025] θ i =θ ir -θ ip (4)
[0026] θ ir =atan2((ROj.y-ROi.y),(ROj.x-ROi.x)) (5)
[0027] θ ip =atan2((PIj.y-PIi.y),(PIj.x-PIi.x)) (6)
[0028]
[0029] Where i∈{1,2,3,4,5,6,7,8,9}, θ ir Let θ be the angle of deflection of the vector relative to the X-axis in the robot coordinate system. ip The angle of deflection of the vector relative to the X-axis in the pixel coordinate system;
[0030] Take any point P in the pixel coordinate system. t The coordinates of the point in the robot coordinate system can be obtained from k and θ, as shown in formula (8):
[0031]
[0032] Where, θ n = atan2(PI1t.y,PI1t.x).
[0033] Furthermore, in step S2, the template is constructed by extracting features of the chip component to be detected. This invention employs scale-invariant feature transform (SIFT) for feature extraction, specifically including three sub-steps:
[0034] E1. Positioning Template: Place the chip component to be used as the template face up in the detection area. The camera takes a picture at the image capture position to obtain an image containing the component to be used as the template. Use this image as the input for template construction. After obtaining the image, first frame the chip component in the image with a rectangle. The part in the rectangle will be used as the template. Then, calculate the center point of the rectangle. This coordinate point is the gripping point.
[0035] E2. Feature extraction: Create a SIFT object using the method (xfeatures2d.SIFT_create) provided by the OpenCV library. Then, extract features from the template using the method (detectAndCompute) provided by the OpenCV library. Finally, two arrays are obtained: the key point set KP and the corresponding feature description information FD. The position of the chip component to be constructed as the template cannot be changed after the photo is taken.
[0036] E3. Point setting: Calculate the coordinates and angles of the constructed template in the pixel coordinate system. Then, move the robot arm to the template position and record its coordinates. Here, record the angle of the template in the robot coordinate system, i.e., the robot arm's U-axis coordinate is U. t U t It is used to determine the angle of the chip component to be located in the robot coordinate system during subsequent target identification and localization.
[0037] Furthermore, step S3, rotation calibration, includes: after each rotation of the template by the robotic arm at a certain angle, identifying the angle by which the template has rotated relative to its original position; and calculating the angle identification error after multiple rotations and identifications by the robotic arm. The specific steps are as follows:
[0038] (1) After setting the point, the initial angle of the template in the robot coordinate system is U0;
[0039] (2) The i-th time the robot arm is controlled to rotate the template by 10° in place. Through identification and calculation, the angle of the template in the robot coordinate system is obtained as U. i The actual angle of the template is U. ti = (U0 + i * 10°) % 360°;
[0040] (3) Calculate the recognition error ER for each recognition. i =U i -U ti ;
[0041] (4) Obtain the average error Where j is an integer not less than 15.
[0042] Furthermore, step S4 includes four sub-steps:
[0043] Z1. Preprocessing: The preprocessing includes 5 steps. Let the captured image to be identified be image0. Step 1: Convert the color space of image0 to obtain image1. Step 2: Perform bilateral filtering on image1 to obtain image2. Step 3: Enhance the contrast of image2 to obtain image3. Step 4: Perform morphological opening and closing operations on image3 to obtain image4. Step 5: Use the Canny operator to detect contours on image4 to obtain image5. The contours of the chip component to be tested will be drawn in image5.
[0044] Z2. Target matching: The target matching is performed using the matching algorithm (Match Template) provided by OpenCV. The specific steps are as follows:
[0045] (a) Set the rotation step SF value, which is adjustable;
[0046] (b) Use the matching algorithm to perform the first matching, obtain the best matching result BMR1, and set the final best matching result BMR = BMR1, and the best number of rotations NR = 0;
[0047] (c) Rotate the template by step, and then use the matching algorithm to perform the k-th matching (1≤k≤(360 / SF)), then obtain the best matching result BMRk, and finally compare MBRk with the existing BMR and update BMR and NR;
[0048] (d) The best matching result BMR and the best number of rotations NR are finally obtained.
[0049] Z3. Calculate the coordinates and angles, and let P be the best matching point. c Using methods provided by OpenCV, obtain the coordinates PIC of the best matching result, and the best matching angle BMA = (U t +SF*NR)%360°.
[0050] Z4. Transform the coordinates and angles, and calculate P according to formula (8). c Based on the rotation calibration, P is obtained from the coordinates ROc in the robot coordinate system. c In the robot coordinate system, the angle U = (BMA + ER)%360° is used to ultimately identify and locate the chip component under test.
[0051] The automatic identification and positioning of chip components based on computer vision is the most crucial step in fully automated chip component testing. To replace the chip component under test, only a template for that model needs to be created. Compared to existing technologies, this invention has greater versatility, a wider range of applications, and better protection for the chip components under test. Specifically:
[0052] 1) This method uses an automatic testing technology based on an industrial camera and a robotic arm, which can automatically identify the size and specifications, front and back sides, positive and negative poles, coordinate positioning, and angle analysis of chip components, and inform the robotic arm of the coordinates and angles of the chip components so that subsequent automatic grasping can be realized.
[0053] 2) This invention combines a computer, an industrial control computer, a robotic arm, and a vision system to automatically identify and locate tantalum capacitors, thereby achieving automated measurement of capacitor losses and freeing up manpower and improving efficiency.
[0054] 3) This invention performs template matching on the target surface of the capacitor. By calculating the center coordinates and offset angle of the target capacitor, it automatically corrects the orientation of the tantalum capacitor, so that the electrodes of the target capacitor match the test position of the capacitor tester, which greatly improves the efficiency and quality of the measurement of small-volume tantalum capacitors. Attached Figure Description
[0055] Figure 1 This is a schematic diagram of the process of the present invention. Detailed Implementation
[0056] The present invention will be further explained and described below with reference to the accompanying drawings and embodiments, so as to enable those skilled in the art to better understand it.
[0057] Example 1
[0058] like Figure 1 As shown, an automatic identification and positioning method for chip components based on computer vision includes the following steps:
[0059] S1. Process Editing: Establish the transformation relationship from the pixel coordinate system to the robot arm coordinate system;
[0060] S2. Template Construction: Construct a matching template for identifying target chip components;
[0061] S3. Rotation Calibration: Through calibration, the angle recognition error is calculated so as to more accurately identify the angle of the target chip component;
[0062] S4. Target Recognition and Positioning: After the first three steps of basic work, the target chip component is formally identified, then positioned and its coordinates and angles in the robot's coordinate system are calculated.
[0063] In step S1, the transformation relationship between the pixel coordinate system and the robot coordinate system is established. Each time the camera is changed, the shooting position changes, the camera becomes loose, or the lens focal length changes, the mapping relationship between the robot coordinate system and the pixel coordinate system needs to be re-established. The function of the workflow editing module is to complete the task of "establishing the transformation relationship between the pixel coordinate system and the robot coordinate system". Hereafter, the pixel coordinate system will be referred to as the pixel coordinate system, and the robot coordinate system as the robot coordinate system. The following assumptions are made:
[0064] (1) Let the origin of the pixel coordinate system be PIo, and the origin of the robot coordinate system be ROo;
[0065] (2) Let the x-coordinate of a point Pa in the pixel coordinate system be PIA.x and the y-coordinate be PIA.y. Let the x-coordinate of point Pa in the robot coordinate system be ROa.x and the y-coordinate be ROa.y. For example, the x-coordinate and y-coordinate of point P1 in the pixel coordinate system are PI1.x and PI1.y respectively, and the x-coordinate and y-coordinate of point P1 in the robot coordinate system are RO1.x and RO1.y respectively.
[0066] (3) Let the vectors of two points Pa and Pb in the pixel coordinate system and the robot coordinate system with point Pa as the reference point be PIab and ROab, respectively. Similarly, the vectors of two points Pa and Pb in the pixel coordinate system and the robot coordinate system with point Pb as the reference point are PIba and ROba, respectively. For example, the vector of points P2 and P3 in the pixel coordinate system with P2 as the reference point is PI23, and the vector of points P2 and P3 in the robot coordinate system with P3 as the reference point is RO32.
[0067] Furthermore, process editing includes three sub-steps:
[0068] C1. Change the image orientation. Take a photo of a black and white checkerboard calibration plate at the shooting position. Use this photo as input for the workflow editing to realize the mapping from the pixel coordinate system to the robot coordinate system. By rotating the image, make the X-axis direction of the pixel coordinate system consistent with the X-axis direction of the robot coordinate system, and the Y-axis direction of the pixel coordinate system consistent with the Y-axis direction of the robot coordinate system, which facilitates the subsequent calculation of the mapping relationship.
[0069] C2. Adjust the origin position. After changing the image orientation so that the coordinate axes of the pixel coordinate system and the robot coordinate system are aligned, continue to adjust the origin of the pixel coordinate system so that its origin is consistent with the origin of the robot coordinate system.
[0070] C3. Hand-eye calibration: The captured image contains a black and white checkerboard calibration board. N points are selected on the calibration board, and the coordinates of these N points in the pixel coordinate system and the robot coordinate system are obtained respectively. After recording the coordinates of the N points in both coordinate systems, the proportionality coefficient k between the distance between two points Pa and Pb in the robot coordinate system and the distance between Pa and Pb in the pixel coordinate system, as well as the deflection angle θ between the two coordinate systems, can be calculated. A 9-point calibration method is used to achieve hand-eye calibration.
[0071] First, record the coordinates of the nine points on the calibration board in both the pixel coordinate system and the robot coordinate system. The coordinates of the nine points in the pixel coordinate system are PI1, PI2, PI3, PI4, PI5, PI6, PI7, PI8, and PI9. The coordinates of the nine points in the robot coordinate system are RO1, RO2, RO3, RO4, RO5, RO6, RO7, RO8, and RO9. The nine vectors in both the pixel coordinate system and the robot coordinate system can then be calculated. The calculated vectors are as follows:
[0072]
[0073] To find the proportionality coefficients k, we can use formula (1) to obtain the nine proportionality coefficients k based on the nine vectors. i :
[0074]
[0075] Where i∈{1,2,3,4,5,6,7,8,9}, j=(i+1)%9, and then take the average of the 9 proportionality coefficients as k:
[0076]
[0077] The deflection angle θ can be obtained from the nine deflection angles using formula (3). i :
[0078] θ i =θ ir -θ ip (3)
[0079] Where i∈{1,2,3,4,5,6,7,8,9}, θ ir Let θ be the angle of deflection of the vector relative to the X-axis in the robot coordinate system. ip Let θ be the angle of deflection of the vector relative to the X-axis in the pixel coordinate system. ir and θ ip The results can be obtained from formulas (4) and (5) respectively:
[0080] θ ir =atan2((ROj.y-ROi.y),(ROj.x-ROi.x)) (4)
[0081] θ ip =atan2((PIj.y-PIi.y),(PIj.x-PIi.x)) (5)
[0082] Where j = (i+1)%9, the function atan2(y,x) is as shown in formula (6):
[0083]
[0084] Find θ i Then, the average of the nine deflection angles is taken as θ:
[0085]
[0086] At this point, any point P is selected in the pixel coordinate system. t The coordinates of the point in the robot coordinate system can be obtained from k and θ. The specific solution method is shown in formula (8):
[0087]
[0088] Where, θ n = atan2(PI1t.y,PI1t.x).
[0089] Based on the scaling factor k and the deflection angle θ, any coordinate in the pixel coordinate system can be converted to a coordinate (including angle) in the robot coordinate system.
[0090] After establishing the mapping relationship between the pixel coordinate system and the robot coordinate system, coordinates determined in the pixel coordinate system can have their corresponding coordinates in the robot coordinate system calculated. The current task is to construct a template for the chip component under test, which will serve as a matching template during testing. The template is constructed by extracting features from the chip component under test. This invention employs feature extraction based on Scale-Invariant Feature Transform (SIFT), specifically including three sub-steps:
[0091] E1. Positioning Template: Place the chip component to be used as the template face up in the detection area. The camera takes a picture at the image capture position to obtain an image containing the component to be used as the template. This image is used as the input for template construction. After obtaining the image, first, frame the chip component in the image with a rectangle. The part within the rectangle will be used as the template. In principle, the chip component should be completely framed, and no extra or non-chip components should be framed. The more accurate the frame, the more precise the matching. Then, calculate the center point of the rectangle. This coordinate point is the capture point.
[0092] E2. Feature Extraction: After locating the chip component, feature regions need to be selected within a rectangular frame. This is primarily based on the positive and negative polarities of the chip component. It's important to note that the selected feature regions possess unique characteristics not found on other components; these feature regions are unique and independent attributes identifying a specific model of chip component. A SIFT object is created using the OpenCV library method (xfeatures2d.SIFT_create). Then, the OpenCV library method (detectAndCompute) is used to extract features from the template, ultimately resulting in two arrays: the keypoint set KP and the corresponding feature description information FD. The chip component to be used as the template cannot have its position changed after being photographed, as the position of the template is needed in subsequent steps (rotation calibration). The position information includes the X, Y, and U coordinates (rotation angle) of the robot coordinate system.
[0093] E3. Point Setting: First, calculate the coordinates and angle of the constructed template in the pixel coordinate system. Then, move the robot arm to the template position, i.e., the position where the robot arm grasps the template, and record the coordinates of the robot arm, i.e., the coordinates of the template in the robot coordinate system. Here, record the angle of the template in the robot coordinate system, i.e., the U-axis coordinate of the robot arm is U. t U t It is used to determine the angle of the chip component to be located in the robot coordinate system during subsequent target identification and localization.
[0094] The point setting is for calculating the U-axis coordinates of the chip component in the robot coordinate system during target recognition, i.e., the angle of the chip component in the robot coordinate system. After the template is built, do not change the position of the template. Calculate and record the coordinates of the template in the pixel coordinate system and the robot coordinate system independently (not by calculating the robot coordinates using the scaling factor k and deflection angle θ calculated through workflow editing).
[0095] To more accurately identify the angle of the component under test, enabling the robotic arm to more precisely grasp the component onto the testing platform, this invention selects a rotation angle of 10° each time. That is, after controlling the robotic arm to rotate the template 10° in place, the angle U of the template in the robot coordinate system is obtained through identification. i Through at least 15 repeated recordings, an average error value (ER) is calculated, and this ER value is used to reduce subsequent recognition errors. The specific procedure is as follows:
[0096] (1) After setting the point, the initial angle of the template in the robot coordinate system is U0;
[0097] (2) The i-th time the robot arm is controlled to rotate the template by 10° in place. Through identification and calculation, the angle of the template in the robot coordinate system is obtained as U. i The actual angle of the template is U. ti = (U0 + i * 10°) % 360°;
[0098] (3) Calculate the recognition error ER for each recognition. i =U i -U ti ;
[0099] (4) Obtain the average error Where j is an integer not less than 15.
[0100] After completing all the above steps, the formal target recognition and localization can begin. Through a series of operations, the coordinates of the component under test in the robot coordinate system are obtained, ultimately achieving automatic recognition and localization of the component, facilitating subsequent automatic grasping by the robotic arm. This step includes four sub-steps: preprocessing, target matching, calculating coordinates and angles, and transforming coordinates and angles. The input is a photograph of the component under test taken at the camera location.
[0101] Z1. Preprocessing: Preprocessing includes 5 steps. Let the captured image to be identified be image0.
[0102] Step 1: Convert the color space of image0 to obtain image1, that is, convert the color space of the image from BGR (Blue / Green / Red) to HSV (Hue / Saturation / Value).
[0103] Step 2: Perform bilateral filtering on image1 to obtain image2. That is, filter the image after color space conversion. Use bilateral filtering in non-linear space filtering to achieve the purpose of edge preservation and noise reduction.
[0104] Step 3: Enhance the contrast of image2, highlight meaningful information, and suppress useless information to better detect the edge contour of the backlight area of the chip component under test in the image, and obtain image3;
[0105] Step 4: Perform morphological opening and closing operations on image3, which involves eroding and dilating the image to a certain extent. The opening and closing operations can reconnect the regions that have been mistakenly segmented into fragments and eliminate small pixel blocks caused by noise in the image, resulting in image4.
[0106] Step 5: Use the Canny operator to detect the contours of image4 to obtain image5. Based on the previous steps, the contours of the chip components under test (the components under test here include all components with clear contours on the front and back) can be obtained and drawn.
[0107] Z2. Target matching: The target matching is performed using the matching algorithm (Match Template) provided by OpenCV. The specific steps are as follows:
[0108] (a) Set the rotation step SF value, which is adjustable;
[0109] (b) Use the matching algorithm to perform the first matching, obtain the best matching result BMR1, and set the final best matching result BMR = BMR1, and the best number of rotations NR = 0;
[0110] (c) Rotate the template by step, and then use the matching algorithm to perform the k-th matching (1≤k≤(360 / SF)), then obtain the best matching result BMRk, and finally compare MBRk with the existing BMR and update BMR and NR;
[0111] (d) The best matching result BMR and the best number of rotations NR are finally obtained.
[0112] Z3. Calculate the coordinates and angles, and let P be the best matching point. c Using methods provided by OpenCV, obtain the coordinates PIC of the best matching result, and the best matching angle BMA = (U t +SF*NR)%360°.
[0113] Z4. Transform the coordinates and angles, and calculate P according to formula (8). c Based on the rotation calibration, P is obtained from the coordinates ROc in the robot coordinate system. c In the robot coordinate system, the angle U = (BMA + ER)%360° is used to ultimately identify and locate the chip component under test.
[0114] This invention enables automatic identification and positioning of chip components based on computer vision, a crucial step in fully automated chip component testing. Furthermore, replacing the chip component under test only requires creating a template for that specific model. Compared to existing technologies, this invention offers greater versatility, a wider range of applications, and better protection for the chip components under test.
[0115] The above description is only a partial embodiment of the present invention. It should be noted that those skilled in the art can make several optimizations and improvements, or make equivalent substitutions for some of the technical features, without departing from the principle of the present invention. These improvements and substitutions should also be considered within the scope of protection of the present invention.
Claims
1. A method for automatic identification and positioning of chip components based on computer vision, characterized in that, Includes the following steps: S1. Process Editing: Establish the transformation relationship from the pixel coordinate system to the robot arm coordinate system; S2, Template Construction: Construct a matching template for identifying target chip components; S3. Rotation calibration: Through calibration, the angle recognition error is calculated so as to more accurately identify the angle of the target chip component; S4. Target Recognition and Localization: After the first three basic steps, the target chip component is formally identified, then located and its coordinates and angles in the robot's coordinate system are calculated. In step S1, assuming the pixel coordinate system is the pixel coordinate system and the robot coordinate system is the robot coordinate system, after establishing the mapping relationship between the pixel coordinate system and the robot coordinate system, the scaling factor k and the deflection angle θ of the robot coordinate system and the pixel coordinate system are calculated. The specific steps for editing the S1 process are as follows: C1. Change the image orientation so that the X-axis of the pixel coordinate system is consistent with the X-axis of the robot coordinate system, and the Y-axis of the pixel coordinate system is consistent with the Y-axis of the robot coordinate system. C2. Adjust the origin position so that the origin position of the pixel coordinate system is consistent with the origin position of the robot coordinate system; C3. Hand-eye calibration: Through hand-eye calibration, the scaling factor k and deflection angle θ of the robot coordinate system and the pixel coordinate system are calculated. The proportionality constant k is calculated using formulas (1) and (2): (1); (2); Where ROij.x and ROij.y are the x and y coordinates of the vector from point ROi to point ROj in the robot coordinate system, respectively; and PIij.x and PIij.y are the x and y coordinates of the vector from point Pii to point PIj in the pixel coordinate system, respectively. The calculation of the deflection angle θ is given in formulas (3), (4), (5), (6), and (7): (3); (4); (5); (6); (7); Among them, i ∈ {1,2,3,4,5,6,7,8,9}, θ ir Let θ be the angle of deflection of the vector relative to the X-axis in the robot coordinate system. ip ROj.x and ROj.y are the x and y coordinates of point ROj in the robot coordinate system, ROi.x and ROi.y are the x and y coordinates of point ROi in the robot coordinate system, PIj.x and PIj.y are the x and y coordinates of point PIj in the pixel coordinate system, and PIi.x and PIi.y are the x and y coordinates of point Pii in the pixel coordinate system. For any point Pt in the pixel coordinate system, the coordinates of that point in the robot coordinate system can be obtained from k and θ. The calculation is shown in formula (8): (8); Where θn = atan2(PI1t. y, PI1t. x); PI1t.x and PI1t.y are the x and y coordinates of the vector from point PI1 to point PIT in the pixel coordinate system; RO1.x and RO1.y are the x and y coordinates of point RO1 in the robot coordinate system; and Pit1.x and Pit1.y are the x and y coordinates of the vector from point PIT to point PI1 in the pixel coordinate system. Step S3, rotation calibration includes: each time the template is rotated by the robot arm by a certain angle, the angle of rotation of the template after rotation relative to the angle before rotation is identified, and the angle identification error is calculated after multiple rotations and multiple identifications by the robot arm. The specific steps are as follows: (1) After the point is set, the initial angle of the template in the robot coordinate system is U0; (2) The i-th time, the robot arm is controlled to rotate the template by 10° in place. Through identification and calculation, the angle of the template in the robot coordinate system is obtained as U. i The actual angle of the template is ; (3) Calculate the recognition error for each time ; (4) Obtain the average error , where j is an integer not less than 15; Step S4 includes four sub-steps: Z1. Preprocessing: The preprocessing includes 5 steps. Let the captured image to be identified be image0. Step 1: Convert the color space of image0 to obtain image1. Step 2: Perform bilateral filtering on image1 to obtain image2. Step 3: Enhance the contrast of image2 to obtain image3. Step 4: Perform morphological opening and closing operations on image3 to obtain image4. Step 5: Use the Canny operator to detect contours on image4 to obtain image5. The contours of the chip component to be tested will be drawn in image5. Z2. Target matching: The Match Template matching algorithm provided by OpenCV is used for target matching. The specific steps are as follows: (a) Set the rotation step SF value, which is adjustable; (b) Use the matching algorithm to perform the first matching, obtain the best matching result BMR1, and set the final best matching result BMR=BMR1, and the best number of rotations NR=0; (c) Rotate the template by step, and then use the matching algorithm to perform the k-th matching, where 1 ≤ k ≤ (360 / SF). Then obtain the best matching result BMRk. Finally, compare MBRk with the existing BMR and update BMR and NR. (d) The best matching result BMR and the best number of rotations NR are finally obtained; Z3. Calculate the coordinates and angle. Let the optimal matching point be Pc. Using the methods provided by OpenCV, obtain the coordinates Pc and the optimal matching angle of the optimal matching result. ; Z4. Transform the coordinates and angles. According to formula (8), obtain the coordinates ROc of Pc in the robot coordinate system. According to the rotation calibration, obtain the angle U of Pc in the robot coordinate system as U = (BMA + ER)%360. Finally, the identification and positioning of the chip component under test are realized.
2. The method for automatic identification and positioning of chip components based on computer vision according to claim 1, characterized in that, Step S2, the template is constructed by extracting features of the chip component to be detected, using scale-invariant feature transform (SIFT) for feature extraction, specifically including three sub-steps: E1. Positioning Template: Place the chip component to be used as the template face up in the detection area. Take a picture with the chip component to be used as the template in the picture. Use a rectangle to frame the chip component in the picture. The part in the frame will be used as the template. Then, calculate the center point of the rectangle. This coordinate point is the gripping point. E2. Feature extraction: Use the xfeatures2d.SIFT_create method provided by the OpenCV library to create a SIFT object. Then, use the detectAndCompute method provided by the OpenCV library to extract features from the template. Finally, two arrays are obtained, namely the key point set KP and the corresponding feature description information FD. It should be noted that the position of the chip component to be constructed as the template cannot be changed after the photo is taken. E3. Point setting: Calculate the coordinates and angle of the constructed template in the pixel coordinate system. Then, move the robot arm to the template position and record its coordinates. Here, record the angle of the template in the robot coordinate system, i.e., the robot arm's U-axis coordinate is U. t U t It is used to determine the angle of the chip component to be located in the robot coordinate system during subsequent target identification and localization.
Citation Information
Patent Citations
Robot hand and eye locating method
CN104260112A
Automatic connector assembly robot system and control method thereof
CN106514201A