Offline fast programming method for plug-in machine

By shooting and splicing PCB images by cameras, obtaining plug-in point information, and automatically generating plug-in schematic diagrams, solving the problems of cumbersome programming, many mistakes and high costs of existing plug-in machines, and achieving fast, accurate and low-cost programming effects.

CN119781757APending Publication Date: 2025-04-08SHENZHEN ZHONGHEXU PRECISION MACHINERY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411811410.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The existing plug-in computers are cumbersome to program, prone to errors, and are costly, making it difficult to achieve fast, accurate and low-cost programming.

Method used

Take images of each area of ​​the PCB through the camera, splice them into a complete PCB image, obtain the type and location information of the plug-in points, and automatically generate the PCB offline plug-in diagram.

Benefits of technology

It realizes fast, accurate and simple programming of plug-in machines, reduces manual operation difficulty, improves operation efficiency, and reduces production costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781757A_ABST
    Figure CN119781757A_ABST
Patent Text Reader

Abstract

The present invention discloses an offline fast programming method for a plug-in machine, comprising: taking images of various areas of a PCB by a camera respectively; splicing the images of the various areas taken into a complete PCB image; obtaining plug-in points in the PCB image, and obtaining corresponding plug-in type information and plug-in position information according to the number of pins, angles, hole spacings and hole diameters of adjacent plug-in points; calibrating the types and quantities of all obtained plug-ins, and if the calibration is correct, generating a corresponding PCB offline plug-in schematic diagram. The present invention splices the graphics of various areas of the PCB taken by a camera into a complete PCB image, obtains the plug-in type information and plug-in position information according to the image information, thereby automatically generating a PCB offline plug-in schematic diagram, and realizing fast, accurate and simple programming of the plug-in machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of PCB plug-in intelligent programming, and in particular to an off-line fast programming method for a plug-in machine. Background Art

[0002] The plug-in machine is a mechanical device that automatically and standardly inserts some regular electronic components into the conductive through holes of the PCB. To achieve the automatic and standard insertion of electronic components, the plug-in machine needs to perform programmed operations according to the position of the electronic components. In the existing PCB plug-in machine market, most plug-in machines are still in the stage of manual programming. Not only are there problems such as cumbersome programming and prone to errors, but also high requirements for programmers and high production costs. Therefore, how to make the programming of the plug-in machine fast, accurate and low-cost has become an objective demand. Summary of the invention

[0003] The invention provides an off-line programming method for an inserter, which is used to solve the problems that the existing inserter programming is complicated, prone to errors and high in cost.

[0004] To achieve the purpose of the present invention, the present invention provides an offline fast programming method for a plug-in machine, the method comprising the following steps:

[0005] a. Use the camera to take images of each area of ​​the PCB;

[0006] b. stitching the images of the various regions captured into a complete PCB image;

[0007] c. Obtain the plug-in points in the PCB image, and obtain the corresponding plug-in type information and plug-in position information according to the number of pins, angle, hole spacing and hole diameter of adjacent plug-in points;

[0008] d. Calibrate the types and quantities of all the plug-ins obtained. If the calibration is correct, generate the corresponding PCB offline plug-in schematic diagram.

[0009] Further, step a comprises:

[0010] a1. Preset the camera's calibrated pixel width, the starting and ending positions of the shooting, and calculate the number of shots required in the horizontal and vertical directions;

[0011] a2. According to the number of shots, the camera automatically positions itself from the starting position to the end position to obtain images of various areas of the PCB.

[0012] Further, step b comprises:

[0013] b1. Extracting features from the images of each area captured;

[0014] b2. Perform edge stitching and matching of images based on image features;

[0015] b3. Image stitching based on matching results;

[0016] b4. Perform gap fusion on the stitched images based on the weighted average method.

[0017] Furthermore, in step b1, feature points in the image of each region captured are extracted by SIFT, and a feature vector is calculated for the region around each feature point.

[0018] In step b2, based on the feature points and feature vectors of the two images, the edges of the images are matched by FLANN homography to obtain the perspective transformation H matrix.

[0019] In step b3, the second image is perspective transformed by the inverse matrix of the perspective transformation H matrix to convert it to the same image as the first image. Figure 1 After the perspective change is completed, the image is directly added to the left side of the image with the perspective change completed through numpy, covering the overlapping part to obtain the stitched image.

[0020] In step b4, a certain proportion of both sides of the splicing part of the splicing image are taken for gap fusion by weighted average method to obtain a complete PCB image.

[0021] Furthermore, in step c: when obtaining the plug-in points in the PCB image, different plug-in types are determined based on the different spacings of the plug-in pins; the plug-in position is determined based on the angle of the connection between the plug-in points; if the plug-in point spacings of the two plug-ins are the same, the plug-in type is determined manually.

[0022] Further, step c comprises:

[0023] If the first plug-in hole of the PCB image is detected, all second plug-in holes within a set distance from the first plug-in hole can be queried based on the position of the first plug-in hole, and the distances between all second plug-in holes and the first plug-in hole can be obtained to determine the second plug-in hole paired with the first plug-in hole. If the pairing of the second plug-in hole and the first plug-in hole is unique, the two-pin plug-in corresponding to the first plug-in hole and the second plug-in hole is directly set;

[0024] If the plug-in is determined to be a three-pin plug-in based on the distance between the first plug-in hole and the second plug-in hole, it is determined whether there is a third plug-in hole within the set distance around the second plug-in hole. If there is a third plug-in hole, the three-pin plug-in corresponding to the first plug-in hole, the second plug-in hole and the third plug-in hole are directly set;

[0025] If there are more than two matching second plug-in holes around the first plug-in hole, the first plug-in hole matching the second plug-in hole is determined based on the second plug-in hole, and if the first plug-in hole corresponding to the second plug-in hole is unique, the two-pin plug-in corresponding to the first plug-in hole and the second plug-in hole is set;

[0026] If all the first plug-in holes and second plug-in holes that cannot be determined are highlighted in the picture, the user can check and confirm them.

[0027] Furthermore, step d includes: comparing the types and quantities of all acquired plug-ins with the types and quantities of PCB preset plug-ins, and if they are consistent, drawing plug-in labels on the PCB image to generate corresponding PCB offline plug-in schematics.

[0028] The beneficial effects of the present invention are as follows: the present invention splices the graphics of various areas of the PCB taken by the camera into a complete PCB image, obtains plug-in type information and plug-in position information according to the image information, thereby automatically generating a PCB offline plug-in schematic diagram, and realizing fast, accurate and simple programming of the plug-in machine.

[0029] On the other hand, the present invention realizes image stitching by performing feature extraction, stitching edge matching, image stitching and gap fusion on images, which can meet higher visual requirements under limited visual conditions, enhance the visual application effect under the same conditions, reduce the cost of visual solutions under the same results, and improve the visual pixel accuracy to a certain extent.

[0030] In addition, the present invention automatically obtains the plug-in type and position information of the plug-in point to generate a corresponding PCB offline plug-in schematic diagram, which not only reduces the difficulty of manual operation of the equipment and improves the operating efficiency, but also makes point data editing simple and efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a flow chart of the method of the present invention.

[0032] Figure 2 It is an image obtained by taking a single shot by the camera of the present invention.

[0033] Figure 3 This is a complete PCB image obtained by splicing the present invention. DETAILED DESCRIPTION

[0034] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0035] See also Figure 1 The offline fast programming method of the plug-in machine of this embodiment is used to generate a PCB offline plug-in schematic diagram according to the PCB board. The method comprises the following steps:

[0036] S10, taking images of various areas of the PCB by using a camera.

[0037] In this step, the images of various areas of the PCB are obtained through the visual system of the plug-in machine, which specifically includes:

[0038] S11, presetting the camera's calibrated pixel width, the starting position and the end position of the shooting, and calculating the number of shots required in the horizontal and vertical directions.

[0039] In this step, according to the properties of the camera, the calibrated pixel width of the camera is pre-set, and the starting and ending positions of the shooting are set. Then, according to the size of the PCB, the number of times the camera needs to shoot in the horizontal and vertical directions is calculated to ensure that the camera can capture images of all areas of the PCB.

[0040] S12. According to the number of shots, the camera automatically positions itself from the starting position to the end position to obtain images of various areas of the PCB.

[0041] In this step, the camera starts from the starting position and takes pictures according to the preset number of shots until the last shot reaches the end position, that is, the shooting of each area of ​​the PCB is completed, and the image of each area of ​​the PCB is obtained. Figure 2 Specifically, the camera can shoot from the starting position to the end position row by row, or column by column, or in a "Z" shape or other paths.

[0042] S20, stitching the images of each area captured into a complete PCB image.

[0043] In this step, after acquiring the images of each area, the images are exported to a computer for offline stitching to obtain a complete PCB image. Specifically, this step includes:

[0044] S21, extracting features from the images of each area captured.

[0045] In this step, the images taken by the camera are imported into the computer, the feature points in each image are extracted using SIFT, and the feature vector is calculated for the area around each feature point.

[0046] S22. Perform edge stitching and matching of the image based on the image features.

[0047] In this step, after the feature points and feature vectors of the two images are extracted respectively, the feature points and feature vectors of the two images can be used to match the two images. In this embodiment, based on the feature points and feature vectors of the two images, the edges of the images are spliced ​​and matched by FLANN homography to obtain the perspective transformation H matrix. If the two images are matched successfully, step S23 is entered. If the two images are not matched successfully, another image is selected for matching until the two images are matched successfully.

[0048] S23: perform image stitching based on the matching results.

[0049] In this step, when the two images are matched successfully, the first image and the second image can be spliced. First, place the first image, and use the inverse matrix of the perspective transformation H matrix to transform the second image to the same viewing angle as the first image. After the perspective change is completed, the image is directly added to the left of the image with the perspective change through numpy to cover the overlapping parts, that is, the image spliced ​​by the two images is obtained, and then the remaining images are spliced ​​in the same way.

[0050] This step realizes image stitching by performing feature extraction, edge matching, image stitching and gap fusion on the images. It can meet higher visual requirements under limited visual conditions, enhance the visual application effect under the same conditions, reduce the cost of the visual solution under the same results, and improve the visual pixel accuracy to a certain extent.

[0051] S24, performing gap fusion on the stitched images based on the weighted average method.

[0052] In this step, the spliced ​​image obtained by step S23 has a gap at the splicing part of the two images due to the color difference or position offset of the two adjacent images. The spliced ​​images can be fused by the weighted average method. Among them, a certain proportion can be taken on both sides of the boundary of the spliced ​​image to fuse the gap. For example, the first image can be stacked on the left, but some weighting processing is performed on the first image and its overlapping area. For the overlapping part, the weight of the left image is higher for the overlapped part that is closer to the left image, and the weight of the right transformed image is higher for the overlapped part that is closer to the right image. Then the two are added together to make the transition of the spliced ​​part smooth.

[0053] Specifically, each image is divided into a main body area of ​​non-overlapping area and a stitching area of ​​overlapping area, and the shape and area of ​​the stitching area on the left and the stitching area on the right of each image are roughly the same. Each image displays the original pixels of the image in the main body area, and the grayscale value of the pixels displayed in the stitching area is:

[0054] S=S1*a1+S2*a2

[0055] Among them, S1 is the grayscale value of the pixel of the left image in the stitching area, S2 is the grayscale value of the pixel of the right image in the stitching area, a1 is the weight of the pixel in the left image, and a2 is the weight of the pixel in the right image.

[0056] And satisfy, a1=d1 / d*100%, a2=d2 / d*100%,

[0057] Among them, d1 is the distance between the pixel and the right edge of the main body area of ​​the left image, d is the distance between the right edge of the main body area of ​​the left image and the left edge of the main body area of ​​the right image, and d2 is the distance between the pixel and the left edge of the main body area of ​​the right image. The stitching area of ​​the two images is processed by the above weighted average method, so that the transition between the left image and the right image is smooth. Then the gaps of other stitching images are merged in the same way, and finally a complete PCB image with good stitching effect is obtained, such as Figure 3 shown.

[0058] S30, obtaining the plug-in points in the PCB image, and obtaining the corresponding plug-in type information and plug-in position information according to the number of pins, angle, hole spacing and hole diameter of adjacent plug-in points.

[0059] In this step, the plug-in type and position information are obtained by obtaining the plug-in points in the PCB image. Among them, when obtaining the plug-in points in the PCB image, since the plug-in is a standard plug-in, the number of pins, angle, hole spacing and hole diameter in each plug-in are fixed. Therefore, the corresponding plug-in type information and plug-in position information (such as the center point position of the plug-in and the angle of the plug-in, etc.) can be obtained according to the number, angle, hole spacing and hole diameter of adjacent plug-in points. For example, when the plug-in is a three-pin plug-in or a two-pin plug-in, different plug-in types can be determined based on the different spacings between the plug-in pins, and the plug-in position can be determined based on the angle of the connection line between the plug-in points. If there are two plug-ins with the same plug-in point spacing, it can be reminded to manually determine the plug-in type.

[0060] Specifically, if the first plug-in hole of the image is detected, all second plug-in holes within a set distance from the first plug-in hole can be queried based on the position of the first plug-in hole, and the distances between all second plug-in holes and the first plug-in hole can be obtained to determine the second plug-in hole paired with the first plug-in hole. If the pairing of the second plug-in hole and the first plug-in hole is unique, the plug-ins corresponding to the first plug-in hole and the second plug-in hole are directly set as two-pin plug-ins.

[0061] If the plug-in is judged to be a three-pin plug-in based on the distance between the first plug-in hole and the second plug-in hole, it is determined whether there is a third plug-in hole within a set distance around the second plug-in hole. If there is a third plug-in hole, the plug-ins corresponding to the first plug-in hole, the second plug-in hole and the third plug-in hole are directly set as three-pin plug-ins.

[0062] If there are more than two matching second plug-in holes around the first plug-in hole, the second plug-in hole is used as a reference to determine the matching first plug-in hole (with the same hole diameter) around the second plug-in hole. If the first plug-in hole corresponding to the second plug-in hole is unique, the plug-in corresponding to the first plug-in hole and the second plug-in hole is set as a two-pin plug-in. The same method is used to determine the plug-in types corresponding to all plug-in holes. When there are first plug-in holes and second plug-in holes that cannot be determined, they are highlighted in the image to facilitate user inspection and confirmation. When the plug-in type of the plug-in hole is determined, the determined plug-in hole is removed from the plug-in holes to be confirmed, and then all plug-in holes to be confirmed are traversed to complete the plug-in type to which each plug-in point in the PCB image belongs.

[0063] S40, calibrate the types and quantities of all the obtained plug-ins, and if the calibration is correct, generate a corresponding PCB offline plug-in schematic diagram.

[0064] In this step, when the plug-in types of all plug-in points in the PCB image are completed, the types and quantities of all plug-ins are obtained, and the types and quantities of plug-ins are calibrated, that is, the types and quantities of the obtained plug-ins are compared with the types and quantities of the PCB preset plug-ins. If they are consistent, the plug-in labels are drawn on the PCB image to generate the corresponding PCB offline plug-in schematic diagram, so that the subsequent equipment can perform automated plug-in operations. If they are inconsistent, they are manually checked, confirmed and modified to ensure that the generated PCB plug-in offline schematic diagram is accurate.

[0065] The offline fast programming method of the plug-in in the present embodiment stitches the graphics of various areas of the PCB taken by the camera into a complete PCB image, and then automatically obtains the plug-in type and position information of the plug-in point in the PCB image to generate a corresponding PCB offline plug-in schematic diagram, which not only reduces the difficulty of manual operation of the equipment and improves the operating efficiency, but also makes the point data editing simple and efficient.

[0066] Although the present invention is disclosed through the above embodiments, the protection scope of the present invention is not limited thereto. Without departing from the concept of the present invention, any deformation, replacement, etc. made to the above components shall fall within the scope of the claims of the present invention.

Claims

1. An offline rapid programming method for a plug-in machine, characterized in that: The method comprises the following steps: a. Use the camera to take images of each area of ​​the PCB; b. stitching the images of the various regions captured into a complete PCB image; c. Obtain the plug-in points in the PCB image, and obtain the corresponding plug-in type information and plug-in position information according to the number of pins, angle, hole spacing and hole diameter of adjacent plug-in points; d. Calibrate the types and quantities of all the plug-ins obtained. If the calibration is correct, generate the corresponding PCB offline plug-in schematic diagram.

2. The offline rapid programming method of the plug-in machine as claimed in claim 1, characterized in that: Step a includes: a1. Preset the camera's calibrated pixel width, the starting and ending positions of the shooting, and calculate the number of shots required in the horizontal and vertical directions; a2. According to the number of shots, the camera automatically positions itself from the starting position to the end position to obtain images of various areas of the PCB.

3. The offline rapid programming method of the plug-in machine as claimed in claim 1, characterized in that: Step b includes: b1. Extracting features from the images of each area captured; b2. Perform edge stitching and matching of images based on image features; b3. Image stitching based on matching results; b4. Perform gap fusion on the stitched images based on the weighted average method.

4. The offline rapid programming method of the plug-in machine as claimed in claim 3, characterized in that: In step b1, feature points in the image of each region captured are extracted by SIFT, and a feature vector is calculated for the region around each feature point.

5. The offline rapid programming method of the plug-in machine as claimed in claim 4, characterized in that: In step b2, based on the feature points and feature vectors of the two images, the edges of the images are matched by FLANN homography to obtain the perspective transformation H matrix.

6. The offline rapid programming method of the plug-in machine as claimed in claim 5, characterized in that: In step b3, the second image is perspective transformed by the inverse matrix of the perspective transformation H matrix to turn it to the same viewing angle as the first image. After the perspective change is completed, the image is directly added to the left side of the image after the perspective change through numpy to cover the overlapping parts and obtain a spliced ​​image.

7. The offline rapid programming method of the plug-in machine as claimed in claim 6, characterized in that: In step b4, a certain proportion of both sides of the splicing part of the splicing image are taken for gap fusion by weighted average method to obtain a complete PCB image.

8. The offline rapid programming method of the plug-in machine as claimed in claim 1, characterized in that: In step c: when obtaining the plug-in points in the PCB image, different plug-in types are determined based on different pitches of plug-in pins; The plug-in position is determined based on the angle of the line between the plug-in points; if the plug-in point spacings of two plug-ins are the same, the plug-in type is determined manually.

9. The offline rapid programming method of the plug-in machine as claimed in claim 8, characterized in that: Step c includes: If the first plug-in hole of the PCB image is detected, all second plug-in holes within a set distance from the first plug-in hole can be queried based on the position of the first plug-in hole, and the distances between all second plug-in holes and the first plug-in hole can be obtained to determine the second plug-in hole paired with the first plug-in hole. If the pairing of the second plug-in hole and the first plug-in hole is unique, the two-pin plug-in corresponding to the first plug-in hole and the second plug-in hole is directly set; If the plug-in is determined to be a three-pin plug-in based on the distance between the first plug-in hole and the second plug-in hole, it is determined whether there is a third plug-in hole within the set distance around the second plug-in hole. If there is a third plug-in hole, the three-pin plug-in corresponding to the first plug-in hole, the second plug-in hole and the third plug-in hole are directly set; If there are more than two matching second plug-in holes around the first plug-in hole, the first plug-in hole matching the second plug-in hole is determined based on the second plug-in hole, and if the first plug-in hole corresponding to the second plug-in hole is unique, the two-pin plug-in corresponding to the first plug-in hole and the second plug-in hole is set; If all the first plug-in holes and second plug-in holes that cannot be determined are highlighted in the picture, the user can check and confirm them.

10. The offline rapid programming method of the plug-in machine according to claim 1, characterized in that: Step d includes: comparing the types and quantities of all acquired plug-ins with the types and quantities of PCB preset plug-ins. If they are consistent, drawing plug-in labels on the PCB image to generate corresponding PCB offline plug-in schematic diagrams.