WO2024087640A1 - Printed circuit board welding spot defect detection method based on digital image processing - Google Patents

Printed circuit board welding spot defect detection method based on digital image processing Download PDF

Info

Publication number
WO2024087640A1
WO2024087640A1 PCT/CN2023/098804 CN2023098804W WO2024087640A1 WO 2024087640 A1 WO2024087640 A1 WO 2024087640A1 CN 2023098804 W CN2023098804 W CN 2023098804W WO 2024087640 A1 WO2024087640 A1 WO 2024087640A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
detection
circuit board
printed circuit
picture
Prior art date
Application number
PCT/CN2023/098804
Other languages
French (fr)
Chinese (zh)
Inventor
左健存
常远培
薛颖
张宇
孙晶国
季张源
李和威
Original Assignee
上海第二工业大学
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 上海第二工业大学 filed Critical 上海第二工业大学
Publication of WO2024087640A1 publication Critical patent/WO2024087640A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/14Transformations for image registration, e.g. adjusting or mapping for alignment of images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20032Median filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30141Printed circuit board [PCB]

Definitions

  • the invention belongs to the technical field of printed circuit board defect detection, and in particular relates to a printed circuit board solder joint defect detection method based on digital image processing.
  • PCB is an important basic component of integrated circuits, and its quality determines the overall performance of electronic products.
  • Conventional methods for detecting solder joint defects mainly including manual visual inspection, electrical inspection, X-ray inspection, etc., all have their own defects. Among them, manual visual inspection is costly, slow, and subjective; electrical inspection has low measurement accuracy, takes a long time, and can only detect a limited number of defects; X-ray inspection is slow, costly, and requires a long software development cycle.
  • the technical problem to be solved by the present invention is to provide a printed circuit board solder joint defect detection method based on digital image processing, which has good defect positioning performance, low cost, high accuracy and good practical performance.
  • the present invention adopts the following technical scheme.
  • a printed circuit board solder joint defect detection method based on digital image processing comprises the following steps:
  • Step 1 Capture the template image and the original image of the printed circuit board to be inspected through an image acquisition device.
  • Step 2 preprocessing the template image and the image to be tested; the preprocessing step includes grayscale transformation and median filtering;
  • Step 3 Perform particle swarm optimization (PSO) optimized maximum between-class variance (OTSU) threshold segmentation on the preprocessed template image and the image to be tested.
  • PSO particle swarm optimization
  • OTSU optimized maximum between-class variance
  • the fitness value is obtained and judged, and the individual optimal value and global optimal value of the particle are found.
  • the corresponding values of its speed and position are calculated and updated.
  • vi,j (t+1) wvi ,j (t ) + c1r1 [pi ,j - xi,j (t ) ]+ c2r2 [pg ,j - xi,j (t)] (1)
  • t is the number of cycles;
  • w is the inertia factor;
  • vi ,j is the velocity of the i-th particle in the j-dimensional solution space;
  • x i,j is the position of the i-th particle in the j-dimensional solution space
  • p g,j is the global extreme value
  • p i,j is the individual extreme value
  • c 1 and c 2 are learning factors
  • c 1 represents the particle's self-summary learning ability
  • c 2 represents the ability to learn from the best particle in the population
  • r 1 and r 2 are random numbers randomly distributed in [0,1].
  • Termination condition judgment if the number of iterations is less than the maximum number of iterations, return to 2; if it is greater than the maximum number of iterations, terminate the algorithm.
  • the global optimal value at this time is the threshold for segmentation. Use this threshold to perform threshold segmentation on the image.
  • Step 4 Perform image registration of the threshold segmented image with the template image that has also been threshold segmented using the FLANN optimized SURF algorithm. Extract basic feature points through the Hessian matrix, and then use the FLANN algorithm and RANSAC algorithm to remove mismatched points to improve the accuracy of feature point matching, and use the coordinates of the extracted optimal matching points to generate a perspective transformation matrix. Perform geometric transformation on the image to be tested to generate a registered image.
  • Step 5 Perform the difference method on the image, and subtract the image to be tested after registration from the template image after threshold segmentation to obtain a difference image.
  • Step 6 Binarize the difference image, and then perform an opening operation of first corrosion and then expansion. Corrosion reduces the gray value of the noise, and expansion increases the gray value of the defect. Therefore, the opening operation can effectively filter out the small noise in the difference image and highlight the defect information. Ultimately, the defects including leaking solder, notch, open circuit, short circuit, burr, and excess copper can be accurately located.
  • the present invention belongs to non-contact detection, which avoids product damage.
  • the detection equipment of the present invention is simple and low in cost, suitable for individuals and small and medium-sized enterprises.
  • the detection accuracy is as high as 99.3%, the false detection rate and missed detection rate are low, and it is suitable for PCB boards of different specifications. It has practical significance for improving product quality and saving costs.
  • the present invention reduces and eliminates interference information caused by internal and external factors during image acquisition and transmission through the preprocessing process, and uses image segmentation to make the image have sufficiently clear information of interest before recognition, so as to facilitate subsequent detection work.
  • the above basic features of PCB such as solder joints, circuits, edges, etc. are better preserved and highlighted through image preprocessing and image segmentation.
  • the detection method of the present invention is simple and practical; the detection accuracy is significantly improved by optimizing the OTSU threshold segmentation by PSO and optimizing the SURF image registration algorithm by FLANN in the above steps 3 and 4.
  • FIG. 1 is an example diagram of an image to be inspected after preprocessing in Example 1.
  • FIG. 1 is an example diagram of an image to be inspected after preprocessing in Example 1.
  • FIG. 2 is an example diagram of the image to be inspected after image segmentation and registration in Example 1.
  • FIG. 2 is an example diagram of the image to be inspected after image segmentation and registration in Example 1.
  • FIG. 3 is an example diagram of the difference between the template image and the image to be inspected in Example 1.
  • FIG. 3 is an example diagram of the difference between the template image and the image to be inspected in Example 1.
  • FIG. 4 is an example diagram of the image to be inspected in Example 1 after morphological processing.
  • FIG. 5 is a diagram showing a final defect detection example of Example 1.
  • the template image and the original image of the printed circuit board to be inspected are collected by the image acquisition device. Then, the image preprocessing is performed according to step 2, and the collected original image is grayed, grayscale linear transformation and median filtering are performed: 1 Grayscale transformation of the image: Using piecewise linear grayscale transformation to enhance the image contrast can highlight the target or grayscale range of interest and relatively suppress those grayscale areas of no interest.
  • x 1 and x 2 are the grayscale ranges that need to be converted, and y 1 and y 2 determine the slope of the linear transformation.
  • y ij The pixel value of the point after median filtering.
  • ⁇ x ij (i,j) ⁇ I 2 ⁇ is the grayscale value of each pixel in the image.
  • step 3 use the PSO algorithm to optimize the OTSU threshold segmentation algorithm, set the group size to 150, the number of thresholds to 2, the inertia weight to 0.8, the maximum number of iterations to 25, the self-learning factor to 0.5, and the group learning factor to 0.5, find a suitable threshold, and perform image segmentation on the image.
  • the template image is used as a reference.
  • the image to be tested is optimized by the FLANN algorithm for the SURF registration algorithm. After the RANSAC algorithm removes the mismatched points, a perspective transformation is performed to achieve image registration.
  • step 5 the registered image is subtracted from the template image to find the difference between the image to be tested and the template image, and an image with both noise and defects is obtained.
  • morphological processing is performed to remove isolated bright spots in the image, delete objects with an area less than 40 in the binary value, eliminate noise interference, and then perform an opening operation of first erosion and then dilation.
  • the present invention detects 693 PCB images of different specifications and different defect types, with an accuracy rate of 99.1%, a false detection rate of 0.58%, and a missed detection rate of 0.28%. The detection effect is good.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

Disclosed in the present invention is a printed circuit board welding spot defect detection method based on digital image processing. The method comprises the following steps: step 1, collecting a template picture and an original picture of a printed circuit board to be subjected to detection; step 2, preprocessing the template picture and a picture to be subjected to detection; step 3, performing particle-swarm-optimization(PSO)-based maximum inter-class variance (i.e. OTSU) thresholding on the preprocessed template picture and the preprocessed picture to be subjected to detection; step 4, according to the template picture and by using a FLANN optimization SURF algorithm, performing image registration on the picture to be subjected to detection, which has been subjected to thresholding; step 5, by using an image subtraction method, performing subtraction on a registered picture to be subjected to detection and the template picture, so as to obtain a difference image; and step 6, performing binarization on the difference image, and performing morphological processing such as an opening operation of corrosion followed by dilation, so as to finally locate a position with a defect. The detection method in the present invention is simple, is high in practicability, and can significantly improve the accuracy of detection.

Description

一种基于数字图像处理的印刷电路板焊点缺陷检测方法A printed circuit board solder joint defect detection method based on digital image processing 技术领域Technical Field
本发明属于印刷电路板缺陷检测技术领域,特别涉及一种基于数字图像处理的印刷电路板焊点缺陷检测方法。The invention belongs to the technical field of printed circuit board defect detection, and in particular relates to a printed circuit board solder joint defect detection method based on digital image processing.
背景技术Background technique
工业生产和制造水平的不断提高,加速了电子产品的更新换代,从而对底层基础设施的硬件设施提出了更高要求。PCB是集成电路的重要基础部件,其质量决定了电子产品的整体性能,但在PCB的生产过程中很难避免由于各种因素导致生产的PCB有缺陷。检测焊点缺陷的常规方法,主要包括人工目测、电检测、X射线检测等,都有其自身的缺陷。其中,人工目测检查成本高、速度慢、主观性强;电检测的测量精度低、耗时长,而且只能检测到有限种类的缺陷;X射线检测速度慢、成本高,而且需要很长的软件开发周期。与此同时,个人及中小企业对PCB缺陷检测的需求也在增加,焊点的缺陷检测能否实现低成本和高精确度是最重要的考虑因素。因此,研究如何通过低成本的图像处理技术来提高PCB缺陷检测的准确性是很重要的。The continuous improvement of industrial production and manufacturing levels has accelerated the replacement of electronic products, thus putting forward higher requirements for the hardware facilities of the underlying infrastructure. PCB is an important basic component of integrated circuits, and its quality determines the overall performance of electronic products. However, it is difficult to avoid defects in the produced PCB due to various factors during the production process of PCB. Conventional methods for detecting solder joint defects, mainly including manual visual inspection, electrical inspection, X-ray inspection, etc., all have their own defects. Among them, manual visual inspection is costly, slow, and subjective; electrical inspection has low measurement accuracy, takes a long time, and can only detect a limited number of defects; X-ray inspection is slow, costly, and requires a long software development cycle. At the same time, the demand for PCB defect detection by individuals and small and medium-sized enterprises is also increasing. Whether the defect detection of solder joints can achieve low cost and high accuracy is the most important consideration. Therefore, it is important to study how to improve the accuracy of PCB defect detection through low-cost image processing technology.
发明内容Summary of the invention
本发明所要解决的技术问题就是提供一种基于数字图像处理的印刷电路板焊点缺陷检测方法,该方法具有良好的缺陷定位性能,成本低,准确率高,具有良好的实用性能。The technical problem to be solved by the present invention is to provide a printed circuit board solder joint defect detection method based on digital image processing, which has good defect positioning performance, low cost, high accuracy and good practical performance.
本发明采用如下技术方案。The present invention adopts the following technical scheme.
一种基于数字图像处理的印刷电路板焊点缺陷检测方法,包括如下步骤:A printed circuit board solder joint defect detection method based on digital image processing comprises the following steps:
步骤1:通过图像采集设备对模板图片和待检测的印刷电路板的原始图片进行采集。Step 1: Capture the template image and the original image of the printed circuit board to be inspected through an image acquisition device.
步骤2:对所述模板图片和待测图片进行预处理;预处理步骤包括灰度变换和中值滤波;Step 2: preprocessing the template image and the image to be tested; the preprocessing step includes grayscale transformation and median filtering;
步骤3:对预处理后的模板图片和待测图片进行粒子群(PSO)优化的最大类间方差(OTSU)阈值分割。Step 3: Perform particle swarm optimization (PSO) optimized maximum between-class variance (OTSU) threshold segmentation on the preprocessed template image and the image to be tested.
①对PSO进行初始化,设置群体规模为N,阈值个数为2,惯性权重为W,最大迭代次数为G。① Initialize PSO, set the population size to N, the number of thresholds to 2, the inertia weight to W, and the maximum number of iterations to G.
②依据适应度的函数关系式,得到适应度值并进行判定,寻找此时粒子的个体最优值和全局最优值。根据公式(1)、公式(2)的关系式,计算更新其速度和位置的相应值。②According to the functional relationship of fitness, the fitness value is obtained and judged, and the individual optimal value and global optimal value of the particle are found. According to the relationship between formula (1) and formula (2), the corresponding values of its speed and position are calculated and updated.
vi,j(t+1)=wvi,j(t)+c1r1[pi,j-xi,j(t)]+c2r2[pg,j-xi,j(t)]   (1) vi,j (t+1)=wvi ,j (t ) + c1r1 [pi ,j - xi,j (t ) ]+ c2r2 [pg ,j - xi,j (t)] (1)
xi,j(t+1)=xi,j(t)+vi,j(t+1)j=1,2,3,...,d,   (2)x i,j (t+1)=x i,j (t)+v i,j (t+1)j=1,2,3,...,d, (2)
式中:t为进行循环的次数;w为惯性因子;vi,j为第i个粒子在j维解空间的速度; Where: t is the number of cycles; w is the inertia factor; vi ,j is the velocity of the i-th particle in the j-dimensional solution space;
xi,j为第i个粒子在j维解空间的位置;pg,j为全局极值;pi,j为个体极值;c1和c2为学习因子,c1代表粒子自我总结的学习能力,c2为向种群最好粒子的学习能力;r1和r2是在[0,1]内的随机分布的随机数。x i,j is the position of the i-th particle in the j-dimensional solution space; p g,j is the global extreme value; p i,j is the individual extreme value; c 1 and c 2 are learning factors, c 1 represents the particle's self-summary learning ability, and c 2 represents the ability to learn from the best particle in the population; r 1 and r 2 are random numbers randomly distributed in [0,1].
③再次根据惯性权重计算适应度值并进行判定,寻找最优的位置作为当前的位置。③ Calculate the fitness value again based on the inertia weight and make a judgment to find the optimal position as the current position.
④终止条件判断,如果迭代次数小于最大迭代次数,则返回②,如果大于最大迭代次数,则终止算法。④ Termination condition judgment: if the number of iterations is less than the maximum number of iterations, return to ②; if it is greater than the maximum number of iterations, terminate the algorithm.
⑤此时的全局最优值即为进行分割的阈值。使用该阈值对图像进行阈值分割。⑤The global optimal value at this time is the threshold for segmentation. Use this threshold to perform threshold segmentation on the image.
步骤4:将阈值分割后的图片,与同样进行阈值分割后的模板图片进行FLANN优化SURF算法的图像配准。通过Hessian矩阵提取基本特征点,然后使用FLANN算法和RANSAC算法剔除误匹配的点,来提高特征点匹配的准确性,利用提取到的最优配对点的坐标生成透视变换矩阵。对待测图像做几何变换,生成配准图片。Step 4: Perform image registration of the threshold segmented image with the template image that has also been threshold segmented using the FLANN optimized SURF algorithm. Extract basic feature points through the Hessian matrix, and then use the FLANN algorithm and RANSAC algorithm to remove mismatched points to improve the accuracy of feature point matching, and use the coordinates of the extracted optimal matching points to generate a perspective transformation matrix. Perform geometric transformation on the image to be tested to generate a registered image.
步骤5:对图像做差影法,将配准后的待测图片与阈值分割后的模板图片作差,得到差值图像。Step 5: Perform the difference method on the image, and subtract the image to be tested after registration from the template image after threshold segmentation to obtain a difference image.
步骤6:对差值图像进行二值化,再进行先腐蚀后膨胀的开运算操作,腐蚀降低噪声处灰度值,膨胀提高缺陷处的灰度值,因此开运算可以有效过滤掉差值图像中的细小噪声,突出缺陷信息。最终可以实现对包括漏焊、缺口、开路、短路、毛刺、余铜在内缺陷的准确定位。Step 6: Binarize the difference image, and then perform an opening operation of first corrosion and then expansion. Corrosion reduces the gray value of the noise, and expansion increases the gray value of the defect. Therefore, the opening operation can effectively filter out the small noise in the difference image and highlight the defect information. Ultimately, the defects including leaking solder, notch, open circuit, short circuit, burr, and excess copper can be accurately located.
和现有的技术相比,本发明的有益效果在于:Compared with the existing technology, the beneficial effects of the present invention are:
避免了人工目测的主观性,与电检测相比,本发明属于非接触式检测,避免产品产生损坏。本发明检测设备简单,成本低,适合个人及中小企业。检测准确率高达99.3%,误检率和漏检率低,且适用于不同规格的PCB板。对于提高产品质量、节约成本都具有现实意义。The subjectivity of manual visual inspection is avoided. Compared with electrical detection, the present invention belongs to non-contact detection, which avoids product damage. The detection equipment of the present invention is simple and low in cost, suitable for individuals and small and medium-sized enterprises. The detection accuracy is as high as 99.3%, the false detection rate and missed detection rate are low, and it is suitable for PCB boards of different specifications. It has practical significance for improving product quality and saving costs.
本发明通过预处理过程降低和消除图像在采集、传输过程中由于内外部因素带来的干扰信息,利用图像分割使图片在识别之前有足够清晰的感兴趣信息,以利于后续的检测工作。以上通过图像预处理和图像分割将PCB的焊点、线路、边缘等基本特征更好的保留并凸显出来。The present invention reduces and eliminates interference information caused by internal and external factors during image acquisition and transmission through the preprocessing process, and uses image segmentation to make the image have sufficiently clear information of interest before recognition, so as to facilitate subsequent detection work. The above basic features of PCB such as solder joints, circuits, edges, etc. are better preserved and highlighted through image preprocessing and image segmentation.
本发明检测方法简单,实用性强;通过上述步骤3和步骤4中的PSO优化OTSU阈值分割和FLANN优化SURF图像配准算法显著提高了检测准确率。The detection method of the present invention is simple and practical; the detection accuracy is significantly improved by optimizing the OTSU threshold segmentation by PSO and optimizing the SURF image registration algorithm by FLANN in the above steps 3 and 4.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是实施例1的待检图片图像预处理后的示例图。 FIG. 1 is an example diagram of an image to be inspected after preprocessing in Example 1. FIG.
图2是实施例1的待检图片进行图像分割和配准后的示例图。FIG. 2 is an example diagram of the image to be inspected after image segmentation and registration in Example 1. FIG.
图3是实施例1的模板图片与待检图片作差后的示例图。FIG. 3 is an example diagram of the difference between the template image and the image to be inspected in Example 1. FIG.
图4是实施例1的待检图片经过形态学处理后的示例图。FIG. 4 is an example diagram of the image to be inspected in Example 1 after morphological processing.
图5是实施例1的最终缺陷检测示例图。FIG. 5 is a diagram showing a final defect detection example of Example 1. FIG.
具体实施方式Detailed ways
下面结合附图和实施例对本发明作进一步说明,但不应以此限制本发明的保护范围。The present invention will be further described below in conjunction with the accompanying drawings and embodiments, but the protection scope of the present invention shall not be limited thereto.
实施例1Example 1
首先通过图像采集设备采集模板图片和待检测的印刷电路板的原始图片。接着按步骤2进行图像预处理,对采集到的原始图片进行彩色图片灰度化,灰度线性变换和中值滤波:①对图片做灰度变换:利用分段线性灰度变换增强图像对比度,可以突出感兴趣的目标或灰度区间,相对抑制那些不感兴趣的灰度区域。
First, the template image and the original image of the printed circuit board to be inspected are collected by the image acquisition device. Then, the image preprocessing is performed according to step 2, and the collected original image is grayed, grayscale linear transformation and median filtering are performed: ① Grayscale transformation of the image: Using piecewise linear grayscale transformation to enhance the image contrast can highlight the target or grayscale range of interest and relatively suppress those grayscale areas of no interest.
其中:x1、x2是需要转换的灰度范围,y1、y2决定线性变换的斜率。Among them: x 1 and x 2 are the grayscale ranges that need to be converted, and y 1 and y 2 determine the slope of the linear transformation.
②对图片做中值滤波,去除椒盐噪声:
② Perform median filtering on the image to remove salt and pepper noise:
yij:经过中值滤波处理之后该点的像素值。y ij : The pixel value of the point after median filtering.
{xij(i,j)∈I2}:为图像中各个像素的灰度值。{x ij (i,j)∈I 2 }: is the grayscale value of each pixel in the image.
其对应于图1。It corresponds to FIG. 1 .
接着按步骤3使用PSO算法优化OTSU阈值分割算法,设置群体规模为150,阈值个数为2,惯性权重为0.8,最大迭代次数为25次,自我学习因子为0.5,群体学习因子为0.5,寻找出合适的阈值,对图像进行图像分割。Then, according to step 3, use the PSO algorithm to optimize the OTSU threshold segmentation algorithm, set the group size to 150, the number of thresholds to 2, the inertia weight to 0.8, the maximum number of iterations to 25, the self-learning factor to 0.5, and the group learning factor to 0.5, find a suitable threshold, and perform image segmentation on the image.
然后按照步骤4以模板图片为基准,待测图片通过FLANN算法优化SURF配准算法,RANSAC算法剔除误匹配的点后,进行透视变换,实现图片配准。Then, according to step 4, the template image is used as a reference. The image to be tested is optimized by the FLANN algorithm for the SURF registration algorithm. After the RANSAC algorithm removes the mismatched points, a perspective transformation is performed to achieve image registration.
再根据步骤5将配准后的图片与模板图片作差,找到待测图片和模板图片之间的差异,得到噪声与缺陷都存在的图像。Then, according to step 5, the registered image is subtracted from the template image to find the difference between the image to be tested and the template image, and an image with both noise and defects is obtained.
最后根据步骤6对差值图片进行二值化后,做形态学处理,去除图像中孤立的亮点,删除二值中面积小于40的对象,排除噪声干扰,然后进行先腐蚀后膨胀的开运算操作, 提取出真的缺陷。本发明对693张不同规格,包含不同缺陷类型的PCB图片进行检测,准确率99.1%、误检率0.58%、漏检率0.28%。检测效果好。Finally, after binarizing the difference image according to step 6, morphological processing is performed to remove isolated bright spots in the image, delete objects with an area less than 40 in the binary value, eliminate noise interference, and then perform an opening operation of first erosion and then dilation. The present invention detects 693 PCB images of different specifications and different defect types, with an accuracy rate of 99.1%, a false detection rate of 0.58%, and a missed detection rate of 0.28%. The detection effect is good.
尽管本发明的内容已经通过上述优选实施例作了详细介绍,但应当认识到上述的描述不应被认为是对本发明的限制。在本领域技术人员阅读了上述内容后,对于本发明的多种修改和替代都将是显而易见的。因此,本发明的保护范围应由所附的权利要求来限定。 Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims.

Claims (3)

  1. 一种基于数字图像处理的印刷电路板焊点缺陷检测方法,其特征在于,包括以下步骤:A method for detecting solder joint defects of a printed circuit board based on digital image processing, characterized in that it comprises the following steps:
    步骤1:采集模板图片和待检测的印刷电路板的原始图片;Step 1: Collect the template image and the original image of the printed circuit board to be tested;
    步骤2:对模板图片和待测图片进行灰度变换和中值滤波的预处理,以降低或消除图干扰信息;Step 2: Preprocess the template image and the image to be tested by grayscale transformation and median filtering to reduce or eliminate image interference information;
    步骤3:对预处理后的模板图片和待测图片进行粒子群PSO优化的最大类间方差OTSU阈值分割;Step 3: Perform particle swarm optimization (PSO)-optimized maximum inter-class variance OTSU threshold segmentation on the preprocessed template image and the image to be tested;
    步骤4:将阈值分割后的待测图片,与同样进行阈值分割后的模板图片进行FLANN优化SURF算法的图像配准;Step 4: Perform image registration using the FLANN optimized SURF algorithm on the image to be tested after threshold segmentation and the template image after the same threshold segmentation;
    步骤5:利用差影法,将配准后的待测图片与阈值分割后的模板图片作差,得到差值图像;Step 5: Using the difference method, the registered image to be tested is subtracted from the template image after threshold segmentation to obtain a difference image;
    步骤6:对差值图像进行二值化,再进行先腐蚀后膨胀的开运算操作,通过腐蚀降低噪声处灰度值,通过膨胀提高缺陷处的灰度值,以过滤掉差值图像中的细小噪声,突出缺陷信息,最终实现对包括漏焊、缺口、开路、短路、毛刺、余铜在内缺陷的准确定位。Step 6: Binarize the difference image, and then perform an opening operation of first corrosion and then expansion. The grayscale value at the noise is reduced by corrosion, and the grayscale value at the defect is increased by expansion to filter out the fine noise in the difference image and highlight the defect information, ultimately achieving accurate positioning of defects including solder leaks, gaps, open circuits, short circuits, burrs, and excess copper.
  2. 根据权利要求1所述的印刷电路板焊点缺陷检测方法,其特征在于,步骤3中,对预处理后的模板图片和待测图片进行粒子群PSO优化的最大类间方差OTSU阈值分割的具体方法包括:The printed circuit board solder joint defect detection method according to claim 1 is characterized in that in step 3, the specific method of performing the maximum inter-class variance OTSU threshold segmentation optimized by particle swarm PSO on the preprocessed template image and the image to be tested includes:
    ①对PSO进行初始化,设置群体规模为N,阈值个数为2,惯性权重为W,最大迭代次数为G;① Initialize PSO, set the group size to N, the threshold number to 2, the inertia weight to W, and the maximum number of iterations to G;
    ②依据适应度的函数关系式,得到适应度值并进行判定,寻找此时粒子的个体最优值和全局最优值;根据公式(1)、公式(2),计算更新粒子速度和位置的相应值;
    vi,j(t+1)=wvi,j(t)+c1r1[pi,j-xi,j(t)]+c2r2[pg,j-xi,j(t)]  (1)
    xi,j(t+1)=xi,j(t)+vi,j(t+1)j=1,2,3,…,d,  (2)
    ②According to the functional relationship of fitness, the fitness value is obtained and judged, and the individual optimal value and global optimal value of the particle are found at this time; according to formula (1) and formula (2), the corresponding values of the updated particle speed and position are calculated;
    vi,j (t+1)=wvi ,j (t ) + c1r1 [pi ,j - xi,j (t ) ]+ c2r2 [pg ,j - xi,j (t)] (1)
    x i,j (t+1)=x i,j (t)+v i,j (t+1)j=1,2,3,…,d, (2)
    式中:t为进行循环的次数;w为惯性因子;vi,j为第i个粒子在j维解空间的速度;xi,j为第i个粒子在j维解空间的位置;pg,j为全局极值;pi,j为个体极值;c1和c2为学习因子,c1代表粒子自我总结的学习能力,c2为向种群最好粒子的学习能力;r1和r2是在[0,1]内的随机分布的随机数;Where: t is the number of cycles; w is the inertia factor; vi ,j is the speed of the ith particle in the j-dimensional solution space; xi,j is the position of the ith particle in the j-dimensional solution space; pg ,j is the global extreme value; pi ,j is the individual extreme value; c1 and c2 are learning factors, c1 represents the learning ability of the particle itself, and c2 is the learning ability from the best particle in the population; r1 and r2 are random numbers randomly distributed in [0,1];
    ③再次根据惯性权重计算适应度值并进行判定,寻找最优的位置作为当前的位置;③ Calculate the fitness value again according to the inertia weight and make a judgment to find the optimal position as the current position;
    ④终止条件判断,如果迭代次数小于最大迭代次数,则返回②,如果大于最大迭代次数,则终止算法;④Termination condition judgment: if the number of iterations is less than the maximum number of iterations, return to ②; if it is greater than the maximum number of iterations, terminate the algorithm;
    ⑤此时的全局最优值即为进行分割的阈值,使用该阈值对图像进行阈值分割。 ⑤The global optimal value at this time is the threshold for segmentation, and this threshold is used to perform threshold segmentation on the image.
  3. 根据权利要求1所述的印刷电路板焊点缺陷检测方法,其特征在于,步骤4中,通过Hessian矩阵提取基本特征点,然后使用FLANN算法和RANSAC算法剔除误匹配的点,来提高特征点匹配的准确性,利用提取到的最优配对点的坐标生成透视变换矩阵,对待测图像做几何变换,生成配准图片。 The printed circuit board solder joint defect detection method according to claim 1 is characterized in that, in step 4, basic feature points are extracted by the Hessian matrix, and then the FLANN algorithm and the RANSAC algorithm are used to eliminate the mismatched points to improve the accuracy of feature point matching, and the coordinates of the extracted optimal pairing points are used to generate a perspective transformation matrix, and the image to be tested is geometrically transformed to generate a registration image.
PCT/CN2023/098804 2022-10-26 2023-06-07 Printed circuit board welding spot defect detection method based on digital image processing WO2024087640A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211320711.8A CN115546182A (en) 2022-10-26 2022-10-26 Method for detecting welding spot defects of printed circuit board based on digital image processing
CN202211320711.8 2022-10-26

Publications (1)

Publication Number Publication Date
WO2024087640A1 true WO2024087640A1 (en) 2024-05-02

Family

ID=84718271

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/098804 WO2024087640A1 (en) 2022-10-26 2023-06-07 Printed circuit board welding spot defect detection method based on digital image processing

Country Status (2)

Country Link
CN (1) CN115546182A (en)
WO (1) WO2024087640A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115546182A (en) * 2022-10-26 2022-12-30 上海第二工业大学 Method for detecting welding spot defects of printed circuit board based on digital image processing
CN116309562B (en) * 2023-05-17 2023-08-18 江西萤火虫微电子科技有限公司 Board defect identification method and system
CN116433666B (en) * 2023-06-14 2023-08-15 江西萤火虫微电子科技有限公司 Board card line defect online identification method, system, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411777A (en) * 2011-06-15 2012-04-11 夏东 Method for detecting scratch defects of printing product
CN105405136A (en) * 2015-11-04 2016-03-16 南方医科大学 Self-adaptive spinal CT image segmentation method based on particle swarm optimization
CN110503633A (en) * 2019-07-29 2019-11-26 西安理工大学 A kind of applique ceramic disk detection method of surface flaw based on image difference
CN112489002A (en) * 2020-11-24 2021-03-12 广东省电子技术研究所 Defect detection method, device, equipment and storage medium
CN114187247A (en) * 2021-11-29 2022-03-15 河南大学 Ampoule bottle printing character defect detection method based on image registration
CN115546182A (en) * 2022-10-26 2022-12-30 上海第二工业大学 Method for detecting welding spot defects of printed circuit board based on digital image processing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411777A (en) * 2011-06-15 2012-04-11 夏东 Method for detecting scratch defects of printing product
CN105405136A (en) * 2015-11-04 2016-03-16 南方医科大学 Self-adaptive spinal CT image segmentation method based on particle swarm optimization
CN110503633A (en) * 2019-07-29 2019-11-26 西安理工大学 A kind of applique ceramic disk detection method of surface flaw based on image difference
CN112489002A (en) * 2020-11-24 2021-03-12 广东省电子技术研究所 Defect detection method, device, equipment and storage medium
CN114187247A (en) * 2021-11-29 2022-03-15 河南大学 Ampoule bottle printing character defect detection method based on image registration
CN115546182A (en) * 2022-10-26 2022-12-30 上海第二工业大学 Method for detecting welding spot defects of printed circuit board based on digital image processing

Also Published As

Publication number Publication date
CN115546182A (en) 2022-12-30

Similar Documents

Publication Publication Date Title
WO2024087640A1 (en) Printed circuit board welding spot defect detection method based on digital image processing
CN111369516B (en) Transformer bushing heating defect detection method based on infrared image recognition
CN107389701A (en) A kind of PCB visual defects automatic checkout system and method based on image
Liang et al. Defect detection of rail surface with deep convolutional neural networks
CN112037203A (en) Side surface defect detection method and system based on complex workpiece outer contour registration
CN111353993A (en) Thread angle measuring method based on machine vision
CN116433666B (en) Board card line defect online identification method, system, electronic equipment and storage medium
CN109584215A (en) A kind of online vision detection system of circuit board
CN106353324B (en) Magnet ring method for extracting surface defects
CN111638218A (en) Method for detecting surface defects of coating
CN113705564B (en) Pointer type instrument identification reading method
CN111310402B (en) Method for detecting defects of bare printed circuit board based on surface-to-surface parallelism
Cai et al. PCB defect detection system based on image processing
CN112233111A (en) Tunnel gap detection method based on digital image processing
CN112561875A (en) Photovoltaic cell panel coarse grid detection method based on artificial intelligence
CN111709910A (en) PCB defect detection algorithm based on convolutional neural network
CN116071306A (en) Machine vision detection method for riveting defect of rolling bearing retainer
CN116337869A (en) Machine vision-based detection system for production of double-sided circuit board
CN114266719A (en) Hough transform-based product detection method
WANG et al. Visual Tracking Inspection Method of Transmission Line based on Infrared Thermal Imaging.
CN113450331B (en) Special-shaped component pin detection method
Zheng et al. Industrial internet of things for mobile phone shell intelligent detection in smart cities
CN112330633B (en) Jumper wire adhesive tape damage fault image segmentation method based on self-adaptive band-pass filtering
CN111815600B (en) Visual-based annular magnetic steel appearance defect detection method
Lu et al. A Preprocessing Method for Fragment Perforation Image Detection