Method, device, equipment and medium for aligning PCB electronic design drawing with physical drawing
By using affine transformation matrix alignment design drawings and real objects in PCB detection, the error detection and missed detection problem of traditional manual detection is solved, and the precise pad positioning of machine vision detection is realized, which improves detection efficiency and accuracy.
Patent Information
- Application Number
- CN202311169635.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-12
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2043-09-12
AI Technical Summary
Traditional PCB components detection relies on manual labor, resulting in long detection time, frequent missed detection and high cost. In machine vision detection, there are difficulties in how to accurately and automatically locate the pad area.
By selecting multiple regions from the PCB electronic design diagram to determine the coordinates of the center point, determining the coordinates of the center point from the real image, generating an affine transformation matrix for image alignment, segmenting the foreground area and determining the target area of the connecting domain, further performing affine Transform for precise alignment.
It realizes accurate alignment of PCB electronic design drawings and real objects, reduces the error of subsequent machine vision detection, improves detection speed and accuracy, and reduces costs.
Smart Images

Figure CN117131831B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of visual inspection technology, and in particular relates to a method, device, equipment and medium for aligning a PCB electronic design drawing with a physical drawing. Background Art
[0002] Traditional PCB component inspection uses manual methods, which not only takes a long time but is also prone to false detection and missed detection. The cost of manual inspection is also very high, which can no longer meet the current production requirements. Therefore, it is very necessary and meaningful to replace manual inspection with a PCB inspection system based on machine vision. The foundation of machine vision inspection lies in the processing of digital images. By collecting images, positioning, and inspecting a set of system processes, compared with traditional manual inspection, it not only increases the inspection speed but also reduces the cost.
[0003] In the conventional machine vision inspection process of PCB, the inspection area is completed by manual drawing. However, PCB boards usually have more than tens of thousands of pads, which cannot be completed well by manual work in a short period of time. Therefore, it is very necessary to accurately and automatically locate each pad area.
[0004] Gerber files are the output of the circuit design process, containing all kinds of details used in circuit board manufacturing. They are an important part of the PCB printing and manufacturing process. They include various layers, such as conductor layers, wiring pads, and solder mask layers. Gerber files also contain physical information of the PCB, such as the line width and size of the pads. It can be seen that Gerber files can reflect all the information of the PCB. With the help of Gerber files, it is easy to locate all pad areas. However, Gerber files are theoretical standard files. How to accurately align the images presented by the Gerber files with the real-time collected PCB images is an urgent problem to be solved. Summary of the invention
[0005] Based on this, in order to solve the above technical problems, a method, device, equipment and medium for aligning a PCB electronic design drawing with a physical drawing are provided.
[0006] The technical solution adopted by the present invention is as follows:
[0007] As a first aspect of the present invention, a method for aligning a PCB electronic design drawing with a physical drawing is provided, comprising:
[0008] S101, selecting a plurality of first areas from the PCB electronic design drawing, determining the coordinates of the center points of the plurality of first areas, determining a plurality of second areas corresponding to the plurality of first areas from the physical drawing, and determining the coordinates of the center points of the plurality of second areas;
[0009] S102, determining a first affine transformation matrix through the center point coordinates of the plurality of first regions and the center point coordinates of the plurality of second regions, and performing an affine transformation on the PCB electronic design drawing through the first affine transformation matrix to obtain an affine transformation map;
[0010] S103, segmenting a foreground area from the physical image;
[0011] S104, determining a target area in the foreground area corresponding to each connected region in the affine transformation map;
[0012] S105 . Determine a second affine transformation matrix through the coordinates of the center points of the connected domains and the coordinates of the center points of the target regions, and perform affine transformation on the affine transformation map through the second affine transformation matrix.
[0013] As a second aspect of the present invention, a device for aligning a PCB electronic design drawing with a physical drawing is provided, comprising:
[0014] A coordinate determination module, used to select a plurality of first areas from the PCB electronic design drawing, determine the coordinates of the center points of the plurality of first areas, determine a plurality of second areas corresponding to the plurality of first areas from the physical drawing, and determine the coordinates of the center points of the plurality of second areas;
[0015] A first affine transformation module is used to determine a first affine transformation matrix through the center point coordinates of the plurality of first areas and the center point coordinates of the plurality of second areas, and perform affine transformation on the PCB electronic design drawing through the first affine transformation matrix to obtain an affine transformation map;
[0016] A foreground segmentation module, used to segment a foreground area from the physical image;
[0017] A target region determination module, used to determine the target region in the foreground region corresponding to each connected region in the affine transformation map;
[0018] The second affine transformation module is used to determine a second affine transformation matrix through the center point coordinates of each connected domain and the center point coordinates of each target area, and perform affine transformation on the affine transformation map through the second affine transformation matrix.
[0019] As a third aspect of the present invention, an electronic device is provided, comprising a storage module, wherein the storage module comprises instructions loaded and executed by a processor, wherein when the instructions are executed, the processor executes a method for aligning a PCB electronic design drawing with a physical drawing according to the first aspect.
[0020] As a fourth aspect of the present invention, a computer-readable storage medium is provided, which stores one or more programs. When the one or more programs are executed by a processor, a method for aligning a PCB electronic design drawing with a physical drawing of the above-mentioned first aspect is implemented.
[0021] The present invention first performs a rough alignment through multiple point pairs in the PCB electronic design drawing and the physical drawing, and then matches the pad areas in the two drawings to obtain more point pairs, and then performs precise alignment based on more point pairs. Not only is the alignment accurate, but the overall situation is also taken into consideration, which is helpful for subsequent machine vision inspection of the PCB board. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments:
[0023] Figure 1 A flowchart of a method for aligning a PCB electronic design drawing with a physical drawing provided by an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of a device for aligning a PCB electronic design drawing with a physical drawing provided by an embodiment of the present invention;
[0025] Figure 3 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following will illustrate the implementation methods of the present invention in conjunction with the drawings in the specification. It should be noted that the implementation methods involved in this specification are not exhaustive and do not represent the only implementation methods of the present invention. The following corresponding embodiments are only for the purpose of clearly illustrating the invention content of the patent of the present invention, and are not intended to limit its implementation methods. For ordinary technicians in this field, different forms of changes and modifications can be made on the basis of the description of this embodiment. All obvious changes or modifications that belong to the technical concept and invention content of the present invention are also within the scope of protection of the present invention.
[0027] like Figure 1 As shown, the embodiment of the present application provides a method for aligning a PCB electronic design drawing with a physical drawing, including:
[0028] S101, selecting a plurality of first areas from a PCB electronic design drawing, determining the coordinates of the center points of the plurality of first areas, determining a plurality of second areas corresponding to the plurality of first areas from a PCB physical drawing, and determining the coordinates of the center points of the plurality of second areas.
[0029] In this embodiment, the PCB electronic design drawing GRegion refers to a drawing presented after opening the Gerber file, which is composed of many regions, and these regions may belong to different set rules and may belong to different levels.
[0030] There are at least three selected first regions and second regions, and according to the theory of affine transformation, the multiple mapped points should be dispersed as much as possible, so the selected regions should also be dispersed as much as possible.
[0031] For example, four first regions may be selected, such as four first regions located at the four corners of the PCB electronic design drawing, and the center points of the four regions are P 1 , P 2 , P 3 , P 4 The center points of the four second regions corresponding to the physical image Image are I 1 ,I 2 ,I 3 ,I 4 , the pixel coordinates of each center point are: P 1 =(1905,2115),P 2 =(2652,13198),P 3 =(22989,13098),P 4 =(22838,2021),I 1 =(2012,145),I 2 =(2719,11127),I 3 =(22743,10121),I 4 =(22701,45).
[0032] S102, determine the first affine transformation matrix hom2 through the center point coordinates of the multiple first regions and the center point coordinates of the multiple second regions, and perform affine transformation on the PCB electronic design drawing GRegion through the first affine transformation matrix hom2 to obtain an affine transformation graph RegionAffine:
[0033] The first affine transformation matrix hom2 is generated through Halcon's transformation matrix generation operator vector_to_hom_mat2d(NewPoint,OldPoint,hom2), and affine transformation is performed through Halcon's affine transformation operator affine_trans_region(GRegion,RegionAffine,hom2,Interpolate).
[0034] As in the above example,
[0035] Among them, Interpolate represents the boundary limit processing method, here Interpolate = 'constant', and in halcon it represents the bilinear interpolation method.
[0036] The physical image may have deviations in the incoming material angle and position when it is collected, so in step S102, the PCB electronic design drawing GRegion is roughly aligned with the physical image through affine transformation.
[0037] S103. Segment the foreground area from the physical image. The foreground area can be understood as a collection of pad areas in the physical PCB image. Use Halcon's static threshold segmentation operator threshold(Image, Regions, Min, Max) to segment the foreground area Regions from the physical image Image. Max and Min represent the upper and lower limits of the grayscale value, such as Max=180 and Min=20.
[0038] S104, determining the target area corresponding to each connected domain in the foreground area and the affine transformation map, the connected domain can be understood as the pad area in the PCB electronic design diagram GRegion, and the target area is the corresponding pad area in the foreground area:
[0039] (41) Select the first connected region R in the affine transformation graph RegionAffine 0 ,SP 0 is the connected domain R 0 The center point coordinates of .
[0040] (42) According to the connected domain R i The center point coordinates SP i , through Halcon's area operator area_center(SP i ,Area,Row,Column) calculates the first area of the connected domain, where i∈[1,n], n represents the number of connected domains in the affine transformation graph RegionAffine, and Row and Column are SP i The horizontal and vertical coordinate values of .
[0041] (43) Find the connected domain R through Halcon's intersection operator i The intersection with the foreground region Regions determines the foreground region Regions and the connected domain R i The corresponding target region RegionIntersection.
[0042] In actual scenarios, the actual pad area (target area) may have processing accuracy, so that the target area may be outside the corresponding connected domain. Therefore, in step (43), the dilation operator dilation_circle (SP i ,SP i Dilation,rad) for the connected domain R i Perform expansion processing to expand the connected domain R i , so that it can completely contain the target area, and the expanded connected domain is represented by SP i Dilation, expand the pixel radius rad = 5, and then use Halcon's intersection operator intersection (SP i Dilation, Regions, RegionIntersection) find the intersection of the connected domain after dilation and the foreground region, and determine the foreground region Regions with the connected domain R i The corresponding target region RegionIntersection.
[0043] (44) According to the center point coordinate SI of the target region RegionIntersection i , calculate the second area of the target region RegionIntersection through Halcon's area operator area_center.
[0044] (45) In actual scenes, the image has a lot of noise, and some areas are not pads. Therefore, in order to remove the noise, the second area can be compared with the first area. If the ratio of the second area to the first area is within a preset range, the corresponding target area is retained. For example, the preset range can be 0.9-2.5.
[0045] (46) Repeat (41)-(45) until all connected domains in the affine transformation map are traversed, and the target area in the foreground area corresponding to each connected domain in the affine transformation map is determined.
[0046] S105, determine a second affine transformation matrix through the coordinates of the center points of each connected domain and the coordinates of the center points of each target region, and perform affine transformation on the affine transformation map RegionAffine through the second affine transformation matrix:
[0047] Generate through Halcon's transformation matrix generation operator vector_to_hom_mat2d (SP 1 ,SP 2 ,…,SP n ) to (SI 1 ,SI 2 ,…,SI n)'s affine transformation matrix hom3, and perform affine transformation through Halcon's affine transformation operator affine_trans_region(RegionAffine,RegionOut,hom3,Interpolate). The final output RegionOut is a picture that is precisely aligned with the actual PCB picture, where Interpolate = 'constant'.
[0048] From the above, it can be seen that the embodiment of the present application first performs a rough alignment through multiple point pairs in the PCB electronic design drawing and the physical drawing, and then matches the pad areas in the two drawings to obtain more point pairs, and then performs precise alignment based on more point pairs. Not only is the alignment accurate, but it also takes the overall situation into consideration, which is helpful for subsequent machine vision inspection of the PCB board.
[0049] The following will describe in detail the alignment device of the PCB electronic design drawing and the physical drawing according to one or more embodiments of the present invention. It can be understood by those skilled in the art that these generation devices can be configured by using commercially available hardware components through the steps taught in this solution. Figure 2 A device for aligning a PCB electronic design drawing with a physical drawing provided by an embodiment of the present invention is shown. Figure 2 As shown, the alignment device includes a coordinate determination module 11, a first affine transformation module 12, a foreground segmentation module 13, a target area determination module 14 and a second affine transformation module 15.
[0050] The coordinate determination module 11 is used to select multiple first areas from the PCB electronic design drawing, determine the center point coordinates of the multiple first areas, determine multiple second areas corresponding to the multiple first areas from the PCB physical drawing, and determine the center point coordinates of the multiple second areas.
[0051] In this embodiment, the PCB electronic design drawing GRegion refers to a drawing presented after opening the Gerber file, which is composed of many regions, and these regions may belong to different set rules and may belong to different levels.
[0052] There are at least three selected first regions and second regions, and according to the theory of affine transformation, the multiple mapped points should be dispersed as much as possible, so the selected regions should also be dispersed as much as possible.
[0053] For example, four first regions may be selected, such as four first regions located at the four corners of the PCB electronic design drawing, and the center points of the four regions are P 1 , P 2 , P 3 , P 4 The center points of the four second regions corresponding to the physical image Image are I 1 ,I2 ,I 3 ,I 4 , the pixel coordinates of each center point are: P 1 =(1905,2115),P 2 =(2652,13198),P 3 =(22989,13098),P 4 =(22838,2021),I 1 =(2012,145),I 2 =(2719,11127),I 3 =(22743,10121),I 4 =(22701,45).
[0054] The first affine transformation module 12 is used to determine the first affine transformation matrix hom2 through the center point coordinates of the multiple first regions and the center point coordinates of the multiple second regions, and perform affine transformation on the PCB electronic design drawing GRegion through the first affine transformation matrix hom2 to obtain an affine transformation map RegionAffine:
[0055] The first affine transformation matrix hom2 is generated through Halcon's transformation matrix generation operator vector_to_hom_mat2d(NewPoint,OldPoint,hom2), and affine transformation is performed through Halcon's affine transformation operator affine_trans_region(GRegion,RegionAffine,hom2,Interpolate).
[0056] As in the above example,
[0057] Among them, Interpolate represents the boundary limit processing method, here Interpolate = 'constant', and in halcon it represents the bilinear interpolation method.
[0058] The physical image may have deviations in the incoming material angle and position when it is collected, so the PCB electronic design drawing GRegion is roughly aligned with the physical image through affine transformation.
[0059] The foreground segmentation module 13 is used to segment the foreground area from the physical image. The foreground area can be understood as a collection of pad areas in the PCB physical image: the foreground area Regions is segmented from the physical image Image through Halcon's static threshold segmentation operator threshold (Image, Regions, Min, Max), where Max and Min represent the upper and lower limits of the grayscale value, such as Max = 180 and Min = 20.
[0060] The target region determination module 14 is used to determine the target region corresponding to each connected domain in the foreground region and the affine transformation map. The connected domain can be understood as the pad region in the PCB electronic design diagram GRegion, and the target region is the corresponding pad region in the foreground region:
[0061] (41) Select the first connected region R in the affine transformation graph RegionAffine 0 ,SP 0 is the connected domain R 0 The center point coordinates of .
[0062] (42) According to the connected domain R i The center point coordinates SP i , through Halcon's area operator area_center(SP i ,Area,Row,Column) calculates the first area of the connected domain, where i∈[1,n], n represents the number of connected domains in the affine transformation graph RegionAffine, and Row and Column are SP i The horizontal and vertical coordinate values of .
[0063] (43) Find the connected domain R through Halcon's intersection operator i The intersection with the foreground region Regions determines the foreground region Regions and the connected domain R i The corresponding target region RegionIntersection.
[0064] In actual scenarios, the actual pad area (target area) may have processing accuracy, so that the target area may be outside the corresponding connected domain. Therefore, in step (43), the dilation operator dilation_circle (SP i ,SP i Dilation,rad) for the connected domain R i Perform expansion processing to expand the connected domain R i , so that it can completely contain the target area, and the expanded connected domain is represented by SP i Dilation, expand the pixel radius rad = 5, and then use Halcon's intersection operator intersection (SP i Dilation, Regions, RegionIntersection) find the intersection of the connected domain after dilation and the foreground region, and determine the foreground region Regions with the connected domain R iThe corresponding target region RegionIntersection.
[0065] (44) According to the center point coordinate SI of the target region RegionIntersection i , calculate the second area of the target region RegionIntersection through Halcon's area operator area_center.
[0066] (45) In actual scenes, the image has a lot of noise, and some areas are not pads. Therefore, in order to remove the noise, the second area can be compared with the first area. If the ratio of the second area to the first area is within a preset range, the corresponding target area is retained. For example, the preset range can be 0.9-2.5.
[0067] (46) Repeat (41)-(45) until all connected domains in the affine transformation map are traversed, and the target area in the foreground area corresponding to each connected domain in the affine transformation map is determined.
[0068] The second affine transformation module 15 is used to determine a second affine transformation matrix through the coordinates of the center points of each connected domain and the coordinates of the center points of each target region, and perform affine transformation on the affine transformation map RegionAffine through the second affine transformation matrix:
[0069] Generate through Halcon's transformation matrix generation operator vector_to_hom_mat2d (SP 1 ,SP 2 ,…,SP n ) to (SI 1 ,SI 2 ,…,SI n )'s affine transformation matrix hom3, and perform affine transformation through Halcon's affine transformation operator affine_trans_region(RegionAffine,RegionOut,hom3,Interpolate). The final output RegionOut is a picture that is precisely aligned with the actual PCB picture, where Interpolate = 'constant'.
[0070] In summary, the device for aligning a PCB electronic design drawing with a physical drawing provided in the above embodiment can execute the method for aligning a PCB electronic design drawing with a physical drawing provided in the above embodiments.
[0071] The same as above concept, Figure 2 The structure of the device for aligning the PCB electronic design drawing with the physical drawing can be realized as an electronic device. Figure 3A schematic block diagram of the structure of an electronic device provided by an embodiment of the present invention is shown.
[0072] Exemplarily, the electronic device includes a storage module 21 and a processor 22, the storage module 21 includes instructions loaded and executed by the processor 22, and when the instructions are executed, the processor 22 executes the steps of various exemplary embodiments of the present invention described in the above-mentioned method for aligning a PCB electronic design drawing with a physical drawing in this specification.
[0073] It should be understood that the processor 22 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0074] A computer-readable storage medium is also provided in an embodiment of the present invention, which stores one or more programs. When the one or more programs are executed by a processor, the steps of various exemplary embodiments of the present invention described in the above-mentioned method for aligning a PCB electronic design drawing with a physical drawing are implemented.
[0075] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer-readable storage medium (or a non-transitory medium) and a communication medium (or a temporary medium).
[0076] As is known to those of ordinary skill in the art, the term computer-readable storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer-readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.
[0077] Exemplarily, the computer-readable storage medium may be an internal storage unit of the electronic device of the aforementioned embodiment, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (SmartMediaCard, SMC), a secure digital (SecureDigital, SD) card, a flash memory card (FlashCard), etc. equipped on the electronic device.
[0078] The electronic device and computer-readable storage medium provided in the aforementioned embodiments first roughly align multiple point pairs in the PCB electronic design drawing and the physical drawing, and then correspond the pad areas in the two drawings to obtain more point pairs, and then perform precise alignment based on more point pairs. Not only is the alignment accurate, but the overall situation is also taken into consideration, which is helpful for subsequent machine vision inspection of PCB boards.
[0079] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for aligning a PCB electronic design drawing with a physical drawing, characterized in that: include: S101, selecting a plurality of first areas from the PCB electronic design drawing, determining the coordinates of the center points of the plurality of first areas, determining a plurality of second areas corresponding to the plurality of first areas from the physical drawing, and determining the coordinates of the center points of the plurality of second areas; S102, determining a first affine transformation matrix through the center point coordinates of the plurality of first regions and the center point coordinates of the plurality of second regions, and performing an affine transformation on the PCB electronic design drawing through the first affine transformation matrix to obtain an affine transformation map; S103, segmenting a foreground area from the physical image, where the foreground area is a collection of pad areas in the physical image; S104, determining a target area in the foreground area corresponding to each connected domain in the affine transformation map, wherein the connected domain is a pad area: (41) selecting the first connected domain in the affine transformation graph; (42) Calculating the first area of the connected domain by using the area operator area_center of Halcon according to the coordinates of the center point of the connected domain; (43) The intersection of the connected domain and the foreground area is obtained by using the intersection operator of Halcon, and the target area in the foreground area corresponding to the connected domain is determined: The dilation operator dilation_circle of Halcon is used to dilate the connected domain; The intersection of the connected domain after the expansion process and the foreground area is calculated by using the intersection operator of Halcon, and the target area corresponding to the connected domain in the foreground area is determined; (44) calculating a second area of the target area using the area_center operator of Halcon according to the coordinates of the center point of the target area; (45) if the ratio of the second area to the first area is within a preset range, retaining the corresponding target area; (46) Repeat (41)-(45) until all connected domains of the affine transformation map are traversed, and the target area in the foreground area corresponding to each connected domain in the affine transformation map is determined; S105 . Determine a second affine transformation matrix through the coordinates of the center points of the connected domains and the coordinates of the center points of the target regions, and perform affine transformation on the affine transformation map through the second affine transformation matrix.
2. A method for aligning a PCB electronic design drawing with a physical drawing according to claim 1, characterized in that: The S102 and S105 further include: The affine transformation matrix is generated through Halcon's transformation matrix generation operator vector_to_hom_mat2d, and the affine transformation is performed through Halcon's affine transformation operator affine_trans_region.
3. The method for aligning a PCB electronic design drawing with a physical drawing according to claim 1, characterized in that: The S103 further includes: The foreground area is segmented from the physical image by using Halcon's static threshold segmentation operator threshold.
4. A device for aligning a PCB electronic design drawing with a physical drawing, characterized in that: include: A coordinate determination module, used to select a plurality of first areas from the PCB electronic design drawing, determine the coordinates of the center points of the plurality of first areas, determine a plurality of second areas corresponding to the plurality of first areas from the physical drawing, and determine the coordinates of the center points of the plurality of second areas; A first affine transformation module is used to determine a first affine transformation matrix through the center point coordinates of the plurality of first areas and the center point coordinates of the plurality of second areas, and perform affine transformation on the PCB electronic design drawing through the first affine transformation matrix to obtain an affine transformation map; A foreground segmentation module, used to segment a foreground area from the physical image, wherein the foreground area is a collection of pad areas in the physical image; A target region determination module is used to determine a target region in the foreground region corresponding to each connected region in the affine transformation map, wherein the connected region is a pad region: (41) selecting the first connected domain in the affine transformation graph; (42) Calculating the first area of the connected domain by using the area operator area_center of Halcon according to the coordinates of the center point of the connected domain; (43) The intersection of the connected domain and the foreground area is obtained by using the intersection operator of Halcon, and the target area in the foreground area corresponding to the connected domain is determined: The dilation operator dilation_circle of Halcon is used to dilate the connected domain; The intersection of the connected domain after the expansion process and the foreground area is calculated by using the intersection operator of Halcon, and the target area corresponding to the connected domain in the foreground area is determined; (44) calculating a second area of the target area using the area_center operator of Halcon according to the coordinates of the center point of the target area; (45) if the ratio of the second area to the first area is within a preset range, retaining the corresponding target area; (46) Repeat (41)-(45) until all connected domains of the affine transformation map are traversed, and the target area in the foreground area corresponding to each connected domain in the affine transformation map is determined; The second affine transformation module is used to determine a second affine transformation matrix through the center point coordinates of each connected domain and the center point coordinates of each target area, and perform affine transformation on the affine transformation map through the second affine transformation matrix.
5. An electronic device, characterized in that: It comprises a storage module, which comprises instructions loaded and executed by a processor, and when the instructions are executed, the processor executes a method for aligning a PCB electronic design drawing with a physical drawing according to any one of claims 1 to 3.
6. A computer-readable storage medium storing one or more programs, characterized in that: When the one or more programs are executed by the processor, a method for aligning a PCB electronic design drawing with a physical drawing as described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Image alignment method and device, computer equipment and storage medium
CN114998097A
