Area detection method and device, computer device and computer readable storage medium

By extracting and filtering the contours of the circuit board's molding layer design drawings, the inner contour of the circuit board block is automatically determined, solving the problem of low efficiency in determining the circuit board block area in traditional methods and achieving fast and accurate identification of the circuit board block area.

CN115760774BActive Publication Date: 2026-02-13SHENZHEN SMARTMORE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211454872.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-21
Publication Date
2026-02-13
Estimated Expiration
2042-11-21

AI Technical Summary

Technical Problem

In traditional methods, manually selecting circuit board area as the reference area for feature matching results in low efficiency and complex process for determining circuit board area.

Method used

By acquiring the molding layer design drawing of the circuit board, and using contour extraction and filtering algorithms, the inner contour of the circuit board blocks is automatically determined, and the area of ​​each circuit board block is quickly obtained.

Benefits of technology

It improves the efficiency and accuracy of circuit board area determination, reduces process complexity, and enhances processing performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115760774B_ABST
    Figure CN115760774B_ABST
Patent Text Reader

Abstract

The application relates to a region detection method and device, computer equipment and a computer readable storage medium. The method comprises the following steps: obtaining a layer design diagram of a forming layer of a circuit board; the circuit board comprises a plurality of circuit board blocks, the forming layer is a layer comprising a block contour of each circuit board block, and the block contour comprises an inner contour and an outer contour of the circuit board block; contours in the layer design diagram of the forming layer are extracted to obtain a contour set; the contours in the contour set correspond to associated contour information, the associated contour information of the contour is used for representing sub-contour information and parent contour information of the contour; contours with associated contour information satisfying preset associated contour information are selected from the contour set to obtain inner contours corresponding to each circuit board block respectively, and the regions of the circuit board blocks are determined based on the inner contours corresponding to each circuit board block respectively. The method can improve the efficiency of determining the regions of the circuit board blocks.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and in particular to a region detection method and device, computer equipment and a computer readable storage medium. BACKGROUND

[0002] With the rapid development of the intelligent manufacturing industry, intelligent defect detection is applied to more and more scenarios. For example, when producing a PCB (Printed Circuit Board), a PCB image is used to detect defects in the PCB. Before detecting defects in the PCB, the PCS (Piece) region of the PCB image needs to be determined, i.e., the regions of each circuit board block need to be determined.

[0003] In the traditional technology, a circuit board block region is manually selected from a PCB image as a reference region, and a feature matching algorithm is used to traverse the PCB image to determine the regions of each circuit board block as the regions of the circuit board block in the PCB image that are consistent with the features of the reference region.

[0004] However, the method of manually selecting a circuit board block region from a PCB image as a reference region and using a feature matching algorithm to traverse the PCB image to determine the regions of each circuit board block makes the process of determining the regions of each circuit board block complex, resulting in low efficiency in determining the regions of each circuit board block. SUMMARY

[0005] The present application provides a region detection method, device, computer equipment and computer readable storage medium, which can improve the efficiency of determining the regions of each circuit board block.

[0006] In a first aspect, the present application provides a region detection method, comprising:

[0007] obtaining a layer design diagram of a forming layer of a circuit board; the circuit board includes a plurality of circuit board blocks, and the forming layer is a diagram including block outlines of the circuit board blocks; the block outlines include inner outlines and outer outlines of the circuit board blocks; the inner outline of a circuit board block is a sub-outline of the outer outline of the circuit board block, and the outer outline of the circuit board block is a parent outline of the inner outline of the circuit board block;

[0008] extracting the outlines in the layer design diagram of the forming layer to obtain an outline set; the outlines in the outline set correspond to associated outline information, and the associated outline information of an outline is used to represent the sub-outline information and the parent outline information of the outline;

[0009] The contour selection module is configured to select, from the contour set, a contour whose associated contour information meets preset associated contour information, to obtain the inner contour corresponding to each circuit board block respectively, and to determine the circuit board block region based on the inner contour corresponding to each circuit board block respectively; the preset associated contour information is associated contour information that the inner contour meets.

[0010] In a second aspect, the present application further provides a region detection device, comprising:

[0011] An image acquisition module is configured to acquire a layer design diagram of a forming layer of a circuit board; the circuit board comprises a plurality of circuit board blocks, and the forming layer is a diagram comprising block contours of the circuit board blocks; the block contour comprises an inner contour and an outer contour of the circuit board block; the inner contour of the circuit board block is a child contour of the outer contour of the circuit board block, and the outer contour of the circuit board block is a parent contour of the inner contour of the circuit board block;

[0012] A contour extraction module is configured to extract contours in the layer design diagram of the forming layer to obtain a contour set; the contours in the contour set correspond to associated contour information, and the associated contour information of the contour is used to represent child contour information and parent contour information of the contour;

[0013] The contour selection module is configured to select, from the contour set, a contour whose associated contour information meets preset associated contour information, to obtain the inner contour corresponding to each circuit board block respectively, and to determine the circuit board block region based on the inner contour corresponding to each circuit board block respectively; the preset associated contour information is associated contour information that the inner contour meets.

[0014] In a third aspect, the present application further provides a computer device, which comprises a memory and a processor; the memory stores a computer program; and the processor implements the steps in the above region detection method when executing the computer program.

[0015] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program; and the computer program implements the steps in the above region detection method when executed by a processor.

[0016] In a fifth aspect, the present application further provides a computer program product, which comprises a computer program; and the computer program implements the steps in the above region detection method when executed by a processor.

[0017] The aforementioned area detection method, apparatus, computer equipment, computer-readable storage medium, and computer program product extract the contours from the layer design drawing of the molding layer of the circuit board to obtain a contour set, and select contours from the contour set whose associated contour information satisfies the preset associated contour information. Since the molding layer includes the panel contours of each circuit board block, and the preset associated contour information is the associated contour information satisfied by the inner contour, the inner contours corresponding to each circuit board block in the circuit board can be obtained quickly, and the area of ​​each circuit board block is determined based on the inner contours corresponding to each circuit board block, thereby improving the efficiency of determining the area of ​​the circuit board block. Attached Figure Description

[0018] Figure 1 An application environment diagram of a region detection method provided in this application embodiment;

[0019] Figure 2 A schematic flowchart of a region detection method provided in an embodiment of this application;

[0020] Figure 3 A schematic flowchart of a region detection method provided in an embodiment of this application;

[0021] Figure 4A A schematic flowchart of a region detection method provided in an embodiment of this application;

[0022] Figure 4B A schematic flowchart of a contour extraction method provided in an embodiment of this application;

[0023] Figure 4C A schematic flowchart illustrating a contour filtering method provided in an embodiment of this application;

[0024] Figure 5 A flowchart illustrating another region detection method provided in an embodiment of this application;

[0025] Figure 6 A structural block diagram of a region detection device provided in an embodiment of this application;

[0026] Figure 7 An internal structural diagram of a computer device provided in an embodiment of this application;

[0027] Figure 8 An internal structural diagram of another computer device provided in an embodiment of this application;

[0028] Figure 9 This is an internal structural diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation

[0029] 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 to limit the present application.

[0030] The region detection method provided by the embodiments of the present application can be applied to an application environment as shown in Figure 1 . In the application environment, the computer device 102 communicates with the server 104 through a network. The data storage system can store data required to be processed by the server 104. The data storage system can be integrated on the server 104, or placed on a cloud or other network server.

[0031] Specifically, the server 104 can store a layer design diagram of a forming layer of a circuit board, the computer device 102 can obtain the layer design diagram of the forming layer of the circuit board from the server 104 or other devices, the circuit board includes a plurality of circuit board blocks, the forming layer is a layer including a block contour of each circuit board block, the block contour includes an inner contour and an outer contour of the circuit board block, the inner contour of the circuit board block is a child contour of the outer contour of the circuit board block, and the outer contour of the circuit board block is a parent contour of the inner contour of the circuit board block. Then, contours in the layer design diagram of the forming layer are extracted to obtain a contour set, a contour in the contour set corresponds to associated contour information, the associated contour information of the contour is used to represent child contour information and parent contour information of the contour. The computer device 102 can select contours with associated contour information meeting a preset associated contour information from the contour set to obtain inner contours corresponding to each circuit board block respectively. The preset associated contour information is associated contour information meeting the inner contour. The computer device 102 can store the inner contours corresponding to each circuit board block respectively, or send the inner contours corresponding to each circuit board block respectively to the server 104. The server 104 can store the received inner contours corresponding to each circuit board block respectively.

[0032] The computer device 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0033] In some embodiments, as shown in Figure 2 , a region detection method is provided. The method is taken as an example to illustrate the computer device 102 in Figure 1 , and includes the following steps:

[0034] In step 202, a layer design diagram of a forming layer of a circuit board is acquired. The circuit board includes a plurality of circuit board pieces, and the forming layer is a layer including piece outlines of the circuit board pieces. The piece outlines include inner outlines and outer outlines of the circuit board pieces. The inner outline of a circuit board piece is a child outline of the outer outline of the circuit board piece, and the outer outline of the circuit board piece is a parent outline of the inner outline of the circuit board piece.

[0035] The circuit board can also be referred to as a printed circuit board (PCB), and the forming layer is a layer including piece outlines of a plurality of circuit board pieces, which is used to determine the shape and size of each circuit board piece. The layer design diagram of the forming layer is a design diagram corresponding to the forming layer in a circuit board design diagram, which can also be referred to as a forming layer image. The circuit board design diagram is a design diagram corresponding to the circuit board, which can include a plurality of layer design diagrams, such as at least one of a layer design diagram corresponding to a forming layer, a silk screen layer, a circuit layer, a solder mask layer, a text layer, a blind hole layer, or a drill hole layer.

[0036] The circuit board piece is a sub-piece of the circuit board, which can also be referred to as a PCS (piece). The circuit board includes a plurality of circuit board pieces, which means at least two. The size of each circuit board piece and the content on each circuit board piece are the same, so the circuit board piece is a repeated area on the circuit board. The piece outline refers to the outline of the circuit board piece. The shape of the piece outline can be at least one of a square, a rectangle, a circle, or an irregular shape. The piece outline includes an inner outline and an outer outline of the circuit board piece. The outer outline of a circuit board piece surrounds the inner outline, so the inner outline of the circuit board piece is a child outline of the outer outline of the circuit board piece, and the outer outline of the circuit board piece is a parent outline of the inner outline of the circuit board piece. For example, as shown in (a) of FIG. 1, Figure 3 Figure 3 The layer design diagram of the forming layer of the circuit board is shown in (a) of FIG. 1. Figure 3 The outline A in (b) is the outer outline of the circuit board piece 1, and the outline B is the inner outline of the circuit board piece 1. The outline B is a child outline of the outline A, and the outline A is a parent outline of the outline B.

[0037] The circuit board piece area is an image area within the inner outline of the circuit board piece, which is also referred to as a PCS area.

[0038] Specifically, the computer device can acquire the layer design diagram of the forming layer of the circuit board from a circuit board design diagram of the circuit board. For example, the layer design diagram of the forming layer of the circuit board is shown in (a) of FIG. 1. Figure 3 The layer design diagram of the forming layer of the circuit board is shown in (a) of FIG. 1.

[0039] In step 204, outlines in the layer design diagram of the forming layer are extracted to obtain an outline set. An outline in the outline set corresponds to associated outline information. The associated outline information of the outline is used to represent child outline information and parent outline information of the outline.

[0040] ​The contour set is extracted from a layer design diagram of the forming layer, the contour set includes a board contour of the board block, each contour in the contour set has a parent-child relationship, the associated contour information is used to represent child contour information and parent contour information of the contour, the child contour information represents whether the contour has a child contour, and the identification of the child contour in the case of having a child contour, each contour in the contour set has a unique number, the identification of the contour can be the number of the contour, the number of the contour is related to the order of generating the contour, the number of the contour generated earlier is smaller than the number of the contour generated later, the number of the contour is a continuous integer, for example, five contours are generated, if the number of the first generated contour is 0, the numbers of the five contours are 0-4, the parent contour information represents whether the contour has a parent contour, and the identification of the parent contour in the case of having a parent contour, for example, assuming that the child contour information in the associated contour information of contour A is the identification of contour B, and the parent contour information is empty, the child contour of contour A is contour B, and contour A has no parent contour.

[0041] Specifically, the computer device can perform binaryzation processing on the layer design diagram of the forming layer to obtain a binaryzation diagram of the forming layer, and then perform contour extraction on the binaryzation diagram of the forming layer to obtain the contour set. The pixel value of a pixel point in the binaryzation diagram is a first preset value or a second preset value, the first preset value and the second preset value are both preset pixel values, the first preset value is different from the second preset value, for example, the first preset value can be set to 0 and the second preset value can be set to 255.

[0042] In some embodiments, the computer device can perform binaryzation processing on the layer design diagram of the forming layer to obtain a binaryzation diagram, and then determine the boundary pixel points of the first type of pixel points and the second type of pixel points from the binaryzation diagram, determine each closed line formed by the boundary pixel points as a contour to obtain a first contour set. The first type of pixel points are pixel points with a first preset value, and the second type of pixel points are pixel points with a second preset value. The boundary pixel points are determined based on adjacent first type of pixel points and second type of pixel points, for example, the boundary pixel points can be first type of pixel points adjacent to the second type of pixel points, the closed line is formed by the boundary pixel points, and one closed line is one contour.

[0043] In some embodiments, before the computer device performs the contour extraction, the computer device can set the contour extraction mode to a connected mode, where the connected mode refers to that, in the process of performing the contour extraction, the computer device can obtain the connected contour information corresponding to each contour, so as to extract the contours in the layer design diagram of the forming layer, and the obtained contours in the contour set correspond to the connected contour information. For example, the computer device can set the contour extraction mode to the connected mode in the opencv, and obtain the connected contour information corresponding to each contour by using the opencv. The connected contour information can further include [child, parent], where child is an identifier of a child contour, and parent is an identifier of a parent contour.

[0044] In step 206, contours whose connected contour information meets preset connected contour information are selected from the contour set, to obtain inner contours corresponding to each circuit board block respectively, and the circuit board block regions are determined based on the inner contours corresponding to each circuit board block respectively. The preset connected contour information is the connected contour information that the inner contour meets.

[0045] The preset connected contour information is the connected contour information that the inner contour meets, and the preset connected contour information can be preset. For example, the connected contour information in which the child contour information is empty can be determined as the preset connected information.

[0046] Specifically, the computer device can select contours whose connected contour information meets preset connected contour information from the contour set based on the connected contour information corresponding to each contour in the contour set, to obtain inner contours corresponding to each circuit board block respectively, and then determine the image regions in the inner contours as the circuit board block regions from the circuit board design diagram.

[0047] In some embodiments, the contour set obtained by the computer device from the layer design diagram of the forming layer is a first contour set, the computer device can select a second contour set from the first contour set based on the image region areas in each first contour in the first contour set, and then select second contours whose connected contour information meets preset connected contour information from the second contour set, to obtain inner contours corresponding to each circuit board block respectively. The first contour set is obtained from the layer design diagram of the forming layer, the first contour is a contour in the first contour set, and the second contour set is selected from the first contour set based on the image region areas in each first contour.

[0048] In some embodiments, the computer device can perform statistical operation on the image region areas in each first contour in the first contour set, to obtain an area threshold, and then select each first contour whose image region area is greater than the area threshold from the first contour set, to form the second contour set. The statistical operation includes at least one of taking a maximum value, taking an average value, or taking a median value.

[0049] In some embodiments, the computer device can select, from the second set of contours, a contour whose associated contour information satisfies the preset associated contour information, to obtain the inner contour corresponding to each circuit board block, and then determine, from the circuit board design drawing, an image region within each inner contour as a circuit board block region, and perform defect detection on the circuit board based on the circuit board block regions.

[0050] In the above area detection method, the contour set is obtained by extracting contours in the layer design drawing of the forming layer of the circuit board, and the contour whose associated contour information satisfies the preset associated contour information is selected from the contour set. Since the forming layer includes the block contours of the circuit board blocks, and the preset associated contour information is the associated contour information satisfied by the inner contour, the inner contour corresponding to each circuit board block in the circuit board can be quickly obtained, and the circuit board block regions can be determined based on the inner contour corresponding to each circuit board block, thereby improving the efficiency of determining the circuit board block regions.

[0051] In some embodiments, in the prior art, the computer device usually directly processes the circuit board design drawing of the circuit board or the real image of the circuit board to determine the circuit board block regions, and then performs defect detection on the circuit board block regions. For example, a circuit board block region can be manually selected as a reference region on the circuit board design drawing, the features in the reference region are determined by the computer device, and then feature matching is performed on the circuit board design drawing based on the features of the reference region, so that the image region in the circuit board design drawing that is consistent with the features of the reference region is determined as a circuit board block region. However, the manual selection of the reference region makes the process more complex, and in the case where the resolution of the circuit board design drawing or the real image of the circuit board is high, the performance of directly processing the circuit board design drawing or the real image of the circuit board is low. The area detection method of the present application, as shown in Figure 4A the forming layer of the circuit board, and all contours are obtained by using a contour extraction algorithm, and then the inner contours of the circuit board blocks are obtained by using a contour screening algorithm. Since the forming layer is a layer including the block contours of the circuit board blocks, the inner contours of the circuit board blocks can be automatically and quickly determined from the layer design drawing of the forming layer, thereby reducing the complexity of the process, improving the processing performance, and further improving the efficiency of determining the circuit board block regions.

[0052] In some embodiments, the contour set is a first contour set, and the layer design drawing of the forming layer further includes non-block contours.

[0053] Step 206 specifically includes:

[0054] selecting, based on the image area in each first contour in the first contour set, a second contour set from the first contour set to filter the non-board block contour in the first contour set;

[0055] selecting, from the second contour set, a second contour whose associated contour information meets preset associated contour information to obtain the inner contour corresponding to each circuit board block.

[0056] The first contour set is extracted from the layer design diagram of the forming layer, the first contour is a contour in the first contour set, and the first contour set includes a board block contour of a circuit board block and a non-board block contour. The non-board block contour is a contour of an area other than the circuit board block in the layer design diagram of the forming layer, for example, as shown in (b) of FIG. 7, the contour C is a non-board block contour. The second contour set is selected from the first contour set based on the image area in each first contour, and the second contour set includes the board block contour of the circuit board block and does not include the non-board block contour. Figure 3

[0057] Specifically, the computer device can calculate the image area in each first contour in the first contour set, and then select, based on the image area in each first contour in the first contour set, a second contour set from the first contour set to filter the non-board block contour in the first contour set. Then the computer device can select, from the second contour set, a second contour whose associated contour information meets preset associated contour information to obtain the inner contour corresponding to each circuit board block.

[0058] In this embodiment, by selecting, based on the image area in each first contour in the first contour set, a second contour set from the first contour set, the non-board block contour in the first contour set is filtered, so that the second contour set obtained does not include the non-board block contour, the screening of the first contour set is realized, and the accuracy of determining the circuit board block area is improved.

[0059] In some embodiments, selecting, based on the image area in each first contour in the first contour set, a second contour set from the first contour set includes:

[0060] obtaining an image area set based on the image area corresponding to each first contour in the first contour set;

[0061] performing statistical operation on each image area in the image area set to obtain an area threshold;

[0062] selecting, based on the area threshold, a second contour set from the first contour set.

[0063] ​The image region area is an area of an image region within the contour, the image region area set is a set of areas composed of the image region areas corresponding to the first contours respectively, and the area threshold is a threshold of the image region areas obtained by statistical operation on the image region areas in the image region area set.

[0064] Specifically, the computer device can calculate the image region areas corresponding to the first contours in the first contour set respectively to obtain the image region area set, perform statistical operation on the image region areas in the image region area set to obtain the area threshold, and select the second contour set from the first contour set based on the area threshold, for example, the first contour with the image region area greater than the area threshold in the first contour set can be determined as the second contour to obtain the second contour set.

[0065] In some embodiments, for each first contour in the first contour set, the computer device can store the first contour in the second contour set if the image region area within the first contour is greater than the area threshold, and remove the first contour from the first contour set if the image region area within the first contour is less than the area threshold, thereby obtaining the second contour set.

[0066] In this embodiment, the area threshold is obtained by performing statistical operation on the image region areas in the image region area set, and the second contour set is selected from the first contour set based on the area threshold, so that the obtained second contour set does not include non-plate block contours, the selection of the first contour set is realized, and the accuracy of determining the plate block region is improved.

[0067] In some embodiments, the image region area within the non-plate block contour is less than the image region area within the plate block contour.

[0068] The statistical operation on the image region areas in the image region area set to obtain the area threshold includes:

[0069] Determining the maximum image region area from the image region area set;

[0070] Performing reduction processing on the maximum image region area to obtain the area threshold;

[0071] The selection of the second contour set from the first contour set based on the area threshold includes:

[0072] Selecting each first contour with the image region area greater than the area threshold from the first contour set to form the second contour set.

[0073] The image region area within the non-plate block contour is less than the image region area within the plate block contour, for example, Figure 3As shown in (b), the image area within C of the non-plate contour is smaller than the image area within the outer contour A of the circuit board block, and also smaller than the image area within the inner contour B of the circuit board block.

[0074] Specifically, the computer device can determine the largest image region area from the set of image region areas, then reduce the largest image region area using a preset reduction factor to obtain an area threshold, and select all first contours from the first contour set whose image region areas are greater than the area threshold to form a second contour set. The preset reduction factor is a pre-set reduction factor; for example, a preset reduction factor of 1 / 2 would reduce the largest image region area to half of its original size, and this half-size of the largest image region area would be used as the area threshold.

[0075] In some embodiments, the computer device can determine the largest image region area from the set of image region areas, use half of the largest image region area as an area threshold, and store each first contour in the first contour set whose image region area is greater than the area threshold into a second contour set, thus obtaining a second contour set. For example, as shown... Figure 4B As shown, the computer device acquires an image of the molding layer of the circuit board, then extracts the contours of the molding layer image to obtain a first contour set, and determines the largest image region area (Area) from the image region areas within each first contour in the first contour set. max Then, in ascending order of their numbers, a first contour is selected from the first contour set, and the area of ​​the image region within that first contour is calculated. If the area of ​​the image region within the first contour is greater than or equal to the area of ​​the first contour, then... max In the case of / 2, the first contour is stored in the second contour set Contour. filter The area of ​​the image region within the first contour is smaller than the area of ​​the first contour. max In the case of / 2, the first contour is removed from the first contour set, and the step of selecting a first contour from the first contour set is returned until every first contour in the first contour set is traversed to obtain the second contour set.

[0076] In this embodiment, since the area of ​​the image region within the non-plate contour is smaller than the area of ​​the image region within the plate contour, the largest image region area is determined from the set of image region areas, and the largest image region area is reduced to obtain an area threshold. The first contours with image region areas greater than the area threshold are selected from the first contour set to form a second contour set, thereby quickly filtering out the non-plate contours from the first contour set and improving the efficiency of determining the circuit board block area.

[0077] In some embodiments, the associated contour information is selected from the second contour set to satisfy the second contour of the preset associated contour information, to obtain the inner contour corresponding to each circuit board block, including:

[0078] In a case where the associated contour information based on the second contour determines that the second contour does not have a sub-contour, the second contour is determined as the inner contour, to obtain the inner contour corresponding to each circuit board block.

[0079] The associated contour information is used to represent the sub-contour information and the parent contour information of the contour.

[0080] Specifically, the computer device obtains the associated contour information corresponding to each second contour in the second contour set, and for each second contour in the second contour set, in a case where the sub-contour information in the associated contour information of the second contour is empty, it is determined that the second contour does not have a sub-contour, and then the second contour is determined as the inner contour, to obtain the inner contour corresponding to each circuit board.

[0081] In some embodiments, as shown in Figure 4C , the computer device can select a second contour from the second contour set Contour filter in ascending order of the number, determine whether the second contour has a sub-contour based on the associated contour information of the second contour, in a case where the second contour does not have a sub-contour, store the second contour in the inner contour set Contour pcs of the circuit board block; in a case where the second contour has a sub-contour, eliminate the second contour from the second contour set Contour filter , and return to the step of selecting a second contour from the second contour set Contour filter in ascending order of the number, until each second contour in the second contour set is traversed.

[0082] In this embodiment, by determining the second contour as the inner contour in a case where the associated contour information based on the second contour determines that the second contour does not have a sub-contour, the inner contour corresponding to each circuit board block is quickly obtained, and the efficiency of determining the circuit board block region is improved.

[0083] In some embodiments, the contour in the layer design diagram of the forming layer is extracted to obtain a contour set, including:

[0084] The layer design diagram of the forming layer is binarized to obtain a binary image; the pixel value of a pixel point in the binary image is a first preset value or a second preset value;

[0085] The boundary pixel points of the first type of pixel points and the second type of pixel points are determined from the binary image; the first type of pixel points are pixel points with a first preset value, and the second type of pixel points are pixel points with a second preset value;

[0086] Each closed line formed by the boundary pixel points forms a contour set.

[0087] In the binary image, the pixel value of a pixel point is the first preset value or the second preset value, the first preset value and the second preset value are both preset pixel values, the first preset value is different from the second preset value, for example, the first preset value can be set to 0, and the second preset value can be set to 255. The first type of pixel points are pixel points with the first preset value, and the second type of pixel points are pixel points with the second preset value. The boundary pixel points are determined based on adjacent first type of pixel points and second type of pixel points, for example, the boundary pixel points can be first type of pixel points adjacent to the second type of pixel points, each closed line is formed by the boundary pixel points, and one closed line is one contour.

[0088] Specifically, the computer device can perform binary processing on the obtained layer design diagram of the forming layer to obtain a binary image corresponding to the layer design diagram of the forming layer, and then determine, from the binary image, first type of pixel points adjacent to the second type of pixel points as boundary pixel points, and determine each closed line formed by the boundary pixel points as each first contour to obtain a contour set.

[0089] In some embodiments, the computer device can determine a current row from each row of pixel points in the binary image, determine a current pixel point of the current row in a front-to-back order, in a case where the current pixel point is a first type of pixel point and at least one of a frontward pixel point or a backward pixel point adjacent to the current pixel point is a second type of pixel point, or the current pixel point is a first type of pixel point and is the first pixel point of the current row, mark the current pixel point as a boundary pixel point, and then update the adjacent backward pixel point of the current pixel point to the current pixel point until all pixel points in the binary image are traversed. For example, the first row of the binary image can be determined as the current row, and the first pixel point of the current row can be determined as the current pixel point. In a case where the current pixel point is determined to be a first type of pixel point and is the first pixel point of the current row, the second pixel point of the current row is updated to the current pixel point until all pixel points in the current row are traversed, the second row of the binary image is updated to the current row, and all pixel points in the binary image are traversed.

[0090] In this embodiment, the boundary pixel points of the first type of pixel points and the second type of pixel points are determined from the binary image, each closed line formed by the boundary pixel points forms a contour set, the contours in the layer design diagram of the forming layer are extracted, and the contour set is quickly obtained, thereby improving the efficiency of determining the circuit board block region.

[0091] In some embodiments, the layer design diagram of the forming layer is one layer in the circuit board design diagram of the circuit board.

[0092] The determining of the circuit board block area based on the inner contour corresponding to each circuit board block comprises:

[0093] For each circuit board block, an image area within the inner contour of the circuit board block is determined from the circuit board design diagram to obtain a circuit board block area corresponding to the circuit board block.

[0094] The area detection method further comprises:

[0095] A reference image area is determined from the circuit board block areas.

[0096] Based on the element parameters and the drilling parameters in the reference area image, detection parameters are obtained.

[0097] The circuit board is subjected to defect detection based on the detection parameters.

[0098] The circuit board design diagram further comprises layer design diagrams corresponding to the silk screen layer and the drilling layer. The layer design diagram of the silk screen layer comprises element parameters of each element, and the element parameters comprise an element type, an element position, and an element size. The element type refers to the type of the element placed on the circuit board, and the element type comprises at least one of a resistor, a capacitor, an inductor, or a diode. The element position is the placement position of each element on the circuit board block, and the element size is the size of the element. The layer design diagram of the drilling layer comprises drilling parameters, which refer to the drilling positions on the circuit board block. The element parameters and the drilling parameters can be determined from the reference area in the circuit board design diagram, or can be determined from the layer design diagrams corresponding to the silk screen layer and the drilling layer, respectively. The reference inner contour is selected from the inner contours corresponding to each circuit board block. The reference image area is an image area within the reference inner contour determined from the circuit board design diagram. The detection parameters are obtained based on the element parameters and the drilling parameters in the reference image area, and are used for defect detection of the circuit board.

[0099] Specifically, the computer device can determine an image area within the inner contour of the circuit board block from the circuit board design diagram based on the inner contour corresponding to each circuit board block, obtain a circuit board block area corresponding to the circuit board block, then randomly select one of the circuit board block areas as a reference image area, and obtain detection parameters based on the element parameters and the drilling parameters in the reference image area, then use the reference parameters to perform defect detection on each circuit board block in the produced circuit board to obtain a defect detection result. The defect detection result represents whether each circuit board block has a defect.

[0100] In some embodiments, the computer device can acquire a physical image of the produced circuit board, and determine the circuit board block area from the physical image of the circuit board based on the inner contour of each circuit board block, and perform defect detection on the physical image of the circuit board using the detection parameter to obtain a defect detection result. For example, the computer device can acquire element data and drilling data of each circuit board block from the physical image of the circuit board, compare the element data and drilling data of the circuit board block with the element parameter and drilling parameter in the detection parameter, and determine that the defect detection result of the circuit board block is no defect in the case of consistent comparison result, and determine that the defect detection result of the circuit board block is defect in the case of inconsistent comparison result.

[0101] In the embodiment, the image area within the inner contour of the circuit board block is determined from the circuit board design diagram to obtain the circuit board block area corresponding to the circuit board block, the reference image area is determined from each circuit board block area, the detection parameter is obtained based on the element parameter and the drilling parameter in the reference area image, and the defect detection is performed on the circuit board based on the detection parameter, thereby realizing the defect detection on the circuit board.

[0102] In some embodiments, as shown in Figure 5 A region detection method is provided, which is taken as an example of application to a computer device, and includes the following steps:

[0103] Step 502, acquiring a layer design diagram of a forming layer of a circuit board.

[0104] The circuit board includes a plurality of circuit board blocks, the forming layer is a layer including a block contour of each circuit board block, and the block contour includes an inner contour and an outer contour of the circuit board block. The inner contour of the circuit board block is a sub-contour of the outer contour of the circuit board block, and the outer contour of the circuit board block is a parent contour of the inner contour of the circuit board block.

[0105] Step 504, extracting the contour in the layer design diagram of the forming layer to obtain a first contour set.

[0106] The contour in the first contour set corresponds to associated contour information, and the associated contour information of the contour is used to represent the sub-contour information and the parent contour information of the contour.

[0107] Step 506, obtaining a image area set based on the image area of each first contour in the first contour set.

[0108] Step 508, determining the largest image area from the image area set, and performing reduction processing on the largest image area to obtain an area threshold.

[0109] Step 510, selecting each first contour with an image area greater than the area threshold from the first contour set to form a second contour set.

[0110] Step 512, determining the second contour as an inner contour in a case that it is determined that the second contour has no sub-contour based on the associated contour information of the second contour, to obtain the inner contour corresponding to each circuit board block respectively.

[0111] In the embodiment, the first contour set is obtained by extracting the contours in the layer design diagram of the forming layer of the circuit board, each first contour in the first contour set is selected based on the image area corresponding to the first contour respectively, to form the second contour set, and the second contour with no sub-contour is selected from the second contour set based on the associated contour information of the second contour, to obtain the inner contour corresponding to each circuit board block respectively. Since the forming layer is a layer including the board block contour of each circuit board block, the inner contour corresponding to each circuit board block in the circuit board can be quickly and accurately obtained, and the circuit board block region is determined based on the inner contour corresponding to each circuit board block, so that the efficiency of determining the circuit board block region is improved.

[0112] It should be understood that, although each step in the flowchart involved in each of the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps has no strict sequence limitation, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be alternately executed with at least part of other steps or steps or stages in other steps.

[0113] Based on the same inventive concept, the embodiments of the present application also provide a region detection device for implementing the above-mentioned region detection method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more region detection device embodiments provided below can refer to the limitations of the region detection method in the above text, which will not be repeated here.

[0114] In some embodiments, as shown in Figure 6 a region detection device is provided, comprising:

[0115] The image acquisition module 602 is configured to acquire a layer design diagram of a forming layer of a circuit board. The circuit board includes a plurality of circuit board blocks, and the forming layer is a block contour including a block contour of each circuit board block. The block contour of the circuit board block includes an inner contour and an outer contour of the circuit board block. The inner contour of the circuit board block is a child contour of the outer contour of the circuit board block, and the outer contour of the circuit board block is a parent contour of the inner contour of the circuit board block.

[0116] The contour extraction module 604 is configured to extract contours in the layer design diagram of the forming layer to obtain a contour set. A contour in the contour set corresponds to associated contour information. The associated contour information of the contour is used to represent child contour information and parent contour information of the contour.

[0117] The contour selection module 606 is configured to select contours with associated contour information satisfying preset associated contour information from the contour set to obtain inner contours corresponding to each circuit board block, respectively, and determine a circuit board block region based on the inner contours corresponding to each circuit board block, respectively. The preset associated contour information is associated contour information that the inner contour satisfies.

[0118] In some embodiments, the contour set is a first contour set, and the layer design diagram of the forming layer further includes a non-block contour.

[0119] In the aspect of selecting contours with associated contour information satisfying preset associated contour information from the contour set to obtain inner contours corresponding to each circuit board block, respectively, the contour selection module is specifically configured to:

[0120] Based on image region areas in each first contour in the first contour set, the contour selection module selects a second contour set from the first contour set to filter the non-block contour in the first contour set.

[0121] The contour selection module selects second contours with associated contour information satisfying preset associated contour information from the second contour set to obtain inner contours corresponding to each circuit board block, respectively.

[0122] In some embodiments, in the aspect of selecting a second contour set from the first contour set based on image region areas in each first contour in the first contour set, the contour selection module is specifically configured to:

[0123] Based on image region areas corresponding to each first contour in the first contour set, the contour selection module obtains an image region area set.

[0124] The contour selection module performs statistical operation on each image region area in the image region area set to obtain an area threshold.

[0125] The contour selection module selects a second contour set from the first contour set based on the area threshold.

[0126] In some embodiments, an image region area in the non-block contour is smaller than an image region area in the block contour.

[0127] In the aspect of performing statistical operation on each image region area in the image region area set to obtain the area threshold, the contour selecting module is specifically configured to:

[0128] determine the maximum image region area from the image region area set;

[0129] perform reduction processing on the maximum image region area to obtain the area threshold.

[0130] The selecting, from the first contour set, to obtain the second contour set based on the area threshold comprises:

[0131] selecting, from the first contour set, each first contour with an image region area greater than the area threshold to form the second contour set.

[0132] In some embodiments, in the aspect of selecting, from the second contour set, a second contour with associated contour information satisfying preset associated contour information to obtain an inner contour corresponding to each circuit board block, the contour selecting module is specifically configured to:

[0133] in a case where the associated contour information based on the second contour determines that the second contour does not have a sub-contour, determining the second contour as the inner contour to obtain the inner contour corresponding to each circuit board block.

[0134] In some embodiments, in the aspect of extracting a contour in a layer design diagram of the molding layer to obtain a contour set, the contour extracting module is specifically configured to:

[0135] performing binaryzation processing on the layer design diagram to obtain a binaryzation diagram; a pixel value of each pixel point in the binaryzation diagram is a first preset value or a second preset value;

[0136] determining, from the binaryzation diagram, a boundary pixel point of a first type of pixel point and a second type of pixel point; the first type of pixel point is a pixel point with the first preset value, and the second type of pixel point is a pixel point with the second preset value;

[0137] forming each closed line formed by each boundary pixel point into the contour set.

[0138] In some embodiments, the layer design diagram of the molding layer is one layer in a circuit board design diagram of a circuit board;

[0139] In the aspect of determining each circuit board block region based on the inner contour corresponding to each circuit board block, the contour selecting module is specifically configured to:

[0140] for each circuit board block, determining an image region within the inner contour of the circuit board block from the circuit board design diagram to obtain a circuit board block region corresponding to the circuit board block;

[0141] The region detection apparatus further comprises a parameter determination module, and the parameter determination module is specifically configured to:

[0142] determine a reference image region from each circuit board block region;

[0143] obtain a detection parameter based on the element parameter and the drilling parameter in the reference region image;

[0144] perform defect detection on the circuit board based on the detection parameter.

[0145] Each module in the region detection apparatus can be implemented wholly or partially by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in the computer device in software form, so as to be called and executed by a processor to perform operations corresponding to each module.

[0146] In some embodiments, a computer device, which can be a server, is provided, and an internal structure diagram of the computer device can be as shown in Figure 7 The computer device comprises a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store related data involved in the region detection method. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through a network connection. The computer program is executed by the processor to implement the steps in the region detection method.

[0147] In some embodiments, a computer device, which can be a terminal, is provided, and an internal structure diagram of the computer device can be as shown in Figure 8As shown in the figure. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with the external terminal in a wired or wireless manner. The wireless manner can be realized through WIFI, mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by the processor to realize a region detection method. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.

[0148] Those skilled in the art can understand that, Figure 7 and Figure 8 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0149] In some embodiments, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to realize the steps of the above-mentioned region detection method.

[0150] In some embodiments, a computer readable storage medium 900 is provided, which stores a computer program 902, and the computer program 902 is executed by a processor to realize the steps of the above-mentioned image data processing method, and its internal structure diagram can be as Figure 9 shown.

[0151] In some embodiments, a computer program product is provided, including a computer program, and the computer program is executed by a processor to realize the steps of the above-mentioned region detection method.

[0152] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of the country and region.

[0153] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments of each method. In the embodiments provided in the present application, any reference to memory, database or other medium can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0154] The technical features of the above embodiments can be combined in any way. In order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, but as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.

[0155] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. A region detection method characterized by, The method comprises the following steps: obtaining a layer design diagram of a forming layer of a circuit board; the circuit board comprises a plurality of circuit board blocks, the forming layer is a layer comprising a block contour of each circuit board block, the block contour comprises an inner contour and an outer contour of the circuit board block; the inner contour of the circuit board block is a child contour of the outer contour of the circuit board block, and the outer contour of the circuit board block is a parent contour of the inner contour of the circuit board block; the layer design diagram of the forming layer is one layer in a circuit board design diagram of the circuit board; extracting contours in the layer design diagram of the forming layer to obtain a first contour set; the contours in the first contour set correspond to associated contour information and non-block contours, the associated contour information of a contour is used to represent child contour information and parent contour information of the contour, and an image area in the non-block contour is smaller than an image area in the block contour; obtaining an image area set based on the image areas corresponding to each first contour in the first contour set; determining a maximum image area from the image area set, and performing a reduction process on the maximum image area to obtain an area threshold; selecting each first contour with an image area greater than the area threshold from the first contour set to form a second contour set; selecting the second contour set from the first contour set based on the area threshold to filter the non-block contours in the first contour set; in a case where it is determined based on the associated contour information of the second contour that the second contour has no child contour, determining the second contour as an inner contour to obtain an inner contour corresponding to each circuit board block, and the preset associated contour information is the associated contour information satisfied by the inner contour; for each circuit board block, determining an image area in the inner contour of the circuit board block from the circuit board design diagram to obtain a circuit board block area corresponding to the circuit board block; determining a reference image area from each circuit board block area, and obtaining detection parameters based on element parameters and drilling parameters in the reference image area; performing defect detection on the circuit board based on the detection parameters.

2. The method of claim 1, wherein, The method comprises the following steps: performing a binaryzation process on the layer design diagram of the forming layer to obtain a binaryzation diagram; a pixel value of a pixel point in the binaryzation diagram is a first preset value or a second preset value; determining boundary pixel points of first-type pixel points and second-type pixel points from the binaryzation diagram; the first-type pixel points are pixel points with a pixel value of the first preset value, and the second-type pixel points are pixel points with a pixel value of the second preset value; grouping each closed line formed by each boundary pixel point to form the first contour set.

3. An area detection device, characterized by The method comprises the following steps: An image acquisition module is configured to acquire a layer design diagram of a forming layer of a circuit board; the circuit board comprises a plurality of circuit board blocks, the forming layer is a diagram comprising a block contour of each of the circuit board blocks, the block contour comprises an inner contour and an outer contour of the circuit board block; the inner contour of the circuit board block is a child contour of the outer contour of the circuit board block, and the outer contour of the circuit board block is a parent contour of the inner contour of the circuit board block; and the layer design diagram of the forming layer is one layer in a circuit board design diagram of the circuit board. An contour extraction module is configured to extract contours in the layer design diagram of the forming layer to obtain a first contour set; a contour in the first contour set corresponds to associated contour information and a non-block contour, the associated contour information of a contour is used to represent child contour information and parent contour information of the contour, and an image area in the non-block contour is smaller than an image area in the block contour. A contour selection module is configured to obtain an image area set based on an image area of each first contour in the first contour set; determine a largest image area from the image area set, and perform a reduction process on the largest image area to obtain an area threshold; select each first contour with an image area greater than the area threshold from the first contour set to form a second contour set; filter the non-block contour in the first contour set based on the area threshold to obtain the second contour set; in a case where it is determined based on the associated contour information of the second contour that the second contour has no child contour, determine the second contour as an inner contour to obtain an inner contour corresponding to each of the circuit board blocks, wherein the preset associated contour information is associated contour information satisfied by the inner contour; and for each of the circuit board blocks, determine an image area in the inner contour of the circuit board block from the circuit board design diagram to obtain a circuit board block area corresponding to the circuit board block. A parameter determination module is configured to determine a reference image area from each of the circuit board block areas, obtain detection parameters based on element parameters and drilling parameters in the reference image area, and perform defect detection on the circuit board based on the detection parameters.

4. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 2.

5. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 2.

6. A computer program product, characterised in that, The computer program product comprises a computer program, and the computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 2.

Citation Information

Patent Citations

  • Judgment method and device for accurate positioning of test paper tape, storage medium and terminal

    CN113689378A

  • Region identification method and device of printed circuit board, medium and equipment

    CN114549474A