



技术领域technical field
本发明属于印刷电路板质量检测技术,具体涉及一种用于检测印刷电路板内部质量的基于金相切片二值图像的印刷电路板(Printed Circuit Board,PCB)层数及导线厚度测量方法。属于基于金相切片二值图像的印刷电路板的测量方法的创新技术。The invention belongs to the quality detection technology of printed circuit boards, and in particular relates to a method for measuring the number of layers of a printed circuit board (PCB) and the thickness of wires based on metallographic slice binary images for detecting the internal quality of printed circuit boards. The invention belongs to the innovative technology of the measurement method of the printed circuit board based on the binary image of the metallographic section.
背景技术Background technique
基于图像处理技术的PCB产品质量检测方法受到越来越多的关注。现有的基于图像处理技术的PCB质量检测主要集中在PCB表面元器件检测与识别(宿鸣明.电路板元器件的检测与识别[D].大连理工大学,2005;朱岩.基于机器视觉技术的电路检测与实现[D].西北工业大学,2007)和PCB表面缺陷的检测方面(郑伟.图像法检测印刷电路板缺陷[D].西安理工大学,2002)。基于金相切片图像的PCB内部质量检测目前主要采用人工观测方法,相关专利和研究报道很少。人工观测方法效率低,观测结果稳定性差、精度得不到保证。PCB product quality inspection methods based on image processing technology have received more and more attention. The existing PCB quality inspection based on image processing technology mainly focuses on the detection and identification of PCB surface components (Su Mingming. Detection and identification of circuit board components [D]. Dalian University of Technology, 2005; Zhu Yan. Based on machine vision technology Circuit detection and implementation [D]. Northwestern Polytechnical University, 2007) and PCB surface defect detection (Zheng Wei. Image method to detect printed circuit board defects [D]. Xi'an University of Technology, 2002). At present, the internal quality inspection of PCB based on metallographic slice images mainly adopts manual observation method, and there are few related patents and research reports. The manual observation method is inefficient, the stability of the observation results is poor, and the accuracy cannot be guaranteed.
发明内容Contents of the invention
本发明的目的在于考虑上述问题而提供一种能明显提高测量精度和效率的基于金相切片二值图像的印刷电路板的测量方法。The object of the present invention is to provide a method for measuring printed circuit boards based on binary images of metallographic slices that can significantly improve measurement accuracy and efficiency in consideration of the above problems.
本发明基于金相切片二值图像的印刷电路板的测量方法,包括有如下步骤:The present invention is based on the measuring method of the printed circuit board of metallographic slice binary image, comprises the following steps:
1)输入印刷电路板中某个孔的金相切片的二值图像的位图图像,即PCB图像,孔把PCB图像的白色区域分成上下两个单连通区域,其中,水平方向为孔壁方向,白色代表导线、黑色代表非导线;1) Input the bitmap image of the binary image of the metallographic slice of a hole in the printed circuit board, that is, the PCB image. The hole divides the white area of the PCB image into two single-connected areas, where the horizontal direction is the direction of the hole wall , white stands for conductors, black stands for non-conductors;
2)计算对应孔的上半区域印刷电路板层数、外层导线厚度、每条内层导线的厚度,具体计算步骤如下:2) Calculate the number of layers of the printed circuit board in the upper half of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire. The specific calculation steps are as follows:
21)计算导线段的起始、终止像素点的坐标,列号记为Bij和Eij;导线段反映在PCB图像中是一条水平白色线,该白色线是某层导线的一部分;根据输入的印刷电路板中某个孔的金相切片的二值图像的位图图像规定的白色代表导线、黑色代表非导线,可以发现导线段具有性质:起始像素点是白色但比该像素点的像素列号小1的像素点是黑色,终止像素点是白色但比该像素点的像素列号大1的像素点是黑色;21) Calculate the coordinates of the starting and ending pixel points of the wire segment, and the column numbers are marked as Bij and Eij ; the wire segment is reflected in the PCB image as a horizontal white line, which is a part of a certain layer of wire; according to the input The bitmap image of the binary image of the metallographic slice of a certain hole in the printed circuit board stipulates that white represents wires and black represents non-wires. It can be found that the wire segment has properties: the initial pixel point is white but the pixel point The pixel whose column number is 1 smaller is black, and the terminal pixel is white but the pixel whose column number is 1 larger than the pixel is black;
22)确定计算输出参数时涉及区域的PCB图像的最大像素行号R0;22) Determine the maximum pixel row number R0 of the PCB image of the area involved when calculating the output parameters;
23)导线段聚类;23) wire segment clustering;
24)计算PCB层数、外层导线厚度、每条内层导线的厚度;24) Calculate the number of PCB layers, the thickness of the outer layer wires, and the thickness of each inner layer wire;
3)计算对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度,其具体方法是:3) Calculate the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire. The specific method is:
31)垂直翻转步骤1)输入的PCB图像,得到其垂直翻转图像并将该图像作为新的输入图像;31) Vertically flip the PCB image input in step 1), get its vertical flip image and use this image as a new input image;
32)再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度(分别对应原输入PCB图像的下半区域PCB层数、左外层导线厚度、每条内层导线的厚度、右外层导线厚度);32) Use the previous calculation method to calculate the upper half area to calculate the vertical flip image of the input image, and obtain the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire (corresponding to the original input respectively. PCB layer number, left outer layer wire thickness, each inner layer wire thickness, and right outer layer wire thickness in the lower half area of the PCB image);
4)综合步骤2)和步骤3)的计算结果,输出对应孔的印刷电路板的层数、外层导线厚度、每条内层导线的厚度。4) Combine the calculation results of step 2) and step 3), and output the number of layers of the printed circuit board corresponding to the hole, the thickness of the outer layer wires, and the thickness of each inner layer wire.
本发明针对输入印刷电路板中某个孔的金相切片的二值图像的位图图像,即PCB图像,孔把PCB图像的白色区域分成上下两个单连通区域的特征,提出先计算对应孔的上半区域印刷电路板层数、外层导线厚度、每条内层导线的厚度;然后对输入的PCB图像进行垂直翻转,得到输入图像的垂直翻转图像;接着再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度;最后综合上下两个区域的计算结果得到整个孔的PCB层数、外层导线厚度、每条内层导线的厚度的测量结果。PCB层数及导线厚度是衡量PCB内部质量的重要参数。本发明通过观察分析PCB金相切片二值图像与PCB层数、导线厚度的关系规律,提出一种基于金相切片二值图像的印刷电路板层数及导线厚度测量方法。本发明应用于PCB内部质量检测,并能明显提高测量精度和测量效率。本发明是一种方便实用的基于金相切片二值图像的印刷电路板的测量方法。The present invention aims at inputting the bitmap image of the binary image of the metallographic slice of a certain hole in the printed circuit board, that is, the PCB image. The hole divides the white area of the PCB image into two single-connected areas, and proposes to calculate the corresponding hole first. The number of printed circuit board layers in the upper half of the area, the thickness of the outer layer wires, and the thickness of each inner layer wire; then vertically flip the input PCB image to obtain a vertical flip image of the input image; then use it again before calculating the upper half area The calculation method calculates the vertically flipped image of the input image, and obtains the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire; finally, the calculation results of the upper and lower areas are combined to obtain the PCB of the entire hole. Measurements of the number of layers, outer conductor thickness, and thickness of each inner conductor. The number of PCB layers and the thickness of wires are important parameters to measure the internal quality of PCB. The invention proposes a method for measuring the number of layers of a printed circuit board and the thickness of conductors based on the binary image of metallographic slices by observing and analyzing the relationship law between the binary image of the PCB metallographic slice and the number of layers of the PCB and the thickness of the conductors. The invention is applied to PCB internal quality detection, and can obviously improve measurement accuracy and measurement efficiency. The invention is a convenient and practical method for measuring printed circuit boards based on binary images of metallographic slices.
附图说明Description of drawings
图1为输入的PCB金相切片二值位图图像示例。Figure 1 is an example of an input PCB metallographic slice binary bitmap image.
图2为导线段及部分参数示意说明。Figure 2 is a schematic illustration of the wire segment and some parameters.
图3为PCB图像的垂直翻转。Figure 3 is a vertical flip of the PCB image.
图4为本发明的流程图。Fig. 4 is a flowchart of the present invention.
具体实施方式Detailed ways
本发明基于金相切片二值图像的印刷电路板的测量方法,包括有如下步骤:The present invention is based on the measuring method of the printed circuit board of metallographic slice binary image, comprises the following steps:
1)输入印刷电路板中某个孔的金相切片的二值图像的位图图像,即PCB图像,孔把PCB图像的白色区域分成上下两个单连通区域,其中,水平方向为孔壁方向,白色代表导线、黑色代表非导线;1) Input the bitmap image of the binary image of the metallographic slice of a hole in the printed circuit board, that is, the PCB image. The hole divides the white area of the PCB image into two single-connected areas, where the horizontal direction is the direction of the hole wall , white stands for conductors, black stands for non-conductors;
2)计算对应孔的上半区域印刷电路板层数、外层导线厚度、每条内层导线的厚度,具体计算步骤如下:2) Calculate the number of layers of the printed circuit board in the upper half of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire. The specific calculation steps are as follows:
21)计算导线段的起始、终止像素点的坐标,列号记为Bij和Eij;导线段反映在PCB图像中是一条水平白色线,该白色线是某层导线的一部分;根据输入的印刷电路板中某个孔的金相切片的二值图像的位图图像规定的白色代表导线、黑色代表非导线,可以发现导线段具有性质:起始像素点是白色但比该像素点的像素列号小1的像素点是黑色,终止像素点是白色但比该像素点的像素列号大1的像素点是黑色;21) Calculate the coordinates of the starting and ending pixel points of the wire segment, and the column numbers are marked as Bij and Eij ; the wire segment is reflected in the PCB image as a horizontal white line, which is a part of a certain layer of wire; according to the input The bitmap image of the binary image of the metallographic slice of a certain hole in the printed circuit board stipulates that white represents wires and black represents non-wires. It can be found that the wire segment has properties: the initial pixel point is white but the pixel point The pixel whose column number is 1 smaller is black, and the terminal pixel is white but the pixel whose column number is 1 larger than the pixel is black;
22)确定计算输出参数时涉及区域的PCB图像的最大像素行号R0;22) Determine the maximum pixel row number R0 of the PCB image of the area involved when calculating the output parameters;
23)导线段聚类;23) wire segment clustering;
24)计算PCB层数、外层导线厚度、每条内层导线的厚度;24) Calculate the number of PCB layers, the thickness of the outer layer wires, and the thickness of each inner layer wire;
3)计算对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度,其具体方法是:3) Calculate the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire. The specific method is:
31)垂直翻转步骤1)输入的PCB图像,得到其垂直翻转图像并将该图像作为新的输入图像;31) Vertically flip the PCB image input in step 1), get its vertical flip image and use this image as a new input image;
32)再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度(分别对应原输入PCB图像的下半区域PCB层数、左外层导线厚度、每条内层导线的厚度、右外层导线厚度);32) Use the calculation method of calculating the upper half area again to calculate the vertical flip image of the input image, and obtain the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire (corresponding to the original input respectively. PCB layer number, left outer layer wire thickness, each inner layer wire thickness, and right outer layer wire thickness in the lower half area of the PCB image);
4)综合步骤2)和步骤3)的计算结果,输出对应孔的印刷电路板的层数、外层导线厚度、每条内层导线的厚度。4) Combine the calculation results of step 2) and step 3), and output the number of layers of the printed circuit board corresponding to the hole, the thickness of the outer layer wire, and the thickness of each inner layer wire.
上述步骤21)的具体方法如下:The specific method of the above step 21) is as follows:
以像素为单位读取图像的高度与宽度,分别记为高度H及宽度W;从像素(0,0)开始,对输入图像自左向右、从上到下识别导线段,将第i像素行的第j个导线段的起始、终止像素点的列号分别记为Bij和Eij,i表示像素所在的行号,j表示Bij和Eij属于第j个导线段,设定j的最大可能取值为L,即PCB的最大可能层数,本专利设定L=30。Read the height and width of the image in units of pixels, which are recorded as height H and width W respectively; starting from pixel (0, 0), identify the wire segment from left to right and top to bottom of the input image, and set the i-th pixel The column numbers of the start and end pixel points of the jth wire segment of the row are respectively recorded as Bij and Eij , i represents the row number where the pixel is located, j means that Bijand Eij belong to the jth wire segment, set The maximum possible value of j is L, that is, the maximum possible number of layers of the PCB, and this patent sets L=30.
上述步骤22)的具体方法如下:The specific method of the above step 22) is as follows:
221)计算Bmin=min{Bij;i=0,1,2,..,H,j=1,2,…,L},即Bmin为Bij(i=0,1,2,..,H,j=1,2,…,L)的Bij的最小值,以下类似解释;计算Emax=max{Eij;i=0,1,2,..,H,j=1,2,…,L};221) Calculate Bmin =min{Bij ; i=0, 1, 2, .., H, j=1, 2, ..., L}, that is, Bmin is Bij (i=0, 1, 2, .., H, j=1, 2, ..., L) the minimum value of Bij , the following similar explanation; calculation Emax =max{Eij ; i=0, 1, 2, .., H, j= 1,2,...,L};
222)按照i=0,1,2,..,H,j=1,2,…,L的顺序,对Bij,判断|Bij-Bmin|≤P1且|Eij-Emax|≤P1是否成立,一旦找到Bij使其成立,则令R0=i-Rc,转步骤23);P1为孔壁位置识别辅助参数,单位:像素;100倍PCB图像P1=80,50倍PCB图像P1=[(50/100)*80]=40,其他放大倍数图像的P1取值按比例类似设定;Rc为导线测量时两端截取的像素行数;100倍PCB图像Rc=40,50倍PCB图像Rc=[(50/100)*40]=20,其他放大倍数图像的Rc取值按比例类似设定;如果不存在满足以上条件的Bij,则输出“PCB可能存在质量问题,或者图像异常”,结束;222) According to the order of i=0, 1, 2, .., H, j=1, 2, ..., L, for Bij , judge |Bij -Bmin |≤P1 and |Eij -Emax |≤P1 is true, once Bij is found to make it true, set R0 =iRc , go to step 23); P1 is the auxiliary parameter for hole wall position identification, unit: pixel; 100 times PCB image P1 =80 , 50 times PCB image P1 =[(50/100)*80]=40, the value of P1 of other magnification images is set similarly in proportion; Rc is the number of pixel rows intercepted at both ends of the wire measurement; 100 PCB image Rc =40, 50 times PCB image Rc =[(50/100)*40]=20, Rc values of other magnification images are set similarly in proportion; if there is no B that meets the above conditionsij , then output "the PCB may have quality problems, or the image is abnormal", and end;
223)如果R0≤0,则输出“PCB可能存在质量问题,或者图像异常”,结束。223) If R0 ≤ 0, then output "the PCB may have quality problems, or the image is abnormal", and end.
上述步骤23)的具体方法如下:The specific method of the above step 23) is as follows:
231)计算当j=1,2,…,L时第j类数据的Bij属性的最小值Bj=min{Bij,i=0,1,2,..,R0};231) Calculate the minimum value Bj =min{Bij , i=0, 1, 2, .., R0 } of the Bij attribute of the jth type of data when j=1, 2, ..., L;
232)计算当j=1,2,…,L时第j类数据的Eij属性的最小值Ej=min{Eij;i=0,1,2,..,R0};232) Calculate the minimum value Ej =min{Eij ; i=0, 1, 2, .., R0 } of the Eij attribute of the jth type data when j=1, 2, ..., L;
233)对数据对Bij、Eij进行聚类,使得聚类后的每一类中的每个数据对对应着某层可能导线所在图像白色区域的左、右边界的列号;具体方法如下:对于i=0,1,2,..,R0,j=1,2,…,L,如果Bij、Eij为有效数据且存在Bm或者Em(1≤m≤L)使得|Bij-Bm|≤P2与|Eij-Em|≤P2至少有一个成立,则将数据对Bij、Eij归为m类),从而获得聚类完毕的新的数据对Bij、Eij:其中P2为聚类辅助参数,单位:像素;100倍PCB图像P2=80,50倍PCB图像P2=[(50/100)*80]=40,其他放大倍数图像的P2取值按比例类似设定:233) Clustering the data pairs Bij and Eij , so that each data pair in each class after clustering corresponds to the column number of the left and right borders of the white area of the image where a certain layer of possible wires is located; the specific method is as follows : For i=0, 1, 2, .., R0 , j=1, 2, ..., L, if Bij , Eij are valid data and there is Bm or Em (1≤m≤L) such that |Bij-Bm | ≤ P2 and |Eij-Em | For Bij and Eij : among them, P2 is the clustering auxiliary parameter, unit: pixel; 100 times PCB image P2 =80, 50 times PCB image P2 =[(50/100)*80]=40, other zoom in The P2 value of the multiple image is set similarly in proportion:
234)如果Bij与Eij至少存在一个不属于任何一类,则输出“PCB可能存在质量问题,或者图像异常”,结束。234) If at least one of Bij and Eij does not belong to any category, then output "there may be a quality problem in the PCB, or the image is abnormal", and end.
上述步骤24)的具体方法如下:The specific method of the above step 24) is as follows:
241)设置当前导线测量起始像素行号R1和当前导线测量终止像素行号R2的初值为0,PCB层数F初值设置为0;241) Set the initial value of the current traverse start pixel row number R1 and the current traverse termination pixel row number R2 to 0, and the initial value of the number of PCB layers F is set to 0;
242)设第i像素行的第j个导线段的宽度为Cij,则对于i=0,1,2,..,R0,j=1,2,…,L,如果Bij、Eij为有效数据,令Cij=Eij-Bij+1;242) Suppose the width of the j-th wire segment of the i-th pixel row is Cij , then for i=0, 1, 2, .., R0 , j=1, 2, ..., L, if Bij , Eij is valid data, let Cij =Eij -Bij +1;
243)计算PCB层数F,具体方法:按照j=1,2,…,L的顺序,如果存在i(i=0,1,2,..,R0)使Cij≠0则F=F+1;243) Calculate the number of PCB layers F, the specific method: according to the order of j=1, 2, ..., L, if there is i (i=0, 1, 2, .., R0 ) so that Cij ≠ 0, then F= F+1;
244)计算第j层导线的厚度Cj,具体方法如下:对每个j(j=1,2,…,F),依次取i=0,1,2,..,R0,若有i使Cij≠0,则令R1=i+Rc,R2=R1+P3-1,计算Cj=min{Cij;R1≤i≤R2},P3用于测量的导线段长度(单位:像素),100倍PCB图像P3=43,50倍PCB图像P3=[(50/100)*43]=21,其他放大倍数图像的P3取值按比例类似设定;244) Calculate the thickness Cj of the j-th layer wire, the specific method is as follows: for each j (j=1, 2, ..., F), take i = 0, 1, 2, ..., R0 in turn, if there is i makes Cij ≠0, then let R1 =i+Rc , R2 =R1 +P3 -1, calculate Cj =min{Cij ; R1 ≤i≤R2 }, P3 is used for The length of the measured wire segment (unit: pixel), 100 times PCB image P3 =43, 50 times PCB image P3 =[(50/100)*43]=21, the value of P3 of other magnification images is proportional similar settings;
245)输出PCB层数F、左侧外层导线厚度C0、、右侧外层导线厚度CF;自左向右第j内层导线的厚度为Cj,j=2,3,…,F-1,输出结果仅当不是初始化时的值才是有效的。245) Output the number of PCB layers F, the thickness of the left outer layer conductor C0 , the thickness of the right outer layer conductor CF ; the thickness of the jth inner layer conductor from left to right is Cj , j=2, 3,..., F-1, the output is only valid if it is not the initial value.
上述100倍PCB图像P1=80,50倍PCB图像P1=[(50/100)*80]=40,其他放大倍数图像的P1取值按比例类似设定;Rc为导线测量时两端截取的像素行数,100倍PCB图像Rc=40,50倍PCB图像Rc=[(50/100)*40]=20,其他放大倍数图像的Rc取值按比例类似设定。The above 100 times PCB image P1 =80, 50 times PCB image P1 =[(50/100)*80]=40, the values of P1 of other magnification images are set similarly in proportion; Rc is when the wire is measured The number of pixel rows intercepted at both ends, the 100 times PCB image Rc =40, the 50 times PCB image Rc =[(50/100)*40]=20, the Rc values of other magnification images are set similarly in proportion .
上述100倍PCB图像P2=80,50倍PCB图像P2=[(50/100)*80]=40,其他放大倍数图像的P2取值按比例类似设定。The above 100 times PCB image P2 =80, the 50 times PCB image P2 =[(50/100)*80]=40, and the values of P2 of other magnification images are set similarly in proportion.
上述100倍PCB图像P3=43,50倍PCB图像P3=[(50/100)*43]=21,其他放大倍数图像的P3取值按比例类似设定。The above 100 times PCB image P3 =43, the 50 times PCB image P3 =[(50/100)*43]=21, and the values of P3 of other magnification images are set similarly in proportion.
本发明基于金相切片二值图像的印刷电路板层数及导线厚度测量方法的实施流程图如图4所示。具体实施方式如下:The implementation flowchart of the method for measuring the number of layers of a printed circuit board and the thickness of a wire based on a metallographic slice binary image of the present invention is shown in FIG. 4 . The specific implementation is as follows:
步骤1:输入印刷电路板中某个孔的金相切片的二值图像的位图图像,即PCB图像,孔把PCB图像的白色区域分成上下两个单连通区域,其中,水平方向为孔壁方向,白色代表导线、黑色代表非导线。如图1所示。Step 1: Input the bitmap image of the binary image of the metallographic slice of a certain hole in the printed circuit board, that is, the PCB image. The hole divides the white area of the PCB image into two single-connected areas, where the horizontal direction is the hole wall Direction, white for wires, black for non-wires. As shown in Figure 1.
步骤2:计算对应孔的上半区域印刷电路板层数、外层导线厚度、每条内层导线的厚度,具体计算步骤如下:Step 2: Calculate the number of layers of the printed circuit board in the upper half area of the corresponding hole, the thickness of the outer layer wire, and the thickness of each inner layer wire. The specific calculation steps are as follows:
步骤2.1:计算导线段的起始、终止像素点的坐标,列号记为Bij和Eij。导线段反映在PCB图像中是一条水平白色线,该白色线是某层导线的一部分;根据输入的印刷电路板中某个孔的金相切片的二值图像的位图图像规定的白色代表导线、黑色代表非导线,可以发现导线段具有性质:起始像素点是白色但比该像素点的像素列号小1的像素点是黑色,终止像素点是白色但比该像素点的像素列号大1的像素点是黑色。具体方法:以像素为单位读取图像的高度与宽度,分别记为高度H及宽度W。从像素(0,0)开始,对输入图像自左向右、从上到下识别导线段,将第i像素行的第j个导线段的起始、终止像素点的列号分别记为Bij和Eij,i表示像素所在的行号,j表示Bij和Eij属于第j个导线段,设定j的最大可能取值为L,即PCB的最大可能层数,本专利设定L=30。Step 2.1: Calculate the coordinates of the starting and ending pixel points of the wire segment, and the column numbers are marked as Bij and Eij . The wire segment is reflected in the PCB image as a horizontal white line, which is a part of a certain layer of wire; according to the bitmap image of the binary image of the metallographic slice of a hole in the input printed circuit board, the white represents the wire , black represents non-wire, and it can be found that the wire segment has properties: the starting pixel point is white but the pixel point smaller than the pixel column number of the pixel point is black, and the ending pixel point is white but smaller than the pixel column number of the pixel point Pixels larger than 1 are black. Specific method: read the height and width of the image in units of pixels, and record them as height H and width W respectively. Starting from pixel (0, 0), identify the wire segment from left to right and top to bottom of the input image, and record the column numbers of the start and end pixel points of the jth wire segment in the i-th pixel row as Bij and Eij , i represents the row number where the pixel is located, and j represents that Bij and Eij belong to the jth wire segment, and the maximum possible value of j is set to L, which is the maximum possible number of layers of the PCB. This patent sets L=30.
步骤2.2:确定计算输出参数时涉及区域的PCB图像的最大像素行号R0。具体方法:Step 2.2: Determine the maximum pixel row number R0 of the PCB image of the area involved in calculating the output parameters. specific method:
步骤2.2.1:计算Bmin=min{Bij;i=0,1,2,..,H,j=1,2,…,L},即Bmin为Bij(i=0,1,2,..,H,j=1,2,…,L)的Bij的最小值,以下类似解释。计算Emax=max{Eij;i=0,1,2,..,H,j=1,2,…,L}。Step 2.2.1: Calculate Bmin =min{Bij ; i=0, 1, 2, .., H, j=1, 2, ..., L}, that is, Bmin is Bij (i=0, 1 , 2, .., H, j=1, 2, ..., L) the minimum value ofBij , the following similar explanation. Calculate Emax =max{Eij ; i=0, 1, 2, . . . , H, j=1, 2, . . . , L}.
步骤2.2.2:按照i=0,1,2,..,H,j=1,2,…,L的顺序,对Bij,判断|Bij-Bmin|≤P1且|Eij-Emax|≤P1是否成立,一旦找到Bij使其成立,则令R0=i-Rc,转步骤2.3。P1为孔壁位置识别辅助参数(单位:像素)。100倍PCB图像P1=80,50倍PCB图像P1=[(50/100)*80]=40,其他放大倍数图像的P1取值按比例类似设定;Rc为导线测量时两端截取的像素行数。100倍PCB图像Rc=40,50倍PCB图像Rc=[(50/100)*40]=20,其他放大倍数图像的Rc取值按比例类似设定。如果不存在满足以上条件的Bij,则输出“PCB可能存在质量问题,或者图像异常”,结束。Step 2.2.2: According to the order of i=0, 1, 2, .., H, j=1, 2, ..., L, for Bij , judge that |Bij -Bmin |≤P1 and |Eij Whether -Emax |≤P1 is true, once Bij is found to make it true, set R0 =iRc and go to step 2.3. P1 is an auxiliary parameter for hole wall position identification (unit: pixel). 100 times PCB image P1 =80, 50 times PCB image P1 =[(50/100)*80]=40, the value of P1 of other magnification images is set similarly in proportion; Rc is the two The number of pixel rows intercepted by the terminal. 100x PCB image Rc =40, 50x PCB image Rc =[(50/100)*40]=20, Rc values of other magnification images are set similarly in proportion. If there is no Bij satisfying the above conditions, output "the PCB may have a quality problem, or the image is abnormal" and end.
步骤2.2.3:如果R0≤0,则输出“PCB可能存在质量问题,或者图像异常”,结束。Step 2.2.3: If R0 ≤ 0, output "the PCB may have quality problems, or the image is abnormal", and end.
步骤2.3:导线段聚类。具体方法:Step 2.3: Clustering of wire segments. specific method:
步骤2.3.1:计算当j=1,2,…,L时第j类数据的Bij属性的最小值Bj=min{Bij,i=0,1,2,..,R0}。Step 2.3.1: Calculate the minimum value Bj =min{Bij , i=0, 1, 2, .., R0 } of the Bij attribute of the jth type of data when j=1, 2, ..., L .
步骤2.3.2:计算当j=1,2,…,L时第j类数据的Eij属性的最小值Ej=min{Eij;i=0,1,2,..,R0}。Step 2.3.2: Calculate the minimum value Ej =min{Eij ; i=0, 1, 2, .., R0 } of the Eij attribute of the jth type of data when j=1, 2, ..., L .
步骤2.3.3:对数据对Bij、Eij进行聚类,使得聚类后的每一类中的每个数据对对应着某层可能导线所在图像白色区域的左、右边界的列号;具体方法:对于i=0,1,2,..,R0,j=1,2,…,L,如果Bij、Eij为有效数据且存在Bm或者Em(1≤m≤L)使得|Bij-Bm|≤P2与|Eij-Em|≤P2至少有一个成立,则将数据对Bij、Eij归为m类),从而获得聚类完毕的新的数据对Bij、Eij。其中P2为聚类辅助参数(单位:像素)。100倍PCB图像P2=80,50倍PCB图像P2=[(50/100)*80]=40,其他放大倍数图像的P2取值按比例类似设定。Step 2.3.3: clustering the data pairs Bij and Eij , so that each data pair in each class after clustering corresponds to the column number of the left and right borders of the white area of the image where the possible wires of a certain layer are located; Specific method: For i=0, 1, 2, .., R0 , j=1, 2, ..., L, if Bij and Eij are valid data and there is Bm or Em (1≤m≤L ) so that at least one of |Bij -Bm |≤P2 and |Eij -Em |≤P2 is established, then the data pair Bij and Eij are classified into m categories), thus obtaining a new clustered The data pair Bij , Eij . Among them, P2 is a clustering auxiliary parameter (unit: pixel). The 100 times PCB image P2 =80, the 50 times PCB image P2 =[(50/100)*80]=40, and the P2 values of other magnification images are set similarly in proportion.
步骤2.3.4:如果Bij与Eij至少存在一个不属于任何一类,则输出“PCB可能存在质量问题,或者图像异常”,结束。Step 2.3.4: If at least one of Bij and Eij does not belong to any category, then output "there may be a quality problem in the PCB, or the image is abnormal", and end.
步骤2.4:计算PCB层数、外层导线厚度、每条内层导线的厚度。具体方法:Step 2.4: Calculate the number of PCB layers, the thickness of the outer layer wires, and the thickness of each inner layer wire. specific method:
步骤2.4.1:设置当前导线测量起始像素行号R1和当前导线测量终止像素行号R2的初值为0。PCB层数F初值设置为0。Step 2.4.1: Set the initial values of the current traverse start pixel row number R1 and the current traverse end pixel row number R2 to 0. The initial value of PCB layer F is set to 0.
步骤2.4.2:设第i像素行的第j个导线段的宽度为Cij,则对于i=0,1,2,..,R0,j=1,2,…,L,如果Bij、Eij为有效数据,令Cij=Eij-Bij+1。Step 2.4.2: Let the width of the j-th wire segment of the i-th pixel row be Cij , then for i=0, 1, 2, .., R0 , j=1, 2, ..., L, if Bij and Eij are valid data, let Cij =Eij -Bij +1.
步骤2.4.3:计算PCB层数F。具体方法:按照j=1,2,…,L的顺序,如果存在i(i=0,1,2,..,R0)使Cij≠0则F=F+1。Step 2.4.3: Calculate the number of PCB layers F. Specific method: According to the order of j=1, 2, ..., L, if there exists i (i=0, 1, 2, . . . , R0 ) so that Cij ≠0, then F=F+1.
步骤2.4.4:计算第j层导线的厚度Cj。具体方法:对每个j(j=1,2,…,F),依次取i=0,1,2,..,R0,若有i使Cij≠0,则令R1=i+Rc,R2=R1+P3-1,计算Cj=min{Cij;R1≤i≤R2}。P3用于测量的导线段长度(单位:像素)。100倍PCB图像P3=43,50倍PCB图像P3=[(50/100)*43]=21,其他放大倍数图像的P3取值按比例类似设定。Step 2.4.4: Calculate the thickness Cj of the jth layer wire. Specific method: For each j (j=1, 2, ..., F), take i=0, 1, 2, ..., R0 in turn, if there is i so that Cij ≠0, then set R1 =i +Rc , R2 =R1 +P3 -1, calculate Cj =min{Cij ; R1 ≤i≤R2 }. P3 Length of wire segment used for measurement (unit: pixel). The 100 times PCB image P3 =43, the 50 times PCB image P3 =[(50/100)*43]=21, and the values of P3 of other magnification images are set similarly in proportion.
步骤2.4.5:输出PCB层数F、左侧外层导线厚度C0、右侧外层导线厚度CF;自左向右第j内层导线的厚度为Cj,j=2,3,…,F-1。输出结果仅当不是初始化时的值才是有效的。Step 2.4.5: Output the number of PCB layers F, the thickness of the left outer layer conductor C0 , and the thickness of the right outer layer conductor CF ; the thickness of the jth inner layer conductor from left to right is Cj , j=2, 3, ..., F-1. The output is valid only if it is not the initial value.
这样完成计算对应孔的上半区域PCB层数、外层导线厚度、每条内层导线的厚度。In this way, the number of PCB layers in the upper half area of the corresponding hole, the thickness of the outer layer wires, and the thickness of each inner layer wire are calculated.
步骤3:计算对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度,其具体方法是:Step 3: Calculate the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wires, and the thickness of each inner layer wire. The specific method is:
步骤3.1:垂直翻转步骤1输入的PCB图像,得到其垂直翻转图像并将该图像作为新的输入图像。Step 3.1: Vertically flip the PCB image input in step 1, get its vertically flipped image and use this image as a new input image.
步骤3.2:再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度(分别对应原输入PCB图像的下半区域PCB层数、左外层导线厚度、每条内层导线的厚度、右外层导线厚度)。Step 3.2: Use the previous calculation method to calculate the upper half area again to calculate the vertical flip image of the input image, and obtain the number of PCB layers in the lower half area of the corresponding hole, the thickness of the outer layer wires, and the thickness of each inner layer wire (corresponding to the original Enter the number of PCB layers in the lower half of the PCB image, the thickness of the left outer layer wire, the thickness of each inner layer wire, and the thickness of the right outer layer wire).
步骤4:综合步骤2和步骤3的计算结果,输出对应孔的印刷电路板的层数、外层导线厚度、每条内层导线的厚度。Step 4: Combining the calculation results of Step 2 and Step 3, output the number of layers of the printed circuit board corresponding to the hole, the thickness of the outer layer wires, and the thickness of each inner layer wire.
应用本发明的方法,图1所示PCB图像上半区域的测量结果如下:PCB层数为5,各层厚度自左向右依次为72像素(左外层)、21像素(第1内层)、21像素(第2内层)、21像素(第3内层)、71像素(右外层);下半区域的测量结果如下:PCB层数为5,各层厚度自左向右依次为74像素(左外层)、21像素(第1内层)、21像素(第2内层)、21像素(第3内层)、71像素(右外层)。根据图像采集时的放大倍数以及每像素对应的实际尺寸,利用本专利很容易获得每层导线的实际厚度。Applying the method of the present invention, the measurement results of the upper half of the PCB image shown in Figure 1 are as follows: the number of PCB layers is 5, and the thickness of each layer is 72 pixels (left outer layer) and 21 pixels (the first inner layer) from left to right. ), 21 pixels (the second inner layer), 21 pixels (the third inner layer), and 71 pixels (the outer right layer); the measurement results of the lower half area are as follows: the number of PCB layers is 5, and the thickness of each layer is in order from left to right 74 pixels (left outer layer), 21 pixels (1st inner layer), 21 pixels (2nd inner layer), 21 pixels (3rd inner layer), 71 pixels (right outer layer). According to the magnification when the image is collected and the actual size corresponding to each pixel, it is easy to obtain the actual thickness of each layer of wire by using this patent.
根据本发明的方法能在较短的时间内、以较高的精度实现PCB层数及导线厚度测量。According to the method of the invention, the measurement of the number of PCB layers and the thickness of the wires can be realized in a short time and with high precision.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310461359.4ACN103543151B (en) | 2013-09-29 | 2013-09-29 | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310461359.4ACN103543151B (en) | 2013-09-29 | 2013-09-29 | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image |
| Publication Number | Publication Date |
|---|---|
| CN103543151Atrue CN103543151A (en) | 2014-01-29 |
| CN103543151B CN103543151B (en) | 2017-04-05 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201310461359.4AExpired - Fee RelatedCN103543151B (en) | 2013-09-29 | 2013-09-29 | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image |
| Country | Link |
|---|---|
| CN (1) | CN103543151B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104021565A (en)* | 2014-06-26 | 2014-09-03 | 广东工业大学 | PCB (Printed Circuit Board) layer quantity and lead wire thickness measurement method based on straight-line detection |
| CN109084718A (en)* | 2018-07-10 | 2018-12-25 | 郑州云海信息技术有限公司 | The method and apparatus of medium and copper foil structure data in a kind of measurement printed circuit board |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5787191A (en)* | 1991-02-26 | 1998-07-28 | Matsushita Electric Industrial Co., Ltd. | Wiring pattern inspection apparatus for printed circuit board |
| CN101216438A (en)* | 2008-01-16 | 2008-07-09 | 中国电子科技集团公司第四十五研究所 | Printed circuit boards coarse defect image detection method based on FPGA |
| CN101799428A (en)* | 2010-04-09 | 2010-08-11 | 深圳信息职业技术学院 | Ball grid array welding spot remelting test method and marking device |
| CN101915769A (en)* | 2010-06-29 | 2010-12-15 | 华南理工大学 | An automatic optical inspection method for resistive components in printed circuit boards |
| CN102221549A (en)* | 2011-03-06 | 2011-10-19 | 丘荣意 | Fully-automatic board feeding optical image detecting device for PCB (printed circuit board) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5787191A (en)* | 1991-02-26 | 1998-07-28 | Matsushita Electric Industrial Co., Ltd. | Wiring pattern inspection apparatus for printed circuit board |
| CN101216438A (en)* | 2008-01-16 | 2008-07-09 | 中国电子科技集团公司第四十五研究所 | Printed circuit boards coarse defect image detection method based on FPGA |
| CN101799428A (en)* | 2010-04-09 | 2010-08-11 | 深圳信息职业技术学院 | Ball grid array welding spot remelting test method and marking device |
| CN101915769A (en)* | 2010-06-29 | 2010-12-15 | 华南理工大学 | An automatic optical inspection method for resistive components in printed circuit boards |
| CN102221549A (en)* | 2011-03-06 | 2011-10-19 | 丘荣意 | Fully-automatic board feeding optical image detecting device for PCB (printed circuit board) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104021565A (en)* | 2014-06-26 | 2014-09-03 | 广东工业大学 | PCB (Printed Circuit Board) layer quantity and lead wire thickness measurement method based on straight-line detection |
| CN104021565B (en)* | 2014-06-26 | 2017-02-15 | 广东工业大学 | PCB (Printed Circuit Board) layer quantity and lead wire thickness measurement method based on straight-line detection |
| CN109084718A (en)* | 2018-07-10 | 2018-12-25 | 郑州云海信息技术有限公司 | The method and apparatus of medium and copper foil structure data in a kind of measurement printed circuit board |
| Publication number | Publication date |
|---|---|
| CN103543151B (en) | 2017-04-05 |
| Publication | Publication Date | Title |
|---|---|---|
| CN117974595A (en) | A circuit board defect detection method and system using image processing technology | |
| CN115690012B (en) | Detection method for electric energy meter fault line connection | |
| CN104021565B (en) | PCB (Printed Circuit Board) layer quantity and lead wire thickness measurement method based on straight-line detection | |
| CN105865344A (en) | Workpiece dimension measuring method and device based on machine vision | |
| CN107705293A (en) | A kind of hardware dimension measurement method based on CCD area array cameras vision-based detections | |
| CN115239727B (en) | PCB surface defect detection method | |
| CN118501177B (en) | Appearance defect detection method and system for formed foil | |
| CN105184792B (en) | A kind of saw blade wear extent On-line Measuring Method | |
| CN107644417B (en) | Appearance defect detection method of strain gauge | |
| CN106595496A (en) | Man-machine interaction part size flexibility vision measurement method | |
| CN112070751A (en) | Wood floor defect detection method and device | |
| CN108399614B (en) | A Fabric Defect Detection Method Based on Unsampled Wavelet and Gumbel Distribution | |
| CN114581385A (en) | Welding seam defect area mapping algorithm based on circle positioning | |
| CN105181706A (en) | Bad defect detection method for SMD resistor on substrate | |
| CN106815830B (en) | Image defect detection method | |
| CN115641326A (en) | Sub-pixel size detection method and system for ceramic antenna PIN needle image | |
| CN103337067B (en) | The visible detection method of single needle scan-type screw measurement instrument probe X-axis rotating deviation | |
| CN103543151B (en) | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image | |
| CN115170551A (en) | Product detection and tracing method and system based on visual technology calibration | |
| CN106530292A (en) | Strip steel surface defect image rapid identification method based on line scanning camera | |
| CN111311657B (en) | Infrared image homologous registration method based on improved corner principal direction distribution | |
| CN118655084A (en) | Surface defect detection method, system, electronic device and storage medium | |
| CN109377482A (en) | A tire corner property detection method based on point cloud data | |
| CN201688888U (en) | Liquid level detecting device after filling beverage | |
| CN115797303A (en) | Inductive component quality detection method and device, electronic equipment and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20170405 | |
| CF01 | Termination of patent right due to non-payment of annual fee |