PCB component positioning method, device, equipment and medium

By extracting the contours of PCB images and analyzing the centroids of solder joints, the problem of inaccurate positioning caused by similar colors of PCB substrates was solved, achieving precise positioning of components, reducing interference from the substrate and silkscreen printing, and improving positioning accuracy.

CN115760693BActive Publication Date: 2025-11-07WUYI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211239297.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-11
Publication Date
2025-11-07
Estimated Expiration
2042-10-11

AI Technical Summary

Technical Problem

In surface mount technology, the similarity between the PCB substrate color and the component color can lead to inaccurate positioning. The silkscreen printing of characters and the outline information of adjacent components can also cause interference, affecting the positioning accuracy of the components.

Method used

By acquiring PCB images, performing contour extraction processing, determining the centroid and constraints of solder joint contours, obtaining target solder joints, calculating center coordinates and edge regions, and utilizing the color and positional features of solder joints to reduce the influence of substrate and character silkscreen printing, components can be accurately located.

Benefits of technology

It achieves precise positioning of components, reduces interference from the contour information of the substrate and adjacent components, and improves positioning accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115760693B_ABST
    Figure CN115760693B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a PCB patch component positioning method, device, equipment and medium, the solder joint contour is obtained by contour extraction processing of the PCB image; the target solder joint of the target component is determined according to the centroid of the solder joint contour and the constraint condition; the center coordinates of the target component are obtained according to the centroid of the target solder joint; the region of interest of the edge of the target component is determined according to the vertex coordinates of the circumscribed rectangle of the edge of the target solder joint; the candidate edge point of the target component is determined according to the gray value of the pixel point of the region of interest; the target edge point is determined from the candidate edge point, and the edge of the target component is fitted according to the target edge point; the position information of the target component is obtained according to the center coordinates of the target component and the edge of the target component; by using the color and position characteristics of the solder joint, the influence of the contour information of the PCB substrate, character silk screen and adjacent components can be reduced, and the component can be accurately positioned.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to, but are not limited to, the field of automation control, and particularly relate to a PCB patch component positioning method, device, equipment and medium. BACKGROUND

[0002] In the surface mount technology process, components need to be positioned, but the following problems exist, resulting in inaccurate positioning: the edge points cannot be completely extracted due to the similar color of the PCB substrate and the component body, and the character silk screen on the PCB substrate and the contour information of the adjacent components will interfere with the target component. SUMMARY

[0003] The following is a summary of the subject matter described in detail herein.

[0004] Embodiments of the present application provide a PCB patch component positioning method, device, equipment and medium.

[0005] In an embodiment of the first aspect of the present application, a PCB patch component positioning method comprises:

[0006] obtaining a PCB image;

[0007] performing contour extraction processing on the PCB image to obtain a solder point contour;

[0008] obtaining the centroid of the solder point contour, and determining a plurality of target solder points corresponding to the target component according to the centroid of the solder point contour and a preset constraint condition;

[0009] obtaining the center coordinates of the target component according to the centroid of the target solder point;

[0010] obtaining the vertex coordinates of the circumscribed rectangle corresponding to the edges of the plurality of target solder points, and determining the region of interest of the edge of the target component according to the vertex coordinates;

[0011] obtaining the gray value of the pixel points of the region of interest, and determining the candidate edge points of the target component according to the gray value;

[0012] determining the target edge point from the candidate edge point, and fitting the edge of the target component according to the target edge point;

[0013] obtaining the position information of the target component according to the center coordinates of the target component and the edge of the target component.

[0014] In some embodiments of the first aspect of the present application, the PCB image is an image obtained by photographing a PCB board under an AOI tower light source; and the contour extraction processing on the PCB image to obtain a solder point contour comprises:

[0015] performing contour extraction processing on the PCB image to obtain a first candidate contour;

[0016] obtaining a perimeter of the first candidate contour, and determining a second candidate contour according to the perimeter of the first candidate contour and a preset perimeter threshold;

[0017] obtaining a glitter metric value of a region surrounded by the second candidate contour, and determining a solder joint contour according to the glitter metric value of the region surrounded by the second candidate contour and a preset glitter threshold.

[0018] In some embodiments of the first aspect of the application, the determining of the plurality of target solder joints corresponding to the target component according to the centroid of the solder joint contour and a preset constraint condition comprises:

[0019] taking the centroid of any three solder joint contours, and obtaining three sides according to the centroid of the three solder joint contours;

[0020] when the three sides satisfy the constraint condition, taking the solder joints corresponding to the three solder joint contours as the target solder joints.

[0021] In some embodiments of the first aspect of the application, the constraint condition is: wherein a, b and c correspond to the three sides, and m is a preset constant value.

[0022] In some embodiments of the first aspect of the application, the determining of the candidate edge point of the target component according to the grayscale value comprises:

[0023] sequentially sorting each row of pixel points of the region of interest from large to small according to the grayscale value;

[0024] for each row of pixel points, taking the first k pixel points as the candidate edge point of the target component.

[0025] In some embodiments of the first aspect of the application, the determining of the target edge point from the candidate edge point comprises:

[0026] iterating the following operations to obtain a plurality of edge point sets: taking any two of the candidate edge points as a first edge point and the others as a second edge point, determining a straight line from the first edge point, and taking the second edge point whose distance value to the straight line is less than a preset distance threshold as a third edge point, and composing an edge point set from the third edge point;

[0027] calculating the number value of the third edge point in the edge point set, and taking the third edge point in the edge point set with the largest number value as the target edge point.

[0028] In some embodiments of the first aspect of the application, the PCB patch component positioning method comprises:

[0029] calculating a first offset angle of the target component according to the centroid of the solder joint contour;

[0030] calculating a second offset angle of the target component according to the edge of the target component;

[0031] obtaining a total offset angle according to the first offset angle and the second offset angle;

[0032] rotating the PCB image according to the total offset angle.

[0033] Embodiments of the second aspect of the application, a PCB patch component positioning device, comprising:

[0034] an image acquisition module, configured to acquire a PCB image;

[0035] a contour extraction module, configured to perform contour extraction processing on the PCB image to obtain a solder joint contour;

[0036] a target solder joint determination module, configured to acquire a centroid of the solder joint contour, and determine a plurality of target solder joints corresponding to the target component according to the centroid of the solder joint contour and a preset constraint condition;

[0037] a center coordinate determination module, configured to obtain a center coordinate of the target component according to the centroid of the target solder joint;

[0038] an edge region determination module, configured to acquire a vertex coordinate of a circumscribed rectangle corresponding to an edge of a plurality of target solder joints, and determine a region of interest of the edge of the target component according to the vertex coordinate;

[0039] a candidate edge point determination module, configured to acquire a gray value of a pixel point of the region of interest, and determine a candidate edge point of the target component according to the gray value;

[0040] an edge determination module, configured to determine a target edge point from the candidate edge point, and fit an edge of the target component according to the target edge point;

[0041] a position information determination module, configured to obtain position information of the target component according to the center coordinate of the target component and the edge of the target component.

[0042] Embodiments of the third aspect of the application, an electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the PCB patch component positioning method as described above.

[0043] The embodiment of the fourth aspect of the application is a computer readable storage medium storing computer executable instructions for performing the PCB patch element positioning method as described above.

[0044] The above scheme has at least the following beneficial effects: the solder joint contour is obtained by contour extraction processing on the PCB image; the centroid of the solder joint contour is obtained, and the target solder joints corresponding to the target component are determined according to the centroid of the solder joint contour and a preset constraint condition; the center coordinates of the target component are obtained according to the centroid of the target solder joint; the vertex coordinates of the circumscribed rectangle corresponding to the edges of the target solder joints are obtained, and the region of interest of the edge of the target component is determined according to the vertex coordinates; the gray values of the pixel points of the region of interest are obtained, and the candidate edge points of the target component are determined according to the gray values; the target edge points are determined from the candidate edge points, and the edge of the target component is fitted according to the target edge points; the position information of the target component is obtained according to the center coordinates of the target component and the edge of the target component; by using the color and position features of the solder joints, the influence of the contour information of the PCB substrate, character silk screen and adjacent components is reduced, and the component can be accurately positioned. BRIEF DESCRIPTION OF DRAWINGS

[0045] The accompanying drawings are used to provide a further understanding of the technical scheme of the application, and constitute a part of the specification, and are used to explain the technical scheme of the application together with the embodiments of the application, and do not constitute a limitation on the technical scheme of the application.

[0046] Figure 1 is a step diagram of the PCB patch element positioning method provided by the embodiment of the application;

[0047] Figure 2 is a sub-step diagram of step S200;

[0048] Figure 3 is a sub-step diagram of step S300;

[0049] Figure 4 is a sub-step diagram of step S600;

[0050] Figure 5 is a sub-step diagram of the rotation correction step;

[0051] Figure 6 is a PCB image marked with a circumscribed rectangle and a region of interest.

[0052] Figure 7 is a structure diagram of the PCB patch element positioning device provided by the embodiment of the application. DETAILED DESCRIPTION

[0053] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.

[0054] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in a manner different from the module division in the device or the sequence in the flowchart. The terms "first", "second", etc. in the specification, claims or above-described drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.

[0055] The embodiments of the present application will be further described below with reference to the drawings.

[0056] The embodiments of the present application provide a PCB patch component positioning method.

[0057] With reference to Figure 1 , the PCB patch component positioning method includes but is not limited to the following steps:

[0058] Step S100, acquiring a PCB image;

[0059] Step S200, performing contour extraction processing on the PCB image to obtain a solder joint contour;

[0060] Step S300, acquiring the centroid of the solder joint contour, and determining a plurality of target solder joints corresponding to a target component according to the centroid of the solder joint contour and a preset constraint condition;

[0061] Step S400, obtaining the center coordinates of the target component according to the centroid of the target solder joint;

[0062] Step S500, acquiring the vertex coordinates of the circumscribed rectangle 101 corresponding to the edges of the plurality of target solder joints, and determining the region of interest 102 of the edge of the target component according to the vertex coordinates;

[0063] Step S600, acquiring the gray value of the pixel points of the region of interest 102, and determining the candidate edge points of the target component according to the gray value;

[0064] Step S700, determining the target edge points from the candidate edge points, and fitting the edge of the target component according to the target edge points;

[0065] Step S800, obtaining the position information of the target component according to the center coordinates of the target component and the edge of the target component.

[0066] In this embodiment, by using the color and location characteristics of the soldering points, the influence of the PCB substrate, character silk screen and the outline information of adjacent components is reduced, and the components can be accurately positioned.

[0067] For step S100, the PCB substrate with the electronic components is photographed by a photographic device to obtain a PCB image.

[0068] The PCB image is preprocessed, for example, the PCB image is filtered, and the filtered image is subjected to gray scale conversion, threshold segmentation, and the PCB image is converted into a black and white image with pixel gray scale values of 0 and 255. Image preprocessing can reduce the noise caused by the deformation of the carrier or the board, the micro-vibration of the platform, the instability of the light source, the dirt on the soldering pad, and the like, and is conducive to improving the subsequent positioning accuracy.

[0069] Reference Figure 2 For step S200, the PCB image is obtained by photographing the PCB under the AOI tower light source; the PCB image is subjected to contour extraction processing to obtain a soldering point contour, including but not limited to the following steps:

[0070] Step S210, the PCB image is subjected to contour extraction processing to obtain a first candidate contour;

[0071] Step S220, the perimeter of the first candidate contour is obtained, and a second candidate contour is determined according to the perimeter of the first candidate contour and a preset perimeter threshold;

[0072] Step S230, the glitz metric value of the region surrounded by the second candidate contour is obtained, and a soldering point contour is determined according to the glitz metric value of the region surrounded by the second candidate contour and a preset glitz threshold.

[0073] For step S210, the first candidate contour is obtained by contour extraction algorithm, for example, the CV2.findContours() function in python, the PCB image is subjected to contour extraction processing. The algorithm scans the image to obtain edge points and judges the type of the edge points, then finds the next edge point in the connected domain of the edge point, and determines the hierarchical relationship of the edges by encoding different edges. The contour extraction of the binary PCB image is better.

[0074] For steps S220 and S230, during the contour detection process, there will always be background interference and noise interference, and the gray scale values of the interference contours, such as the sub-contours in the target soldering point contour, the soldering point contours of adjacent components, and the contours of the silk screen characters on the substrate, are not much different from the gray scale values of the target to be detected.

[0075] When the perimeter of the first candidate contour of the pattern in the PCB image meets the preset perimeter threshold range, the first candidate contour is determined as the second candidate contour.

[0076] But due to the proximity of the perimeter of part of the interference contour to the target solder joint, the perimeter threshold alone cannot accurately determine the solder joint contour. The solder joint presents special color and texture characteristics under the AOI tower light source. By obtaining the sparkle metric value of the area enclosed by the second candidate contour, the solder joint contour is determined according to the sparkle metric value of the area enclosed by the second candidate contour and the preset sparkle threshold.

[0077] Combining the perimeter and the sparkle metric value, the interference contour is removed from two aspects, which can more accurately determine the solder joint contour.

[0078] For step S300, the centroid of the solder joint contour is calculated, and then the multiple target solder joints corresponding to the target component are determined according to the centroid of the solder joint contour and the preset constraint condition.

[0079] Specifically, the adjacent solder joint contour and the target contour are consistent in color, texture, shape, size, sparkle metric value and other characteristics, and the solder joint contour cannot be removed by these characteristics. The target solder joints corresponding to the target component need to be determined according to the solder joint structure characteristics of the target component.

[0080] Referring to Figure 3 , the multiple target solder joints corresponding to the target component are determined according to the centroid of the solder joint contour and the preset constraint condition, including but not limited to the following steps:

[0081] Step S310, taking the centroids of any three solder joint contours, and obtaining three sides according to the centroids of the three solder joint contours.

[0082] Step S320, when the three sides meet the constraint condition, the solder joints corresponding to the three solder joint contours are taken as the target solder joints.

[0083] For example, for a triode, the structure characteristics of the three solder joints meet: (1) the centroid connection line of the three solder joints forms a triangle; (2) the triangle is an acute triangle; (3) the lengths of two sides are not much different.

[0084] Therefore, the constraint condition is: In the formula, a, b and c correspond to the three sides, and m is a preset constant value. Specifically, m takes the value of 5.

[0085] For step S400, the center coordinates of the target component are obtained according to the centroid of the target solder joint.

[0086] For example, the centroid coordinates of the three solder joints are A(cx1, cy1), B(cx2, cy2) and C(cx3, cy3), and the center coordinates of the target component are

[0087] The first offset angle of the target component can also be calculated according to the centroid of the solder joint contour. The D point coordinates are defined as (cx1+5, cy1). Then, there are ∠ABC = arcos((b2-a2-c2) / (-2*a*c)), ∠ABD = arcos((AD2-c2-BD2) / (-2*BD*c)). Further, the first offset angle is α = ∠DBC = ∠ABC- ∠ABD.

[0088] The PCB image is rotated at the angle of the first offset angle so that the target component is deviated to the positive direction, facilitating subsequent coordinate calculation.

[0089] Referring to Figure 6 For step S500, the vertex coordinates of the circumscribed rectangle 101 corresponding to the edges of the plurality of target solder joints are obtained, and the region of interest 102 of the edge of the target component is determined according to the vertex coordinates.

[0090] Table 1 shows the parameters of the circumscribed rectangle 101 of the three target solder joints

[0091] Bump number 1 2 3 Width (pixel) w1 w2 w3 Height (pixel) [CDATA[h2]]> h2 h3 Upper left corner coordinate (pixel) (a1,b1) (c1,d1) (e1,f1) Lower left corner coordinate (pixel) (a2,b2) (c2,d2) (e2,f2) Right lower corner coordinate (pixel) (a3, b3) (c3,d3) (e3,f3) Right upper corner coordinate (pixel) (a4,b4) (c4,d4) (e4,f4)

[0092] For example, the vertex coordinates of the three target solder joints are shown in Table 1.

[0093] Table 2 shows the parameters of the region of interest 102 of the edge of the target component

[0094] ROI number 1 2 Upper left corner coordinate (pixel) (c1,b2) (c1,d1-k) <!-- 5 -->]]> Right lower corner coordinate (pixel) (f3, b3 + k) (f3,d1) Width (pixel) [f3-c1] [f3-c1] Height (pixel) k k

[0095] The region of interest 102 of the upper and lower edges of the target component in Table 2 can be obtained from the vertex coordinates of the three target solder joints in Table 1.

[0096] Referring to Figure 4 For step S600, since the gray value of adjacent pixels changes slowly, it increases the difficulty of extracting edge points.

[0097] The gray value of the pixel points in the region of interest 102 is obtained, and then the candidate edge points of the target component are determined according to the gray value.

[0098] The candidate edge points of the target component are determined according to the gray value, including but not limited to the following steps:

[0099] In step S610, the pixel points in each row of the region of interest 102 are sorted from large to small according to the gray value.

[0100] Step S620, for each row of pixel points, the first k pixel points are taken as candidate edge points of the target component.

[0101] Specifically, the maximum value, the second maximum value and the third maximum value of each row of pixel points are selected as candidate edge points.

[0102] For step S700, the target edge points are determined from the candidate edge points, and then the edge of the target component is fitted according to the target edge points.

[0103] The target edge points are determined from the candidate edge points, including but not limited to the following steps:

[0104] The following operations are iterated to obtain a plurality of edge point sets: any two of the candidate edge points are selected as first edge points, and the others are selected as second edge points, a straight line is determined from the first edge points, and the third edge points are determined from the second edge points whose distance values to the straight line are less than a preset distance threshold, and the third edge points form an edge point set;

[0105] The number value of the third edge points in the edge point set is calculated, and the third edge points in the edge point set with the maximum number value are taken as the target edge points.

[0106] For step S800, the position information of the target component is obtained according to the center coordinates of the target component and the edge of the target component, and the accurate positioning of the target component is realized.

[0107] In addition, the PCB patch component positioning method further comprises a rotation correction step of the PCB image.

[0108] Reference Figure 5 The rotation correction step includes but is not limited to the following steps:

[0109] Step S910, a first offset angle of the target component is calculated according to the centroid of the solder joint contour;

[0110] Step S920, a second offset angle of the target component is calculated according to the edge of the target component;

[0111] Step S930, a total offset angle is obtained according to the first offset angle and the second offset angle;

[0112] Step S940, the PCB image is rotated according to the total offset angle.

[0113] For the second offset angle, the angles between the edge of the target component fitted by the target edge points and the horizontal axis direction are calculated to obtain φ1 and φ2. Then the second offset angle is φ=(φ1+φ2) / 2. If the straight line is offset upwards by φ, it is negative, and if the straight line is offset to the right and down by φ, it is positive.

[0114] For the total offset angle, the total offset angle is φ'=α+φ.

[0115] Finally, the PCB image is rotated according to the total offset angle, so that the target component position in the PCB image is positive.

[0116] Embodiments of the present application provide a PCB patch component positioning device.

[0117] With reference to Figure 7 The PCB patch component positioning device comprises an image acquisition module 10, an outline extraction module 20, a target solder point determination module 30, a center coordinate determination module 40, an edge region determination module 50, a candidate edge point determination module 60, an edge determination module 70, and a position information determination module 80.

[0118] The image acquisition module 10 is configured to acquire a PCB image; the outline extraction module 20 is configured to perform outline extraction processing on the PCB image to obtain a solder point outline; the target solder point determination module 30 is configured to obtain the centroid of the solder point outline and determine a plurality of target solder points corresponding to a target component according to the centroid of the solder point outline and a preset constraint condition; the center coordinate determination module 40 is configured to obtain the center coordinate of the target component according to the centroid of the target solder points; the edge region determination module 50 is configured to obtain the vertex coordinates of a circumscribed rectangle 101 corresponding to the edge of the plurality of target solder points, and determine a region of interest 102 of the edge of the target component according to the vertex coordinates; the candidate edge point determination module 60 is configured to obtain the gray value of a pixel point of the region of interest 102, and determine a candidate edge point of the target component according to the gray value; the edge determination module 70 is configured to determine a target edge point from the candidate edge point, and fit the edge of the target component according to the target edge point; and the position information determination module 80 is configured to obtain the position information of the target component according to the center coordinate of the target component and the edge of the target component.

[0119] It can be understood that the contents in the PCB patch component positioning method embodiment are all applicable to the present PCB patch component positioning device embodiment, the functions specifically realized by the PCB patch component positioning device embodiment are the same as those of the PCB patch component positioning method embodiment, and the beneficial effects achieved by the PCB patch component positioning device embodiment are also the same as those achieved by the PCB patch component positioning method embodiment.

[0120] Embodiments of the present application provide an electronic device. The electronic device comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the PCB patch component positioning method as described above when executing the computer program.

[0121] The electronic device can be any intelligent terminal including a tablet computer, a vehicle-mounted computer, etc.

[0122] Generally, for the hardware structure of the electronic device, the processor can be implemented in the form of a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., for executing related programs to implement the technical solutions provided by the embodiments of the present application.

[0123] The memory can be implemented in the form of a ROM (ReadOnly Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), etc. The memory can store an operating system and other application programs, and when the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory and are called and executed by the processor to implement the data monitoring method of the embodiments of the present application.

[0124] The input / output interface is used to realize information input and output.

[0125] The communication interface is used to realize the communication interaction between the device and other devices, and the communication can be realized by a wired manner (for example, a USB, a network cable, etc.) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, etc.).

[0126] The bus transmits information between various components (for example, the processor, the memory, the input / output interface, and the communication interface) of the device. The processor, the memory, the input / output interface, and the communication interface realize the communication connection between each other in the device through the bus.

[0127] The embodiments of the present application provide a computer readable storage medium. The computer readable storage medium stores computer executable instructions, and the computer executable instructions are used to execute the PCB patch element positioning method as described above.

[0128] It should be appreciated that the method steps in the embodiments of the present application can be realized or implemented by computer hardware, a combination of hardware and software, or through computer instructions stored in a non-transitory computer readable storage medium. The method can use standard programming techniques. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if necessary, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. In addition, for this purpose, the program can run on a programmed special-purpose integrated circuit.

[0129] Further, operations of the processes described herein can be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) can be implemented under the control of one or more computer systems configured with executable instructions, and can be implemented as code (e.g., executable instructions, one or more computer programs or one or more applications) executing collectively on one or more processors, by hardware or combinations thereof. The computer programs include a plurality of instructions executable by one or more processors.

[0130] Further, the methods can be implemented in any suitable type of computing platform operatively connected to, including but not limited to, a personal computer, a smart phone, a mainframe, a workstation, a network or distributed computing environment, a stand-alone or integrated computer platform, or in communication with a charged particle tool or other imaging device, and the like. Aspects of the present application can be implemented in machine readable code stored on a non-transitory storage medium or device, whether removable or integrated to the computing platform, such as a hard disk, an optical read and / or write storage medium, RAM, ROM, and the like, such that it is readable by a programmable computer and, when the storage medium or device is read by the computer, is used to configure and operate the computer to perform the processes described herein. Further, the machine readable code, or portions thereof, can be transmitted over a wired or wireless network. The present application described herein includes these and other different types of non-transitory computer readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The present application also includes the computer itself when programmed in accordance with the methods and techniques described herein.

[0131] The computer program can be applied to input data to perform the functions described herein to transform the input data to generate output data that is stored to non-volatile memory. The output information can also be applied to one or more output devices such as a display. In a preferred embodiment of the present application, the transformed data represents a physical and tangible object, including a particular visual depiction of the physical and tangible object produced on a display.

[0132] While the embodiments of the application have been shown and described, it is to be understood that the embodiments described are merely exemplary and are not to be construed as limiting the scope of the application. The scope of the application is to be determined by the claims and their equivalents.

[0133] The above is a specific description of the preferred embodiments of the present application, but the present application is not limited to the embodiments, and those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the present application, and these equivalent modifications or replacements are all included in the scope defined by the claims of the present application.

Claims

1. A method of positioning a PCB patch component, characterized by, The method comprises the following steps: obtaining a PCB image; performing contour extraction processing on the PCB image to obtain a solder joint contour; obtaining the centroid of the solder joint contour, and determining a plurality of target solder joints corresponding to a target component according to the centroid of the solder joint contour and a preset constraint condition; obtaining the center coordinates of the target component according to the centroid of the target solder joint; obtaining the vertex coordinates of the circumscribed rectangle corresponding to the edges of the plurality of target solder joints, and determining the region of interest of the edge of the target component according to the vertex coordinates; obtaining the gray value of the pixel points in the region of interest, and determining the candidate edge points of the target component according to the gray value; determining the target edge points from the candidate edge points, and fitting the edge of the target component according to the target edge points; obtaining the position information of the target component according to the center coordinates of the target component and the edge of the target component; wherein the determination of the plurality of target solder joints corresponding to the target component according to the centroid of the solder joint contour and the preset constraint condition comprises: taking any three centroids of the solder joint contours, and obtaining three edges according to the three centroids of the solder joint contours; when the three edges satisfy the constraint condition, taking the solder joints corresponding to the three solder joint contours as the target solder joints; The constraint condition is: Wherein, a, b and c correspond to three sides, and m is a preset constant value.

2. The method of claim 1, wherein, the PCB image is an image obtained by shooting a PCB board located under an AOI tower light source; the contour extraction processing on the PCB image to obtain a solder joint contour comprises: performing contour extraction processing on the PCB image to obtain a first candidate contour; obtaining the circumference of the first candidate contour, and determining a second candidate contour according to the circumference of the first candidate contour and a preset circumference threshold; obtaining the glitz metric value of the region surrounded by the second candidate contour, and determining a solder joint contour according to the glitz metric value of the region surrounded by the second candidate contour and a preset glitz threshold.

3. The method of claim 1, wherein, The determination of the candidate edge points of the target component according to the gray value comprises: sorting each row of pixel points in the region of interest from large to small according to the gray value; for each row of pixel points, taking the first k pixel points as the candidate edge points of the target component.

4. The method of claim 1, wherein, The determination of the target edge points from the candidate edge points comprises: iterating the following operations to obtain a plurality of edge point sets: taking any two of the candidate edge points as a first edge point and the others as a second edge point, determining a straight line from the first edge point, and taking the second edge point whose distance to the straight line is less than a preset distance threshold as a third edge point to form an edge point set; calculating the number of third edge points in the edge point set, and taking the third edge point in the edge point set with the maximum number as the target edge point.

5. The method of claim 1, wherein, The PCB patch component positioning method comprises: calculating a first offset angle of the target component according to the centroid of the solder joint contour; calculating a second offset angle of the target component according to the edge of the target component; obtaining a total offset angle according to the first offset angle and the second offset angle; rotating the PCB image according to the total offset angle.

6. A PCB patch component positioning device, characterized by, The method comprises the following steps: an image acquisition module for obtaining a PCB image; a contour extraction module configured to perform contour extraction on the PCB image to obtain solder joint contours; a target solder joint determination module configured to obtain the centroid of each solder joint contour, and determine a plurality of target solder joints corresponding to a target component according to the centroid of each solder joint contour and a preset constraint condition; a center coordinate determination module configured to obtain the center coordinate of the target component according to the centroid of each target solder joint; an edge region determination module configured to obtain the vertex coordinates of the circumscribed rectangle corresponding to the edge of each target solder joint, and determine the region of interest of the edge of the target component according to the vertex coordinates; a candidate edge point determination module configured to obtain the gray value of each pixel point in the region of interest, and determine the candidate edge point of the target component according to the gray value; an edge determination module configured to determine the target edge point from the candidate edge point, and fit the edge of the target component according to the target edge point; a position information determination module configured to obtain the position information of the target component according to the center coordinate of the target component and the edge of the target component; wherein the target solder joints corresponding to the target component are determined according to the centroid of each solder joint contour and a preset constraint condition, including: obtaining three edges according to the centroid of any three solder joint contours; when the three edges satisfy the constraint condition, taking the solder joints corresponding to the three solder joint contours as the target solder joints; The constraint condition is: Wherein, a, b and c correspond to three sides, and m is a preset constant value.

7. An electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the PCB component positioning method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, a computer executable instruction is stored, and the computer executable instruction is used to execute the PCB component positioning method according to any one of claims 1 to 5.