CN111598771B - PCB (printed Circuit Board) defect detection system and method based on CCD (Charge coupled device) camera - Google Patents
PCB (printed Circuit Board) defect detection system and method based on CCD (Charge coupled device) camera Download PDFInfo
- Publication number
- CN111598771B CN111598771B CN202010039810.3A CN202010039810A CN111598771B CN 111598771 B CN111598771 B CN 111598771B CN 202010039810 A CN202010039810 A CN 202010039810A CN 111598771 B CN111598771 B CN 111598771B
- Authority
- CN
- China
- Prior art keywords
- image
- matrix
- module
- defect detection
- real
- 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
- 238000001514 detection method Methods 0.000 title claims abstract description 88
- 230000007547 defect Effects 0.000 title claims abstract description 82
- 238000000034 method Methods 0.000 title claims description 25
- 238000012937 correction Methods 0.000 claims abstract description 16
- 230000006798 recombination Effects 0.000 claims abstract description 16
- 238000005215 recombination Methods 0.000 claims abstract description 16
- 238000003384 imaging method Methods 0.000 claims abstract description 10
- 239000011159 matrix material Substances 0.000 claims description 92
- 238000005070 sampling Methods 0.000 claims description 37
- 238000011156 evaluation Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 10
- 238000004519 manufacturing process Methods 0.000 abstract description 6
- 238000001444 catalytic combustion detection Methods 0.000 abstract 6
- 230000008521 reorganization Effects 0.000 description 23
- 238000011161 development Methods 0.000 description 3
- 230000007812 deficiency Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000007689 inspection Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005314 correlation function Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012797 qualification Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4038—Image mosaicing, e.g. composing plane images from plane sub-images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2200/00—Indexing scheme for image data processing or generation, in general
- G06T2200/32—Indexing scheme for image data processing or generation, in general involving image mosaicing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30141—Printed circuit board [PCB]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
Abstract
本发明提供了一种基于CCD相机的PCB电路板缺陷检测系统,包括CCD图像采集模块,以及分别与所述CCD图像采集模块设置在同一台上位机上的图像重组拼接模块、缺陷检测模块以及自校正模块,基于上述系统,本发明还公开了一种基于CCD相机的PCB电路板缺陷检测方法。本发明利用线性CCD按行扫描采集图像的特点,通过控制图像成像行数来实现部分图像信息进行检测及信息可调。本发明利用自校正模块对拼接行数进行调整,得到图像行数信息,避免误检测。本发明有效利用线性CCD相机有效地提高了PCB缺陷检测的效率,节约了生产成本,提高了实时性。
The invention provides a PCB circuit board defect detection system based on a CCD camera, including a CCD image acquisition module, and an image recombination splicing module, a defect detection module, and a self-calibration module respectively arranged on the same host computer as the CCD image acquisition module Module, based on the above system, the present invention also discloses a PCB circuit board defect detection method based on a CCD camera. The present invention utilizes the feature of line-by-line scanning of linear CCDs to collect images, and realizes partial image information detection and information adjustment by controlling the number of image imaging lines. The invention uses a self-correction module to adjust the number of spliced lines to obtain image line number information and avoid false detection. The invention effectively utilizes the linear CCD camera to effectively improve the efficiency of PCB defect detection, save production cost and improve real-time performance.
Description
技术领域technical field
本发明属于PCB电路板缺陷检测技术领域,尤其涉及一种基于CCD相机的PCB电路板缺陷检测系统及方法。The invention belongs to the technical field of PCB circuit board defect detection, and in particular relates to a CCD camera-based PCB circuit board defect detection system and method.
背景技术Background technique
PCB电路板制造过程中工序繁多,缺陷可能会在各个工序中产生,这些细微的缺陷如果不能在生产过程中准确迅速的发现,对产品会造成产品合格率的下降、影响其可靠性,甚至可能导致印制板整张报废,使生产成本増加。制成后的PCB电路板如果发现故障,其代价是巨大的,而将故障PCB板投放到市场上的代价更是致命的,因此,缺陷检测在PCB电路板生产过程中有着十分重要的位置。同时,在现有的PCB电路板在线检测方法中,检测速度存在瓶颈,因此,本发明利用线性CCD相机扫描成像的特点,大大提高其检测的效率,同时节约了成本。There are many processes in the PCB manufacturing process, and defects may occur in each process. If these subtle defects cannot be found accurately and quickly in the production process, it will cause a decline in the product qualification rate and affect its reliability. It may even The entire printed board is scrapped, which increases the production cost. If a fault is found on the finished PCB circuit board, the cost is huge, and the cost of putting the faulty PCB board on the market is even more fatal. Therefore, defect detection plays a very important position in the PCB circuit board production process. At the same time, in the existing on-line detection method of PCB circuit board, there is a bottleneck in the detection speed. Therefore, the present invention utilizes the characteristics of scanning and imaging of the linear CCD camera to greatly improve the detection efficiency and save the cost at the same time.
发明内容Contents of the invention
针对现有技术中的上述不足,本发明提供的一种基于CCD相机的PCB电路板缺陷检测系统及方法,能够提高实时采集和检测效率,具有较高的准确率和实时性,以实现PCB电路板在线检测的进一步发展。Aiming at the above-mentioned deficiencies in the prior art, the present invention provides a PCB circuit board defect detection system and method based on a CCD camera, which can improve real-time acquisition and detection efficiency, and has high accuracy and real-time performance, so as to realize PCB circuit board defect detection system and method. Further development of board in-line inspection.
为了达到以上目的,本发明采用的技术方案为:In order to achieve the above object, the technical scheme adopted in the present invention is:
本方案提供一种基于CCD相机的PCB电路板缺陷检测系统,包括CCD图像采集模块,以及分别与所述CCD图像采集模块设置在同一台上位机上的图像重组拼接模块、缺陷检测模块以及自校正模块;This solution provides a PCB circuit board defect detection system based on a CCD camera, including a CCD image acquisition module, and an image reorganization splicing module, a defect detection module and a self-correction module that are respectively set on the same host computer as the CCD image acquisition module ;
所述CCD图像采集模块用于实时扫描采集图像,并将实时扫描采集的图像以及获取的标准采样图像传入至图像重组拼接模块;所述CCD图像采集模块包括CCD相机以及CCD图像采集接口;The CCD image acquisition module is used for real-time scanning and acquisition of images, and the images collected by real-time scanning and the standard sampling images obtained are transferred to the image reorganization stitching module; the CCD image acquisition module includes a CCD camera and a CCD image acquisition interface;
所述图像重组拼接模块用于接收自校正模块传入的图像行数信息,并根据所述图像行数信息,将输入的实时采集图像以及标准采样图像按行分别进行图像拼接重组,并将拼接后的图像传入至缺陷检测模块;The image recombination and stitching module is used to receive the image line number information imported from the correction module, and according to the image line number information, perform image splicing and reorganization on the input real-time collected images and standard sampling images by line, and splicing The final image is passed to the defect detection module;
所述缺陷检测模块用于根据拼接后的采集图像和标准采样图像利用结构相似性算法,计算得到对应图像的亮度、对比度和结构,并根据计算结果得到采集图像和标准采样图像的差异,并根据所述差异得到缺陷位置,并将其缺陷位置传入至自校正模块;The defect detection module is used to calculate the brightness, contrast and structure of the corresponding image according to the spliced collected image and the standard sampled image using a structural similarity algorithm, and obtain the difference between the collected image and the standard sampled image according to the calculation result, and according to The difference obtains the defect position, and transfers the defect position to the self-calibration module;
所述自校正模块用于根据得到的缺陷位置对扫描行数进行调整,并将调整行数输入至图像拼接模块。The self-correcting module is used to adjust the number of scanning lines according to the obtained defect position, and input the adjusted number of lines to the image stitching module.
基于上述方法,本发明还公开了一种基于CCD相机的PCB电路板缺陷检测方法,包括以下步骤:Based on the above method, the present invention also discloses a method for detecting defects of a PCB circuit board based on a CCD camera, comprising the following steps:
S1、获取标准采样图像,并设置CCD相机的采集行数以及CCD相机的基本设置,并利用CCD相机实时扫描采集图像;S1. Obtain a standard sampling image, and set the number of collection lines of the CCD camera and the basic settings of the CCD camera, and use the CCD camera to scan and collect images in real time;
S2、输入图像行数信息,并根据所述图像行数信息将所述标准采样图像以及实时采集图像按行分别进行图像拼接重组处理;S2. Input image row number information, and according to the image row number information, perform image splicing and reorganization processing on a row-by-row basis for the standard sampled image and the real-time collected image;
S3、利用结构相似性算法分别计算得到拼接后的采集图像和标准采样图像的亮度、对比度和结构,并根据计算结果判断是否存在缺陷,若是,则进入步骤S4,否则,结束本次检测,从而完成对PCB电路板的缺陷检测;S3. Using the structural similarity algorithm to calculate the brightness, contrast and structure of the spliced collected image and the standard sampled image respectively, and judge whether there is a defect according to the calculation result, if so, enter step S4, otherwise, end this detection, thereby Complete the defect detection of PCB circuit board;
S4、根据判断结果进行扫描行数调整处理,并将调整的扫描行数信息作为步骤S2中的输入图像行数信息,并返回步骤S2。S4. Perform the processing of adjusting the number of scanning lines according to the judgment result, and use the adjusted information on the number of scanning lines as the information on the number of lines of the input image in step S2, and return to step S2.
进一步地,所述步骤S1中实时采集图像的矩阵表达式为:Further, the matrix expression of the real-time image acquisition in the step S1 is:
所述标准采样图像的矩阵表达式为:The matrix expression of the standard sampling image is:
其中,A为实时采集图像的矩阵,B为标准采样图像的矩阵,ε为起始扫描位置,x为每次扫描的行数,y为每次扫描的列数,η为标准采样图像截取的起始值。Among them, A is the matrix of real-time collected images, B is the matrix of standard sampled images, ε is the starting scanning position, x is the number of rows per scan, y is the number of columns per scan, and η is the standard sampled image intercepted starting value.
再进一步地,所述步骤S2包括以下步骤:Still further, the step S2 includes the following steps:
S201、输入实时采集图像;S201, input real-time acquisition image;
S202、输入图像行数信息:设置拼接行数的默认值,并根据所述行数的默认值计算得到下一次的拼接行数值;S202. Input image row number information: set a default value of the number of stitched rows, and calculate the value of the next stitched row according to the default value of the number of rows;
S203、图像拼接重组:根据所述拼接行数的默认值,将所述标准采样图像以及实时采集图像按行进行图像拼接重组处理。S203. Image splicing and reorganization: according to the default value of the number of spliced rows, perform image splicing and reorganization processing on a row-by-row basis for the standard sampled image and the real-time captured image.
再进一步地,所述步骤S202中下一次拼接行数值的表达式如下:Still further, the expression of the value of the next spliced row in the step S202 is as follows:
ω′=ω+Rpre+Rafter ω′=ω+R pre +R after
其中,ω'为下一次拼接行数值,Rpre为所需之前行,Rafter为所需之后行,ω为拼接行数默认值。Among them, ω' is the value of the next spliced row, R pre is the required previous row, R after is the required subsequent row, and ω is the default value of the spliced row number.
再进一步地,所述步骤S203中重组后实时采集图像的矩阵表达式为:Still further, the matrix expression of the recombined real-time acquired image in the step S203 is:
所述重组后标准采样图像的矩阵表达式为:The matrix expression of the standard sampling image after the recombination is:
其中,A'为重组后的实时采集图像矩阵,B'为重组后的标准采样图矩阵,Rpre为所需之前行,Rafter为所需之后行,ω为拼接行数默认值,x为每次扫描的行数,y为每次扫描的列数,η为标准采样图像截取的起始值。Among them, A' is the reorganized real-time acquisition image matrix, B' is the reorganized standard sampling image matrix, R pre is the required previous row, R after is the required subsequent row, ω is the default value of the number of spliced rows, and x is The number of rows for each scan, y is the number of columns for each scan, and η is the initial value of standard sampling image interception.
再进一步地,所述步骤S3包括以下步骤:Still further, the step S3 includes the following steps:
S301、利用结构相似性算法分别计算得到拼接后的实时采集图像和标准采样图像的亮度、对比度以及结构;S301. Calculate and obtain the brightness, contrast and structure of the spliced real-time captured image and the standard sampled image respectively by using a structural similarity algorithm;
S302、将实时采集图像和标准采样图像的亮度、对比度以及结构按比例进行融合,得到评价函数;S302. Proportionally fuse the brightness, contrast and structure of the real-time collected image and the standard sampled image to obtain an evaluation function;
S303、判断所述评价函数是否大于预设的检测阈值Td,若是,则结束本次检测,从而完成对PCB电路板的缺陷检测,否则,标记当前采集图像中的缺陷位置,并输出当前的缺陷检测图像,并进入步骤S4。S303. Judging whether the evaluation function is greater than the preset detection threshold T d , if so, end this detection, thereby completing the defect detection of the PCB circuit board, otherwise, mark the defect position in the currently collected image, and output the current Defect detection image, and go to step S4.
再进一步地,所述评价函数的表达式如下:Further, the expression of the evaluation function is as follows:
F(A',B')=[L(A',B')]α[C(A',B')]β[S(A',B')]γ F(A',B')=[L(A',B')] α [C(A',B')] β [S(A',B')] γ
其中,F(A',B')为评价函数,μA'为矩阵A'的像素平均灰度值,μB'为矩阵B'的像素平均灰度值,N为像素点总数,xi为矩阵A'对应的像素点的值,yi为矩阵B'对应的像素点的值,i为矩阵A'中对应点的下标,σA'为矩阵A'的标准差,σB'为矩阵B'的标准差,L(A',B')为矩阵A'和矩阵B'的亮度对比函数,为矩阵A'的像素平均灰度值的平方,为矩阵B'的像素平均灰度值的平方,C1,C2,C3均为用来增加计算结果的稳定性参数,C(A',B')为矩阵A'和矩阵B'的对比度对比函数,为矩阵A'的方差,为矩阵B'的方差,S(A',B')为矩阵A'和矩阵B'的结构对比函数,σA'B'为矩阵A'和矩阵B'的协方差,α,β,γ均为调整三个模块间的参数,A'为重组后的实时采集图像矩阵,B'为重组后的标准采样图矩阵。Among them, F(A', B') is the evaluation function, μ A' is the pixel average gray value of matrix A', μ B' is the pixel average gray value of matrix B', N is the total number of pixels, x i is the value of the pixel point corresponding to matrix A', y i is the value of the pixel point corresponding to matrix B', i is the subscript of the corresponding point in matrix A', σ A' is the standard deviation of matrix A', σ B' is the standard deviation of matrix B', L(A',B') is the brightness comparison function of matrix A' and matrix B', is the square of the average gray value of the pixel of the matrix A', is the square of the average pixel gray value of matrix B', C 1 , C 2 , and C 3 are all stability parameters used to increase the calculation results, and C(A', B') is the matrix A' and matrix B' contrast contrast function, is the variance of the matrix A', is the variance of matrix B', S(A', B') is the structure comparison function of matrix A' and matrix B', σ A'B' is the covariance of matrix A' and matrix B', α, β, γ Both are to adjust the parameters among the three modules, A' is the real-time acquisition image matrix after reorganization, and B' is the standard sampling image matrix after reorganization.
再进一步地,所述步骤S4包括以下步骤:Still further, the step S4 includes the following steps:
S401、根据判断结果判断是否有缺陷检测图像输入,若是,则进入步骤S402,否则,结束流程;S401. Judging whether there is a defect detection image input according to the judgment result, if yes, then enter step S402, otherwise, end the process;
S402、判断是否需要之前的扫描行信息,若是,则设置当前的行数信息为所需之前行数Rpre,并进入步骤S403,否则,当前图像的成像范围为PCB电路板的起始范围,并进入步骤S403;S402. Determine whether the previous scanning line information is needed, if so, set the current line number information as the required previous line number R pre , and enter step S403, otherwise, the imaging range of the current image is the initial range of the PCB circuit board, And enter step S403;
S403、判断是否需要之后的扫描行信息,若是,则设置当前的行数信息为所需之后行数Rafter,并利用所需之后行数Rafter补全当前图像信息,并进入步骤S404,否则,结束流程;S403, judge whether to need the scanning row information afterwards, if so, then set the current row number information as the required row number R after , and use the required row number R after to complete the current image information, and enter step S404, otherwise , end the process;
S404、将所述所需之前行数Rpre以及所需之后行数Rafter作为步骤S2中的输入图像行数信息,并返回步骤S2。S404. Use the required number of rows before R pre and the number of rows after R after as the input image row number information in step S2, and return to step S2.
再进一步地,所述步骤S404中输入图像的行数信息的表达式如下:Furthermore, the expression of the line number information of the input image in the step S404 is as follows:
ω′=ω+Rpre+Rafter ω′=ω+R pre +R after
其中,ω'为输出图像的行数信息,即下一次拼接行数值,Rpre为所需之前行,Rafter为所需之后行,ω为拼接行数默认值。Among them, ω' is the line number information of the output image, that is, the value of the next spliced line, R pre is the required previous line, R after is the required subsequent line, and ω is the default value of the spliced line number.
本发明的有益效果:Beneficial effects of the present invention:
(1)本发明为了克服现有PCB在线检测技术实时性和效率上的不足,使用CCD作为采集设备,以PCB电路板作为检测对象,以图像采集、图像处理等技术为支撑,对PCB板进行在线的缺陷检测,能够提高实时采集和检测效率,具有较高的准确率和实时性,以实现PCB在线检测的进一步发展。本发明是在使用线性CCD相机在标准采集速度下的基础上进行,利用线性CCD相机按行扫描采集图像的特点,使用结构相似性算法的作为缺陷检测基础的情况下,进行PCB电路板缺陷检测,由于使用结构相似性算法进行缺陷检测需要大量的图像信息,常用的以整体图像为主,本发明利用CCD相机特点,通过控制图像成像行数来实现部分图像信息进行检测及信息可调;(1) In order to overcome the deficiencies in the real-time and efficiency of the existing PCB online detection technology, the present invention uses a CCD as a collection device, uses a PCB circuit board as a detection object, and supports technologies such as image collection and image processing to carry out PCB board inspection. Online defect detection can improve the efficiency of real-time collection and detection, and has high accuracy and real-time performance, so as to realize the further development of PCB online detection. The present invention is carried out on the basis of using a linear CCD camera at a standard acquisition speed, utilizing the characteristics of the linear CCD camera to scan and acquire images by row, and using the structural similarity algorithm as the basis for defect detection to detect defects on PCB circuit boards , because the use of structural similarity algorithm for defect detection requires a large amount of image information, and the commonly used one is based on the overall image. The present invention utilizes the characteristics of a CCD camera to realize partial image information detection and information adjustment by controlling the number of image imaging lines;
(2)本发明使用线性CCD采集图像,利用线性CCD行扫描成像的特点,实现图像拼接,缺陷检测,自校正的功能,同时,CCD采集模块与其他模块互不干扰,并行运行,实现在线检测的效果。本发明通过将采集图像和标准采样图像分别传入图像修复还原模块,缺陷检测模块,自校正模块完成对PCB的缺陷检测,利用自校正模块对拼接行数进行调整,完备图像信息,避免误检测。本发明有效利用线性CCD相机有效地提高了PCB缺陷检测的效率,节约了生产成本,提高了实时性。(2) The present invention uses a linear CCD to collect images, and utilizes the characteristics of linear CCD line scanning imaging to realize image mosaic, defect detection, and self-correction functions. At the same time, the CCD acquisition module and other modules do not interfere with each other and run in parallel to realize online detection. Effect. In the present invention, the collected image and the standard sampled image are respectively transmitted to the image restoration module, the defect detection module, and the self-correction module to complete the defect detection of the PCB, and the self-correction module is used to adjust the number of stitching lines, complete the image information, and avoid false detection . The invention effectively utilizes the linear CCD camera to effectively improve the efficiency of PCB defect detection, saves the production cost and improves the real-time performance.
附图说明Description of drawings
图1为本发明的系统框图。Fig. 1 is a system block diagram of the present invention.
图2为本发明实施例的并行示意图。Fig. 2 is a parallel schematic diagram of an embodiment of the present invention.
图3为本发明的方法流程图。Fig. 3 is a flow chart of the method of the present invention.
图4为本发明的图像重组拼接模块流程图。Fig. 4 is a flow chart of the image reorganization and stitching module of the present invention.
图5为本发明的缺陷检测模块流程图。Fig. 5 is a flowchart of the defect detection module of the present invention.
图6为本发明的自校正模块流程图。Fig. 6 is a flowchart of the self-calibration module of the present invention.
具体实施方式Detailed ways
下面对本发明的具体实施方式进行描述,以便于本技术领域的技术人员理解本发明,但应该清楚,本发明不限于具体实施方式的范围,对本技术领域的普通技术人员来讲,只要各种变化在所附的权利要求限定和确定的本发明的精神和范围内,这些变化是显而易见的,一切利用本发明构思的发明创造均在保护之列。The specific embodiments of the present invention are described below so that those skilled in the art can understand the present invention, but it should be clear that the present invention is not limited to the scope of the specific embodiments. For those of ordinary skill in the art, as long as various changes Within the spirit and scope of the present invention defined and determined by the appended claims, these changes are obvious, and all inventions and creations using the concept of the present invention are included in the protection list.
实施例Example
如图1所示,本发明提供了一种基于CCD相机的PCB电路板缺陷检测系统,包括CCD图像采集模块,以及分别与所述CCD图像采集模块设置在同一台上位机上的图像重组拼接模块、缺陷检测模块以及自校正模块;As shown in Fig. 1, the present invention provides a kind of PCB circuit board defect detection system based on CCD camera, comprises CCD image acquisition module, and the image reorganization splicing module that is respectively arranged on the same upper computer with described CCD image acquisition module, Defect detection module and self-correction module;
所述CCD图像采集模块用于实时扫描采集图像,并将实时扫描采集的图像以及获取的标准采样图像传入至图像重组拼接模块;所述CCD图像采集模块包括CCD相机以及CCD图像采集接口;The CCD image acquisition module is used for real-time scanning and acquisition of images, and the images collected by real-time scanning and the standard sampling images obtained are transferred to the image reorganization stitching module; the CCD image acquisition module includes a CCD camera and a CCD image acquisition interface;
所述图像重组拼接模块用于接收自校正模块传入的图像行数信息,并根据所述图像行数信息,将输入的实时采集图像以及标准采样图像按行分别进行图像拼接重组,并将拼接后的图像传入至缺陷检测模块;The image recombination and stitching module is used to receive the image line number information imported from the correction module, and according to the image line number information, perform image splicing and reorganization on the input real-time collected images and standard sampling images by line, and splicing The final image is passed to the defect detection module;
所述缺陷检测模块用于根据拼接后的采集图像和标准采样图像利用结构相似性算法计算得到对应图像的亮度、对比度和结构,并根据计算结果得到采集图像和标准采样图像的差异,并根据所述差异得到缺陷位置,并将其缺陷位置传入至自校正模块;The defect detection module is used to calculate the brightness, contrast and structure of the corresponding image according to the spliced collected image and the standard sampled image using a structural similarity algorithm, and obtain the difference between the collected image and the standard sampled image according to the calculation result, and according to the obtained The defect position is obtained from the above difference, and the defect position is passed to the self-calibration module;
所述自校正模块用于根据得到的缺陷位置对扫描行数进行调整,并将调整行数输入至图像拼接模块。The self-correcting module is used to adjust the number of scanning lines according to the obtained defect position, and input the adjusted number of lines to the image stitching module.
本实施例中,本发明采用并行模块,CCD图像采集模块与图像重组拼接模块、缺陷检测模块以及自校正模块并行工作,用于提升检测的实时性,完成在线检测。In this embodiment, the present invention adopts a parallel module, and the CCD image acquisition module works in parallel with the image reorganization and splicing module, the defect detection module and the self-correction module to improve the real-time performance of detection and complete online detection.
本实施例中,如图2所示,整个系统运行主要含有两大部分,即采集程序和检测程序,采集程序和检测程序均设计为在同一台上位机上以并行的方式运行。采集程序中主要运行图像采集模块,检测程序主要运行图像拼接重组模块,缺陷检测模块和自校正模块。从时间轴上看,采集程序和运行程序并行运行,因为线性CCD采集图像时通过行扫描,所以在行扫描的过程中,检测程序主要是将某部分的行进行拼接检测,构成独立的程序块。每个检测程序块独立运行互不干扰,以并行的方式运行,从图像采集行数的轴上来看,每个检测程序检测不同的行,实现并行运行。In this embodiment, as shown in FIG. 2 , the operation of the whole system mainly includes two parts, that is, the collection program and the detection program. Both the collection program and the detection program are designed to run in parallel on the same host computer. The acquisition program mainly runs the image acquisition module, and the detection program mainly runs the image splicing and recombination module, the defect detection module and the self-correction module. From the perspective of the time axis, the acquisition program and the running program run in parallel, because the linear CCD acquires images through line scanning, so in the process of line scanning, the detection program mainly splices and detects certain lines to form an independent program block . Each detection program block runs independently without interfering with each other, and runs in a parallel manner. From the perspective of the axis of image acquisition lines, each detection program detects different lines to achieve parallel operation.
本发明是在使用线性CCD相机在标准采集速度下的基础上进行,利用线性CCD按行扫描采集图像的特点,使用结构相似性算法的作为缺陷检测基础的情况下,进行PCB电路板缺陷检测,由于使用结构相似性算法进行缺陷检测需要大量的图像信息,常用的以整体图像为主,本发明利用线性CCD按行扫描采集图像的特点,通过控制图像成像行数来实现部分图像信息进行检测及信息可调,如图3所示,其实现方法如下:The present invention is carried out on the basis of using a linear CCD camera at a standard acquisition speed, utilizes the characteristics of the linear CCD to scan and acquire images by lines, and uses the structural similarity algorithm as the basis for defect detection to detect defects on PCB circuit boards. Since the use of structural similarity algorithm for defect detection requires a large amount of image information, the commonly used ones are mainly the overall image. The present invention utilizes the characteristics of linear CCD to scan and collect images by lines, and realizes partial image information detection and detection by controlling the number of image imaging lines. The information is adjustable, as shown in Figure 3, and its implementation method is as follows:
S1、获取标准采样图像,并设置CCD相机的采集行数以及CCD相机的基本设置,并利用CCD相机实时扫描采集图像。S1. Obtain a standard sampling image, and set the number of acquisition lines of the CCD camera and the basic settings of the CCD camera, and use the CCD camera to scan and acquire images in real time.
本实施例中,依线性CCD成像的特点,设置每次扫描的行数为x,列数为y,设置列数为固定值,设起始扫描位置为ε,故每次所扫描成像的图像大小为x×y,所成矩阵为:In this embodiment, according to the characteristics of linear CCD imaging, the number of rows of each scan is set to x, the number of columns is y, the number of columns is set to a fixed value, and the initial scanning position is set to ε, so the image scanned each time is The size is x×y, and the resulting matrix is:
同时所需标准采样图传入的大小同样为x×y,标准采样图传入的大小是本身图片中像素行数的截取部分,保留一个原始标准采样图截取起始值为η,故截取图像的成像范围矩阵:At the same time, the input size of the required standard sampling image is also x×y, and the input size of the standard sampling image is the intercepted part of the number of pixel rows in the image itself, and an original standard sampling image is retained to intercept the starting value η, so the image is intercepted The imaging extent matrix of :
将实时采集图像矩阵A传入至图像重组拼接模块。Pass the real-time acquisition image matrix A to the image reconstruction and stitching module.
S2、输入图像行数信息,并根据所述图像行数信息将所述标准采样图像以及实时采集图像按行分别进行图像拼接重组处理,如图4所示,其实现方法如下:S2. Input image row number information, and according to the image row number information, perform image splicing and reorganization processing on the standard sampling image and real-time collected image by row, as shown in Figure 4, the implementation method is as follows:
S201、输入实时采集图像;S201, input real-time acquisition image;
S202、输入图像行数信息:设置拼接行数的默认值,并根据所述接行数的默认值计算得到下一次的拼接行数值;S202. Input image line number information: set a default value of the number of spliced lines, and calculate the value of the next spliced line according to the default value of the number of spliced lines;
下一次拼接行数值的表达式如下:The expression for the next concatenation row value is as follows:
ω′=ω+Rpre+Rafter ω′=ω+R pre +R after
其中,ω'为下一次拼接行数值,Rpre为所需之前行,Rafter为所需之后行,ω为拼接行数默认值;Among them, ω' is the value of the next spliced row, R pre is the required previous row, R after is the required subsequent row, and ω is the default value of the spliced row number;
S203、图像拼接重组:根据所述拼接行数的默认值,将所述标准采样图像以及采集图像按行进行图像拼接重组处理,重组后实时采集图像的矩阵表达式为:S203. Image splicing and reorganization: according to the default value of the number of spliced rows, perform image splicing and reorganization processing on the standard sampled image and the collected image by row, and the matrix expression of the real-time collected image after reorganization is:
所述重组后标准采样图像的矩阵表达式为:The matrix expression of the standard sampling image after the recombination is:
其中,A'为重组后的实时采集图像矩阵,B'为重组后的标准采样图矩阵,Rpre为所需之前行,Rafter为所需之后行,ω为拼接行数默认值,x为每次扫描的行数,y为每次扫描的列数,η为标准采样图像截取的起始值。Among them, A' is the reorganized real-time acquisition image matrix, B' is the reorganized standard sampling image matrix, R pre is the required previous row, R after is the required subsequent row, ω is the default value of the number of spliced rows, and x is The number of rows for each scan, y is the number of columns for each scan, and η is the initial value of standard sampling image interception.
本实施例中,图像重组拼接模块旨在将输入的实时采集图像按行进行图像拼接传递给缺陷检测模块,同时图像重组拼接模块也接收自校正模块所传递的拼接行数信息,便于下一步缺陷检测的处理。In this embodiment, the image reorganization and stitching module is designed to stitch the input real-time captured images line by line and transmit them to the defect detection module. At the same time, the image reorganization and stitching module also receives the information on the number of stitching lines delivered by the self-calibration module, which is convenient for the next step. Detection processing.
S3、利用结构相似性算法分别计算得到拼接后的实时采集图像和标准采样图像的亮度、对比度和结构,并根据计算结果判断是否存在缺陷,若是,则进入步骤S4,否则,结束本次检测,从而完成对PCB电路板的缺陷检测,其实现方法如图5所示:S3. Using the structural similarity algorithm to calculate the brightness, contrast and structure of the spliced real-time acquisition image and the standard sampling image respectively, and judge whether there is a defect according to the calculation result, if so, enter step S4, otherwise, end this detection, In order to complete the defect detection of the PCB circuit board, the implementation method is shown in Figure 5:
S301、利用结构相似性算法分别计算得到拼接后的实时采集图像和标准采样图像的亮度,对比度以及结构;S301. Using the structure similarity algorithm to calculate the brightness, contrast and structure of the spliced real-time collected image and the standard sampled image respectively;
S302、将实时采集图像和标准采样图像的亮度,对比度以及结构按比例进行融合,得到评价函数;S302. Fusing the brightness, contrast and structure of the real-time collected image and the standard sampled image in proportion to obtain an evaluation function;
S303、判断所述评价函数是否大于预设的检测阈值Td,若是,则结束本次检测,从而完成对PCB电路板的缺陷检测,否则,标记当前采集图像中的缺陷位置,并输出当前的缺陷检测图像,并进入步骤S4。S303. Judging whether the evaluation function is greater than the preset detection threshold T d , if so, end this detection, thereby completing the defect detection of the PCB circuit board, otherwise, mark the defect position in the currently collected image, and output the current Defect detection image, and go to step S4.
本实施例中,所述的缺陷检测模块旨在通过结构相似性算法对传入的采集图像和标准采样图进行相应的亮度、对比度、结构的计算,通过具体的计算得出两幅图像的差异,从而得出其缺陷位置,若存在缺陷,则将其标记后传入自校正模块。In this embodiment, the defect detection module is designed to calculate the corresponding brightness, contrast and structure of the incoming collected image and the standard sampling image through the structural similarity algorithm, and obtain the difference between the two images through specific calculations. , so as to obtain its defect position, if there is a defect, it will be marked and passed to the self-calibration module.
本实施例中,从图像重组拼接模块中,传入采集图像矩阵A'和传入的标准采样图像矩阵为B'。图像质量受到亮度信息和对比度信息的制约,因此在计算图像质量好坏时,在考虑结构信息的同时也需要考虑这两者的影响。In this embodiment, from the image reorganization and stitching module, the incoming acquisition image matrix A' and the incoming standard sampling image matrix are B'. Image quality is restricted by brightness information and contrast information. Therefore, when calculating image quality, it is necessary to consider the influence of the two while considering structural information.
本实施例中,以图像平均灰度值作为亮度测量的估计,矩阵A'的像素平均灰度值为:In this embodiment, the average gray value of the image is used as the estimation of the brightness measurement, and the average gray value of the pixel of the matrix A' is:
矩阵B'的像素平均灰度值为:The pixel average gray value of matrix B' is:
以图像标准差作为对比度估量值,矩阵A'的标准差为:Taking the standard deviation of the image as the contrast estimation value, the standard deviation of matrix A' is:
矩阵B'的标准差为:The standard deviation of matrix B' is:
矩阵A'和B'的亮度对比函数为:The brightness contrast function of matrices A' and B' is:
矩阵A'和B'的对比度对比函数为:The contrast function of matrices A' and B' is:
矩阵A'和B'的结构对比函数为:The structure comparison function of matrices A' and B' is:
其中,组合亮度,对比度和结构三个相关函数,得到评价函数:in, Combining the three correlation functions of brightness, contrast and structure, the evaluation function is obtained:
F(A',B')=[L(A',B')]α[C(A',B')]β[S(A',B')]γ F(A',B')=[L(A',B')] α [C(A',B')] β [S(A',B')] γ
上述式中,F(A',B')为评价函数,μA'为矩阵A'的像素平均灰度值,μB'为矩阵B'的像素平均灰度值,N为像素点总数,xi为矩阵A'对应的像素点的值,yi为矩阵B'对应的像素点的值,i为矩阵A'中对应点的下标,σA'为矩阵A'的标准差,σB'为矩阵B'的标准差,L(A',B')为矩阵A'和矩阵B'的亮度对比函数,为矩阵A'的像素平均灰度值的平方,为矩阵B'的像素平均灰度值的平方,C1,C2,C3均为用来增加计算结果的稳定性参数,C(A',B')为矩阵A'和矩阵B'的对比度对比函数,为矩阵A'的方差,为矩阵B'的方差,S(A',B')为矩阵A'和矩阵B'的结构对比函数,σA'B'为矩阵A'和矩阵B'的协方差,α,β,γ均为调整三个模块间的参数,A'为重组后的实时采集图像矩阵,B'为重组后的标准采样图矩阵。In the above formula, F(A', B') is the evaluation function, μ A' is the pixel average gray value of matrix A', μ B' is the pixel average gray value of matrix B', N is the total number of pixels, x i is the value of the pixel point corresponding to the matrix A', y i is the value of the pixel point corresponding to the matrix B', i is the subscript of the corresponding point in the matrix A', σ A' is the standard deviation of the matrix A', σ B' is the standard deviation of matrix B', L(A', B') is the brightness contrast function of matrix A' and matrix B', is the square of the average gray value of the pixel of the matrix A', is the square of the average pixel gray value of matrix B', C 1 , C 2 , and C 3 are all parameters used to increase the stability of the calculation results, and C(A', B') is the matrix A' and matrix B' contrast contrast function, is the variance of the matrix A', is the variance of matrix B', S(A', B') is the structure comparison function of matrix A' and matrix B', σ A'B' is the covariance of matrix A' and matrix B', α, β, γ Both are to adjust the parameters among the three modules, A' is the real-time acquisition image matrix after reorganization, and B' is the standard sampling image matrix after reorganization.
本实施例中,通过该评价函数可以计算出图像中具体的像素差异,从而发现缺陷,明显的,该公式从像素级别进行判断,所以有很强的敏感性,从而会出现误检测的情况,其不存在漏检现象,存在误检现象,是由于当前图像信息不完备所造成的,这是使用结构相似性算法的一个缺陷,在自校正模块中对此缺陷进行了一定的修正。In this embodiment, the specific pixel difference in the image can be calculated through the evaluation function, so as to find defects. Obviously, this formula is judged from the pixel level, so it has a strong sensitivity, so that false detection may occur. There is no missing detection phenomenon, and there is false detection phenomenon, which is caused by the incompleteness of the current image information. This is a defect of using the structural similarity algorithm. This defect has been corrected in the self-correction module.
S4、根据判断结果进行扫描行数调整处理,并将调整的扫描行数信息作为步骤S2中的输入图像行数信息,并返回步骤S2,如图6所示,其实现方法如下:S4. Carry out the adjustment process of the number of scanning lines according to the judgment result, and use the adjusted scanning line number information as the input image line number information in step S2, and return to step S2, as shown in Figure 6, the implementation method is as follows:
S401、判断是否有缺陷检测图像输入,若是,则进入步骤S402,否则,结束流程;S401. Determine whether there is a defect detection image input, if so, enter step S402, otherwise, end the process;
S402、判断是否需要之前的扫描行信息,若是,则设置当前的行数信息为所需之前行数Rpre,并进入步骤S403,否则,当前图像的成像范围为PCB电路板的起始范围,并进入步骤S403;S402. Determine whether the previous scanning line information is needed, if so, set the current line number information as the required previous line number R pre , and enter step S403, otherwise, the imaging range of the current image is the initial range of the PCB circuit board, And enter step S403;
S403、判断是否需要之后的扫描行信息,若是,则设置当前的行数信息为所需之后行数Rafter,并利用所需之后行数Rafter补全当前图像信息,并进入步骤S404,否则,结束流程;S403, judge whether to need the scanning line information afterwards, if so, then set the current line number information as the required number of lines R after , and use the required number of lines R after to complete the current image information, and enter step S404, otherwise , end the process;
S404、将所述所需之前行数Rpre以及所需之后行数Rafter作为步骤S2中的输入图像行数信息,并返回步骤S2,S404. Using the required number of rows before R pre and the number of rows after R after as information on the number of input image rows in step S2, and returning to step S2,
所述输入图像的行数信息的表达式如下:The expression of the line number information of the input image is as follows:
ω′=ω+Rpre+Rafter ω′=ω+R pre +R after
其中,ω'为输出图像的行数信息,即下一次拼接行数值,Rpre为所需之前行,Rafter为所需之后行,ω为拼接行数默认值。Among them, ω' is the line number information of the output image, that is, the value of the next spliced line, R pre is the required previous line, R after is the required subsequent line, and ω is the default value of the spliced line number.
本实施例中,所述自校正模块旨在通过调节当前图像中的行数信息来规避由于图像信息不足造成的误检测现象,将调节的行数信息输出到图像重组拼接模块中,完成自校正过程,应当注意的是,之前行和之后行的信息均根据需求可调。In this embodiment, the self-calibration module aims to avoid the false detection phenomenon caused by insufficient image information by adjusting the line number information in the current image, and output the adjusted line number information to the image reorganization and splicing module to complete the self-calibration In the process, it should be noted that the information of the previous line and the next line can be adjusted according to requirements.
本发明通过以上设计,能够提高实时采集和检测效率,具有较高的准确率和实时性,以实现PCB电路板在线检测的进一步发展。Through the above design, the present invention can improve the efficiency of real-time collection and detection, has high accuracy and real-time performance, and realizes the further development of PCB circuit board online detection.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010039810.3A CN111598771B (en) | 2020-01-15 | 2020-01-15 | PCB (printed Circuit Board) defect detection system and method based on CCD (Charge coupled device) camera |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010039810.3A CN111598771B (en) | 2020-01-15 | 2020-01-15 | PCB (printed Circuit Board) defect detection system and method based on CCD (Charge coupled device) camera |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111598771A CN111598771A (en) | 2020-08-28 |
CN111598771B true CN111598771B (en) | 2023-03-14 |
Family
ID=72191966
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010039810.3A Expired - Fee Related CN111598771B (en) | 2020-01-15 | 2020-01-15 | PCB (printed Circuit Board) defect detection system and method based on CCD (Charge coupled device) camera |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111598771B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112215784B (en) * | 2020-12-03 | 2021-04-06 | 江西博微新技术有限公司 | Image decontamination method, image decontamination device, readable storage medium and computer equipment |
CN112652360B (en) * | 2020-12-15 | 2024-10-18 | 苏州缔因安生物科技有限公司 | Digital PCR fluorescent signal acquisition method, device, equipment and storage medium |
CN113533375A (en) * | 2021-08-26 | 2021-10-22 | 惠州市特创电子科技股份有限公司 | Forward and reverse scanning modeling detection method for printed circuit board |
CN115315048A (en) * | 2022-09-06 | 2022-11-08 | 深圳市三千米光电科技有限公司 | Big data analysis-based dimming system for infrared laser lamp |
CN116805298B (en) * | 2022-11-30 | 2024-09-13 | 慧之安信息技术股份有限公司 | Circuit board defect detection method based on edge calculation |
CN117372434B (en) * | 2023-12-08 | 2024-04-30 | 深圳市强达电路股份有限公司 | Positioning system and method for PCB production |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4186464B2 (en) * | 2000-03-13 | 2008-11-26 | 株式会社日立製作所 | Charged particle beam scanning system |
JP5536233B2 (en) * | 2010-01-21 | 2014-07-02 | ヒューレット−パッカード・インデイゴ・ビー・ブイ | Automatic inspection of printed images |
CN103308524A (en) * | 2012-03-16 | 2013-09-18 | 西安中科麦特电子技术设备有限公司 | PCB automatic optical inspection system |
CN104867144B (en) * | 2015-05-15 | 2018-05-01 | 广东工业大学 | IC element welding point defect detection methods based on mixed Gauss model |
CN108318804A (en) * | 2018-02-01 | 2018-07-24 | 江西景旺精密电路有限公司 | A kind of PCB automatic testing methods and system |
CN208206822U (en) * | 2018-04-10 | 2018-12-07 | 深圳市嘉立创科技发展有限公司 | Pcb board defect automatic checkout system based on machine vision |
CN109738450B (en) * | 2019-01-09 | 2021-06-29 | 合肥联宝信息技术有限公司 | Method and device for detecting notebook keyboard |
-
2020
- 2020-01-15 CN CN202010039810.3A patent/CN111598771B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN111598771A (en) | 2020-08-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111598771B (en) | PCB (printed Circuit Board) defect detection system and method based on CCD (Charge coupled device) camera | |
WO2022052480A1 (en) | Method and system for detecting and processing defect in lithium battery electrode plate in real time | |
CN106054421B (en) | A kind of detection method and device of liquid crystal display panel defect | |
CN107613229A (en) | A kind of dead pixels of image sensor surveys means for correcting and method | |
CN102879404B (en) | System for automatically detecting medical capsule defects in industrial structure scene | |
CN111624203B (en) | A non-contact measurement method for relay contact uniformity based on machine vision | |
CN204924967U (en) | Image acquisition mechanism of full -automatic AOI complete machine | |
CN103297654B (en) | Based on the method for correcting image of many CIS large format scanner | |
CN102854195B (en) | Method for detecting defect coordinates on color filter | |
CN112686890A (en) | Artificial board surface defect detection method based on singular value decomposition | |
CN107515481A (en) | Display panel detection method and device | |
CN110992313A (en) | Camera image center detection and center adjustment method based on machine vision | |
WO2017071406A1 (en) | Method and system for detecting pin of gold needle element | |
CN116030021B (en) | Automatic detection system for hidden crack characteristics of photovoltaic module | |
CN114359253A (en) | Image contamination detection method and system based on convolutional neural network | |
CN116990311A (en) | Defect detection system, method and device | |
CN113077416A (en) | Welding spot welding defect detection method and system based on image processing | |
CN108111777A (en) | A kind of dark angle correction system and method | |
CN105424714B (en) | The defects of based on multi-pipe pin detection device and its detection method | |
CN108511356A (en) | A kind of positioning of battery string welding machine and battery appearance detecting method | |
CN207283689U (en) | A kind of dead pixels of image sensor surveys means for correcting | |
CN113223095B (en) | Internal and external parameter calibration method based on known camera position | |
CN110738606A (en) | Image correction method, device, terminal and storage medium for multi-light source system | |
CN118868787A (en) | Photovoltaic defect remote monitoring method based on wireless communication transmission | |
CN113052829A (en) | Mainboard AOI detection method based on Internet of things |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | 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: 20230314 |