CN103543151B - A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image - Google Patents
A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image Download PDFInfo
- Publication number
- CN103543151B CN103543151B CN201310461359.4A CN201310461359A CN103543151B CN 103543151 B CN103543151 B CN 103543151B CN 201310461359 A CN201310461359 A CN 201310461359A CN 103543151 B CN103543151 B CN 103543151B
- Authority
- CN
- China
- Prior art keywords
- image
- pcb
- thickness
- pixel
- wire
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 239000004020 conductor Substances 0.000 claims abstract description 20
- 238000004364 calculation method Methods 0.000 claims abstract description 18
- 238000005259 measurement Methods 0.000 claims abstract description 13
- 230000002159 abnormal effect Effects 0.000 claims description 9
- 239000000615 nonconductor Substances 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 description 7
- 238000001514 detection method Methods 0.000 description 6
- 238000007689 inspection Methods 0.000 description 3
- 230000007547 defect Effects 0.000 description 2
- 238000000691 measurement method Methods 0.000 description 1
Landscapes
- Length Measuring Devices By Optical Means (AREA)
- Image Processing (AREA)
Abstract
本发明是一种基于金相切片二值图像的印刷电路板的测量方法。本发明针对输入印刷电路板中某个孔的金相切片的二值图像的位图图像,即PCB图像,孔把PCB图像的白色区域分成上下两个单连通区域的特征,提出先计算对应孔的上半区域印刷电路板层数、外层导线厚度、每条内层导线的厚度;然后对输入的PCB图像进行垂直翻转,得到输入图像的垂直翻转图像;接着再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度;最后综合上下两个区域的计算结果得到整个孔的PCB层数、外层导线厚度、每条内层导线的厚度的测量结果。本发明能明显提高测量精度和效率。
The invention is a method for measuring a printed circuit board based on a binary image of a metallographic slice. 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 invention can obviously improve the measurement accuracy and efficiency.
Description
技术领域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 printed circuit boards (PCB, PCB) and the thickness of conducting wires for detecting the internal quality of printed circuit boards based on binary images of metallographic slices. 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 of [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 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:
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 B ij and E ij ; 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 R 0 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) Vertical flip step 1) input PCB image, obtain its vertical flip image and use this image as a new input image;
32)再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度(分别对应原输入PCB图像的下半区域PCB层数、左外层导线厚度、每条内层导线的厚度、右外层导线厚度);32) Use the previous calculation method for calculating 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 wires, and the thickness of each inner layer wire (corresponding to the original input PCB layer number, left outer layer wire thickness, each inner layer wire thickness, right outer layer wire thickness) in the lower half of the PCB image;
4)综合步骤2)和步骤3)的计算结果,输出对应孔的印刷电路板的层数、外层导线厚度、每条内层导线的厚度。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.
本发明针对输入印刷电路板中某个孔的金相切片的二值图像的位图图像,即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 description
本发明基于金相切片二值图像的印刷电路板的测量方法,包括有如下步骤: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 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:
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 B ij and E ij ; 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 R 0 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) Vertical flip step 1) input PCB image, obtain its vertical flip image and use this image as a new input image;
32)再次运用之前计算上半区域的计算方法对输入图像的垂直翻转图像进行计算,得到对应孔的下半区域PCB层数、外层导线厚度、每条内层导线的厚度(分别对应原输入PCB图像的下半区域PCB层数、左外层导线厚度、每条内层导线的厚度、右外层导线厚度);32) Use the previous calculation method for calculating 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 wires, and the thickness of each inner layer wire (corresponding to the original input PCB layer number, left outer layer wire thickness, each inner layer wire thickness, right outer layer wire thickness) in the lower half of the PCB image;
4)综合步骤2)和步骤3)的计算结果,输出对应孔的印刷电路板的层数、外层导线厚度、每条内层导线的厚度。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.
上述步骤21)的具体方法如下:The concrete method of above-mentioned 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 from top to bottom of the input image, and set the i-th pixel The column numbers of the starting and ending pixel points of the jth wire segment of the row are respectively recorded as B ij and E ij , i represents the row number where the pixel is located, and j means that Bij and E ij 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 concrete method of above-mentioned 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 B min =min{B ij ; i=0,1,2,..,H, j=1,2,...,L}, that is, B min is B ij (i=0,1,2, .., H, j=1,2,..., L) the minimum value of B ij , the following similar explanation; calculation E max =max{E ij ; 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 B ij , judge that |B ij -B min |≤P 1 and |E ij -E max Whether |≤P 1 is established, once B ij is found to make it established, set R 0 =iR c , and go to step 23); P 1 is the auxiliary parameter for hole wall position identification, unit: pixel; 100 times PCB image P 1 =80 , 50 times PCB image P 1 =[(50/100)*80]=40, the values of P 1 of other magnification images are similarly set in proportion; R c is the number of pixel lines intercepted at both ends of the wire measurement; 100 PCB image R c = 40, 50 times PCB image R c = [(50/100)*40] = 20, the R c values of other magnification images are set similarly in proportion; if there is no B that satisfies the above conditions ij , then output "the PCB may have quality problems, or the image is abnormal", and end;
223)如果R0≤0,则输出“PCB可能存在质量问题,或者图像异常”,结束。223) If R 0 ≤ 0, then output "the PCB may have quality problems, or the image is abnormal", and end.
上述步骤23)的具体方法如下:The concrete method of above-mentioned 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 B j =min{B ij , i=0,1,2,...,R 0 } of the B ij 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 E j =min{E ij ; i=0,1,2,...,R 0 } of the E ij attribute of the jth type of 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 B ij and E ij , 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,..,R 0 , j=1,2,…,L, if B ij , E ij are valid data and there is B m or E m (1≤m≤L) such that |B ij -B m | ≤ P 2 and | E ij -E m | For B ij and E ij : where P 2 is the clustering auxiliary parameter, unit: pixel; 100 times PCB image P 2 =80, 50 times PCB image P 2 =[(50/100)*80]=40, other zoom The P 2 value of the multiple image is set similarly in proportion:
234)如果Bij与Eij至少存在一个不属于任何一类,则输出“PCB可能存在质量问题,或者图像异常”,结束。234) If at least one of B ij and E ij 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 concrete method of above-mentioned 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 R 1 and the current traverse termination pixel row number R 2 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) Assuming that the width of the j-th wire segment in the i-th pixel row is C ij , then for i=0,1,2,...,R 0 , j=1,2,...,L, if B ij , E ij is valid data, let C ij =E ij -B ij +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,..,R 0 ) so that C ij ≠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 C j of the j-th layer conductor, the specific method is as follows: for each j (j=1,2,...,F), take i=0,1,2,...,R 0 sequentially, if any i makes C ij ≠0, then set R 1 =i+R c , R 2 =R 1 +P 3 -1, calculate C j =min{C ij ; R 1 ≤i≤R 2 }, P 3 is used for The length of the measured wire segment (unit: pixel), 100 times PCB image P 3 =43, 50 times PCB image P 3 =[(50/100)*43]=21, the value of P 3 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 C 0 , the thickness of the right outer layer conductor C F ; the thickness of the jth inner layer conductor from left to right is C j , j=2,3,...,F -1, the output is valid only 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-mentioned 100 times PCB image P 1 =80, 50 times PCB image P 1 =[(50/100)*80]=40, the values of P 1 of other magnification images are set similarly in proportion; R c is the wire measurement The number of pixel lines intercepted at both ends, 100 times PCB image R c = 40, 50 times PCB image R c = [(50/100)*40] = 20, the R c value of other magnification images is set similarly in proportion .
上述100倍PCB图像P2=80,50倍PCB图像P2=[(50/100)*80]=40,其他放大倍数图像的P2取值按比例类似设定。The 100 times PCB image P 2 =80, the 50 times PCB image P 2 =[(50/100)*80]=40, and the values of P 2 for other magnification images are set similarly in proportion.
上述100倍PCB图像P3=43,50倍PCB图像P3=[(50/100)*43]=21,其他放大倍数图像的P3取值按比例类似设定。The 100 times PCB image P 3 =43, the 50 times PCB image P 3 =[(50/100)*43]=21, and the values of P 3 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 B ij and E ij . 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 from 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 B ij and E ij , i indicates the row number where the pixel is located, j indicates that B ij and E ij 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 R 0 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 B min =min{B ij ; i=0,1,2,...,H,j=1,2,...,L}, that is, B min is B ij (i=0,1 , 2, . . . , H, j =1, 2, . Calculate E max =max{E ij ; 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 B ij , determine that |B ij -B min |≤P 1 and |E ij Whether -E max |≤P 1 is true, once B ij is found to make it true, set R 0 =iR c and go to step 2.3. P 1 is an auxiliary parameter for hole wall position identification (unit: pixel). 100 times PCB image P 1 =80, 50 times PCB image P 1 =[(50/100)*80]=40, the value of P 1 of other magnification images is set similarly in proportion; R c is the two The number of pixel rows intercepted by the terminal. The 100x PCB image R c =40, the 50x PCB image R c =[(50/100)*40]=20, and the R c values of other magnification images are set similarly in proportion. If there is no B ij 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 R 0 ≤ 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 B j =min{B ij , i=0,1,2,...,R 0 } of the B ij 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 E j =min{E ij ; i=0,1,2,...,R 0 } of the E ij 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 B ij and E ij , 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,...,R 0 , j=1,2,...,L, if B ij and E ij are valid data and there is B m or E m (1≤m≤L ) so that at least one of |B ij -B m |≤P 2 and |E ij -E m |≤P 2 is established, then the data pair B ij and E ij are classified into m categories), so as to obtain a new clustered The data pair B ij , E ij . Among them, P 2 is a clustering auxiliary parameter (unit: pixel). The 100 times PCB image P 2 =80, the 50 times PCB image P 2 =[(50/100)*80]=40, and the values of P 2 of other magnification images are similarly set in proportion.
步骤2.3.4:如果Bij与Eij至少存在一个不属于任何一类,则输出“PCB可能存在质量问题,或者图像异常”,结束。Step 2.3.4: If at least one of B ij and E ij 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 R 1 and the current traverse end pixel row number R 2 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 C ij , then for i=0,1,2,...,R 0 , j=1,2,...,L, if B ij and E ij are valid data, let C ij =E ij -B ij +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. The specific method: according to the order of j=1, 2, ..., L, if there exists i (i=0, 1, 2, ..., R 0 ) such that C ij ≠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 C j of the jth layer wire. Specific method: for each j (j=1,2,...,F), take i=0,1,2,...,R 0 sequentially, if there is i so that C ij ≠0, then set R 1 =i +R c , R 2 =R 1 +P 3 -1, calculate C j =min{C ij ; R 1 ≤i≤R 2 }. P 3 Length of wire segment used for measurement (unit: pixel). The 100x PCB image P 3 =43, the 50x PCB image P 3 =[(50/100)*43]=21, and the values of P 3 for 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 C 0 , and the thickness of the right outer layer conductor C F ; the thickness of the jth inner layer conductor from left to right is C j , 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 for calculating the upper half area to calculate the vertically flipped 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 region 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.
Claims (1)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310461359.4A CN103543151B (en) | 2013-09-29 | 2013-09-29 | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310461359.4A CN103543151B (en) | 2013-09-29 | 2013-09-29 | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103543151A CN103543151A (en) | 2014-01-29 |
CN103543151B true CN103543151B (en) | 2017-04-05 |
Family
ID=49966818
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310461359.4A Expired - Fee Related CN103543151B (en) | 2013-09-29 | 2013-09-29 | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103543151B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
Citations (5)
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) |
-
2013
- 2013-09-29 CN CN201310461359.4A patent/CN103543151B/en not_active Expired - Fee Related
Patent Citations (5)
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) |
Also Published As
Publication number | Publication date |
---|---|
CN103543151A (en) | 2014-01-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103499585B (en) | Based on noncontinuity lithium battery film defect inspection method and the device thereof of machine vision | |
TWI514326B (en) | System and method for measuring special boundaries | |
CN106197612B (en) | A liquid level detection method for transparent bottles based on machine vision | |
CN101825584B (en) | X-ray imaging method for automatic detection of stretching faults in steel cord conveyor belt joints | |
CN102621154B (en) | Method and device for automatically detecting cloth defects on line based on improved differential box multi-fractal algorithm | |
CN103674968A (en) | Method and device for evaluating machine vision original-value detection of exterior corrosion appearance characteristics of material | |
CN117274722B (en) | Intelligent detection method for distribution box based on infrared image | |
CN104021565B (en) | PCB (Printed Circuit Board) layer quantity and lead wire thickness measurement method based on straight-line detection | |
CN107644417B (en) | Appearance defect detection method of strain gauge | |
CN103245296A (en) | Screw thread parameter measurement method based on image measurement and processing | |
CN116109635B (en) | Method, device, equipment and medium for detecting surface quality of composite suspension insulator | |
CN106595496A (en) | Man-machine interaction part size flexibility vision measurement method | |
CN101858768A (en) | Device and method for detecting liquid level after beverage filling | |
CN108399614B (en) | A Fabric Defect Detection Method Based on Unsampled Wavelet and Gumbel Distribution | |
CN105181706A (en) | Bad defect detection method for SMD resistor on substrate | |
CN109990711A (en) | Appearance quality detection method of punched nickel-plated steel strip | |
CN105631857B (en) | A kind of scratch detection method and apparatus of optical element surface | |
CN103543151B (en) | A kind of measuring method of the printed circuit board (PCB) based on microsection bianry image | |
CN107907548A (en) | A kind of raw silk shade detection device | |
CN101807297B (en) | Medical ultrasonic image line detection method | |
CN103337067B (en) | The visible detection method of single needle scan-type screw measurement instrument probe X-axis rotating deviation | |
CN108305285A (en) | A kind of honeycomb sandwich structures disengagement area accounting measurement method | |
CN118501177A (en) | Appearance defect detection method and system for formed foil | |
CN112200799A (en) | Gerber file-based PCB electronic component defect detection method | |
CN116912243A (en) | A coating quality detection method and system for medical tubes |
Legal Events
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170405 |