CN113724216B - Method and system for detecting wave crest welding spot defects - Google Patents

Method and system for detecting wave crest welding spot defects Download PDF

Info

Publication number
CN113724216B
CN113724216B CN202110977751.9A CN202110977751A CN113724216B CN 113724216 B CN113724216 B CN 113724216B CN 202110977751 A CN202110977751 A CN 202110977751A CN 113724216 B CN113724216 B CN 113724216B
Authority
CN
China
Prior art keywords
image
real
template
img
circle
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.)
Active
Application number
CN202110977751.9A
Other languages
Chinese (zh)
Other versions
CN113724216A (en
Inventor
曹江中
孔树荫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
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 Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN202110977751.9A priority Critical patent/CN113724216B/en
Publication of CN113724216A publication Critical patent/CN113724216A/en
Application granted granted Critical
Publication of CN113724216B publication Critical patent/CN113724216B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • G06T5/70
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • 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/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The invention provides a wave crest welding spot defect detection method and a system, which solve the problem of unsatisfactory detection accuracy of the current wave crest welding spot defect detection method based on automatic optical detection.

Description

Method and system for detecting wave crest welding spot defects
Technical Field
The invention relates to the technical field of machine vision and image processing, in particular to a method and a system for detecting wave crest welding spot defects.
Background
With the rapid development of national economy, the manufacturing industry as a national support is rapidly developing, the yield of global printed circuit boards is increasing day by day, the PCBA is required to be used as the basic material of many high-tech products nowadays, the PCBA is an integrated circuit board formed by welding various components on a blank PCB, and the main components include a chip component, a DIP component, an SIP component and the like. The performance of PCBA board can receive welding quality's direct influence, because the task of present welding is realized by automatic soldering tin machine mostly, consequently because the systematic error of soldering tin machine, the failure of failure etc. reason in welding process, different kinds of defect can appear in soldering tin, if with this kind of PCBA board that has bad soldering tin use in actual science and technology product, will make the life-span greatly reduced of product, can arouse the potential safety hazard even, these are all unacceptable product quality problems. In order to guarantee the production benefit of factories, improve the yield of factory production and reduce the missing detection and error detection of defective products, circuit board manufacturers have been increasing the solder detection requirements of PCBA boards year by year.
At present, many PCBA manufacturers mainly adopt modes such as manual detection, on-line detection, automatic X-ray detection, automatic optical detection and the like for detecting the solder defects. The manual detection mainly comprises that a worker searches for defects on the PCBA by using the aid of tools such as a magnifying glass, however, the manual detection has the disadvantage that the worker is limited in energy, the worker can be in a fatigue state when working for a long time, the PCBA with the defects is easily overlooked, or the correct PCBA is mistakenly detected, so that the false alarm rate and the false alarm rate are increased. On-line detection is a common means for detecting the quality of soldering tin at present, and has the advantages of low detection cost of single plates and strong detection performance, but has the disadvantages of low detection speed and long programming time. The automatic X-ray detection can detect defects with the size of more than 0.1 mu m, but the X-ray has harm to human bodies, and the physical health of workers can be influenced if the X-ray is adopted for detection due to huge yield of production fields.
The automatic optical detection is a method commonly used at present, which is a method for obtaining the surface state of a finished product in an industrial process by using an optical mode and detecting defects such as foreign matters or abnormal patterns by image processing, for example, in 2015, 12 months and 9 days, an image processing method for quickly and automatically detecting unqualified welding spots of an electrical connector is disclosed in a Chinese invention patent (publication No. CN 105139386A), the scheme provided in the patent is to analyze and obtain the defective parts of the welding spots by image processing, so that the detection effect is achieved, the subjective error caused by manual inspection can be eliminated, the detection consistency can be improved, the efficiency and the precision can be improved, the safety of personnel is guaranteed, the color image threshold segmentation is involved in the process, when the color image threshold segmentation is performed, the original connector circumscribed rectangle image is converted into HSV, an H channel image is segmented, the color threshold of the welding spots is used, the H channel binary image is morphologically filtered, the welding spot image is obtained, the requirements on section circle and gray level interpolation of the electrical connector can be reduced, but the welding spots are relatively limited by a single channel image mode, the extraction of the welding spots is not beneficial to the accurate peak ratio detection in a certain binary detection.
Disclosure of Invention
In order to solve the problem that the detection accuracy of the existing wave crest welding spot defect detection method based on automatic optical detection is not ideal, the invention provides a wave crest welding spot defect detection method and system, which can improve the accuracy of welding spot defect detection and optimize the welding spot defect detection effect.
In order to achieve the technical effects, the technical scheme of the invention is as follows:
the application provides a wave crest solder joint detection method, which comprises the following steps:
s1, collecting a template image of the PCBA;
s2, preprocessing a template image, acquiring character outline characteristics, a template welding spot image of a welding spot detection area, a template soldering tin image of a soldering tin detection area and a template welding pad image of a welding pad detection area, and storing the welding spot detection area, the soldering tin detection area and the welding pad detection area;
s3, manually selecting segmentation parameters according with the colors of normal welding spots based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model, performing RGB and HSV color image threshold segmentation on the template soldering tin image and the template pad image, and storing the segmentation parameters;
s4, collecting a real-time detection image of the PCBA, roughly positioning the real-time detection image, and extracting a real-time welding spot image based on the position of a welding spot detection area after the real-time detection image is roughly positioned;
s5, accurately positioning the real-time welding spot image based on a circular template matching method to obtain a welding spot main area and a soldering tin main area of the real-time welding spot image;
s6, reading the segmentation parameters stored in the S3, respectively extracting a real-time pad image and a real-time soldering tin image based on the positions of the pad main area and the soldering tin main area in the real-time soldering point image, respectively carrying out RGB and HSV color image threshold segmentation on the real-time pad image and the real-time soldering tin image, and obtaining the characteristic parameters of the real-time soldering point image according to the segmentation result;
and S7, setting characteristic parameters of the template welding spot image, comparing the obtained characteristic parameters of the real-time welding spot image with the image characteristic parameters of the template welding spot, and classifying the welding spot.
In the technical scheme, the steps S1 to S3 can be used as a stage for constructing the welding spot model, and the steps S4 to S7 can be used as a stage for searching for welding spot defects.
Preferably, the preprocessing of step S2 includes:
carrying out gray level conversion on the template image, and scaling the gray level value of the template image by a linear transformation method to make the contrast of a character area in the template image prominent so as to obtain character outline characteristics; selecting welding spot detection area Reg in template image based on circular tool check Manually adjust Reg check Radius of the circular pad detection area Reg model_out And annular solder detection area Reg model_in Extracting a template soldering tin image Img model_in And a stencil pad image Img model_out
And generating a template file based on the character outline characteristics, and generating three detection area files based on the welding spot detection area, the soldering tin detection area and the welding pad detection area.
The template image is originally a color image, is converted into a gray image after gray conversion, and then is increased in contrast by a linear transformation method, so that the contrast of a character area is highlighted, the outline of the character area is conveniently obtained, and a template file is generated.
Preferably, in step S3, the process of threshold segmentation of the stencil solder image based on the R, G, B three color components of the RGB color model is as follows:
will Img model_in Dividing the image into RGB three color characteristics, taking the RGB three color characteristics as the index of color segmentation, and manually selecting a first segmentation parameter pair Img which accords with the color of a normal welding spot modelin Performing threshold segmentation on the RGB color image and taking intersection of connected domains after threshold segmentation to obtain a dark color component;
selecting a first segmentation parameter pair Img model_in Table for performing threshold segmentation of RGB color imageThe expression is as follows:
Figure BDA0003228015890000031
wherein, (i, j) represents pixel, R (i, j), G (i, j), B (i, j) respectively represent red, green, blue components of pixel, img RGB (i, j) represents the result after the threshold segmentation processing, R h 、G h And B h Maximum threshold segmentation parameters respectively representing red, green and blue components of RGB; r is l 、G l And B l Respectively representing the minimum threshold segmentation parameters of red, green and blue components of RGB;
when in segmentation, a maximum threshold segmentation parameter R of RGB red, green and blue components is introduced simultaneously h 、G h And B h Minimum threshold segmentation parameter R l 、G l And B l Setting maximum threshold segmentation parameter R of red, green and blue components of RGB h 、G h And B h And a minimum threshold segmentation parameter R l 、G l And B l Realizing the template soldering image Img model_in Obtaining a dark color component based on threshold segmentation of an RGB color model;
the process of simultaneously performing threshold segmentation on the template soldering tin image and the template pad image by using H, S, V three color components of the HSV color model is as follows:
will Img model_in And Img model_out Converting the RGB color model into HSV color model, selecting a second segmentation parameter pair Img by using H, S, V as the index of color segmentation model_in And Img model_out Performing threshold segmentation on the HSV color image and taking intersection of connected domains after threshold segmentation to obtain a blue component and an orange component;
selecting a second segmentation parameter pair Img model_in And Img model_out The expression for performing the threshold segmentation of the HSV color image is as follows:
Figure BDA0003228015890000041
wherein, (i, j) represents a pixel point, R (i, j), G (i, j), B (i, j) are red, green and blue components of the pixel point (i, j), img HSV (i, j) is the result of the threshold segmentation process, H h 、S h And V h Maximum threshold segmentation parameters respectively representing hue, saturation and brightness of HSV; h l 、S l And V l Minimum threshold segmentation parameters respectively representing hue, saturation and brightness of HSV;
when in segmentation, maximum threshold segmentation parameters H of hue, saturation and brightness of HSV are introduced simultaneously h 、S h And V h And minimum threshold segmentation parameter H l 、S l And V l Setting the maximum threshold segmentation parameters H of hue, saturation and brightness of HSV h 、S h And V h Minimum threshold segmentation parameter H l 、S l And V l And realizing threshold segmentation of the template pad image and the template soldering tin image based on the HSV color model, and acquiring a blue component and an orange component.
The method is different from the conventional single or two-color component segmentation limit, when the first segmentation parameter is subjected to threshold segmentation, the three color components R, G, B based on an RGB color model are simultaneously segmented, and then the obtained dark color components are combined; when the second segmentation parameter is subjected to threshold segmentation, three color components of hue, saturation and lightness based on the HSV color model are simultaneously segmented to obtain a blue component and an orange component, and the blue component and the orange component are obtained as basic preparation for detecting welding spot defects (blue and orange sensitivity), so that the effective extraction of characteristic parameters of a defect area and the improvement of subsequent detection precision are facilitated.
Preferably, for the coarse positioning of the real-time detection image, based on the position of the welding spot detection area after the coarse positioning of the real-time detection image, the process of extracting the real-time welding spot image is as follows:
reading a template file, acquiring a rotation center and a rotation angle of a real-time detection image character based on a shape matching principle, generating an affine matrix, and thenPerforming affine transformation, detecting the position of the image in real time, rotating the image to the same position as the template image, and reading the welding spot detection area Reg check Based on Reg check Cutting the real-time detection image at the positioned position of the real-time detection image, and extracting a real-time welding spot image Img cur
Preferably, in step S5, the real-time solder joint image is accurately positioned based on a circular template matching method, and before obtaining the pad main area and the solder main area of the real-time solder joint image, the method further includes: performing circle fitting on the real-time welding spot image to obtain circle sets C1 and C2;
the specific process is as follows:
s501, pair Img cur Filtering to obtain filtered image Img filter Calculating Img filter Gradient and gradient direction of each pixel of (1), synthesizing a gradient image Img gradient (ii) a For Img filter Performing edge processing to obtain an edge image Img edge
S502, calculating Img gradient The central coordinate of (1) is used as an origin, and n rays and Img with different directions are established in an angle bisection mode gradient Taking the intersection to form n intersection point sets, respectively solving the extreme points of the n intersection point sets to form n extreme point sets, classifying the extreme points of the n extreme point sets to obtain n beta + Extreme point set of directions E1 n+ And n beta - Direction extreme point set E1 n- (ii) a The classification rules are: calculating the horizontal included angle theta between the nth ray and the image n At θ n Is within +/-90 DEG as the positive gradient direction beta of the nth extreme point set + The other angles are taken as the negative direction beta of the gradient of the nth extreme point set -
S503, mixing E1 n+ And E1 n- And n rays are mapped to Img edge At Img edge To obtain Img gradient In E1 n+ 、E1 n- Extreme point set E1 'of positions corresponding to n rays' n+ 、E1′ n- And n' rays, forming an edge map Img edge Dividing the arc into multiple segments, and determining if there are multiple poles on the segmentThe value points belong to adjacent m rays and the part of the extreme points belong to E1' n+ Or E1' n- Wherein m is less than or equal to n', and the central angle theta of the circular arc c If the angle is more than 45 degrees, the arc of the section is reserved, otherwise, the arc of the section is abandoned; the remaining circular arc forms beta + Sets of arcs of direction L1 and beta - A directional arc set L2;
s504, arcs in the sets L1 and L2 are sequentially taken, circle fitting is carried out on each arc by using a RANSAC random sampling consistency method, a plurality of groups of circles with different radiuses and circle center coordinates are obtained, the gradient directions of the arcs are mapped to the gradient directions of corresponding circles, and beta is formed + Sets of circles C1 and β of directions - A set of circles of direction C2.
After the real-time welding spot image of the coarse positioning is obtained, if the welding spot is normal, a circle of white thin circular ring-shaped welding disc is arranged on the periphery, and a white thick circular ring-shaped welding disc is arranged on the outermost side of the welding spot, edges of the places can be obtained according to the color of the welding spot and the gradient change of the color of the white ring, a plurality of circles can be obtained by performing circle fitting on each edge, the edge is obtained according to the gradient change of the real-time welding spot image, and circle sets C1 and C2 are fitted out according to the edges meeting the conditions, so that a plurality of circles meeting the conditions are provided, and a foundation is laid for matching of circular templates.
Preferably, in step S5, the real-time solder joint image is accurately positioned based on the circular template matching method, and the process of obtaining the pad main area and the solder main area of the real-time solder joint image is as follows:
s51, calculating the center coordinates and the radius of each circle in the circle set C1 and the circle set C2;
s52, preprocessing each circle in the circle set C1 and the circle set C2 to further obtain beta + Sets of circles C11 and β of directions - A set of directional circles C21;
s53, calculating the radius r of each circle in the circle set C11 and the circle set C21 t1 And r t2 Taking a circle Q of the circle set C11 according to the rule of descending radius t1 And a circle Q of the circle set C21 t2 Matching is carried out, firstly, the distance D1 between the two circle centers is calculated by adopting the following formula:
Figure BDA0003228015890000061
wherein (x) t1 ,x t2 ) And (y) t1 ,y t2 ) Are respectively Q t1 And Q t2 D1 represents the euclidean distance of the two circle center coordinates, r t1 And r t2 Represents the radius of two circles; if D1 is less than r t1 And r t2 One third of the absolute value of the difference, the matching is successful, the matching is stopped, and the Q of the successful matching is recorded t1 And Q t2 Q1 and Q2, respectively; otherwise, continuing to match until all circles are matched;
s54, selecting all beta in the range of Q2 + The circles in the direction form a circle set C3, and the circles Q of the circle set C3 are sequentially taken according to the rule of descending radius t3 Matching with the circle Q2, firstly, calculating the distance D2 between the two circle center coordinates by adopting the following formula:
Figure BDA0003228015890000062
wherein (x) t2 ,y t2 ) And (x) t3 ,y t3 ) Are circles Q2 and Q, respectively t3 D2 represents the Euclidean distance of two circle center coordinates, r t2 And r t3 Are Q2 and Q, respectively t3 If D2 is less than r t2 And r t3 One third of the absolute value of the difference, if the matching is successful, stopping the matching, and recording the Q of the successful matching t3 Is Q3; otherwise, continuing to match until all circles are matched;
s55, if Q1, Q2 and Q3 are all matched, the matching is successful and reserved, Q1, Q2 and Q3 are an outer circle, a middle circle and an inner circle in sequence, and a difference set is obtained between Q1 and Q2 to obtain an annular region Reg cur_out As Img cur The difference between Q3 and a circle Q4 of half the radius of Q3 is used to obtain an annular region Reg cur_in As Img cur Step S6 is executed in the solder main area of (1); if all the circle sets C1 and C2 have no match after traversalIf a proper circle is matched, matching fails, and Reg is adopted model_out As Img cur Main area Reg of bonding pad cur_out ,Reg model_in As Img cur Solder main region Reg of cur_in Step S6 is executed.
The positioning of soldering tin and a welding disc in the wave crest welding spot is optimized through the matching process of the circular templates, so that the positioning accuracy is improved, and more accurate defect areas can be conveniently extracted subsequently.
Preferably, in step S52, the process of preprocessing each circle in the set C1 and the set C2 is as follows:
let Reg check Has a maximum circumscribed circle radius of R max Calculating the radius of each circle in the circle sets C1 and C2, taking two circles in the circle sets C1 or C2 according to the rule of radius descending order, and firstly calculating the distance D between the two circle centers by adopting the following formula:
Figure BDA0003228015890000071
wherein (x) 1 ,y 1 ) And (x) 2 ,y 2 ) Is the coordinates of the centers of the two circles, D is the Euclidean distance of the coordinates of the centers of the two circles, if the Euclidean distance D is less than R max One tenth of the above, the two circles are judged to be the same circle. Calculating the radius r of the two circles 11 And r 12 Comparison of r 11 And r 12 Size, only the circle with the largest radius is reserved. After each circle is pretreated, the remaining circles form beta + Sets of circles C11 and β of directions - A set of circles of direction C21.
Preferably, in step S6, based on Reg cur_out And Reg cur_in At Img cur Position of (2) to Img cur Respectively extracting real-time pad images Img cur_out And real-time solder image Img cur_in . The stored segmentation parameters comprise a first segmentation parameter and a second segmentation parameter, and the first segmentation parameter and the second segmentation parameter are respectively used for Img cur_in Performing RGB and HSV color image threshold segmentation, and extracting dark color component regionReg Deep Blue component region Reg Blue_in And orange component region Reg orange To get Reg Deep And Reg Blue Intersection is made to obtain new solder region Reg solder Major area Reg of solder in And Reg solder Make the complement to obtain the characteristic region Reg feature ,Reg feature And Reg Orange Intersection forming characteristic region Reg feature2 Calculating Reg feature2 Area characteristic A of 1 As characteristic parameters of the real-time soldering tin image;
for Img cur_out Performing HSV color image threshold segmentation, and extracting blue component region Reg Blue_out For Reg Blue_out Performing polar coordinate transformation to obtain region Reg polar Calculating Reg polar Area characteristic A of 2 And height characteristic H 1 As a characteristic parameter of the real-time pad image.
The characteristic parameters of the real-time soldering tin image and the characteristic parameters of the real-time welding pad image jointly form the characteristic parameters of the real-time welding spot image.
Preferably, the solder joint types include normal, low tin, tin clad, and bridging; wherein, the unqualified types comprise: tin is less, tin is wrapped and bridging is carried out;
the characteristic parameters of the template welding spot image comprise: minimum threshold MIN for tin-poor area, maximum threshold MAX for tin-coated area, and minimum threshold VALUE for bridging area, reg in S5 out Radius r of the inner and outer circles of 1 And r 2 (ii) a Comparing the characteristic parameters of the real-time welding spot image obtained in the step S6 with the characteristic parameters of the template welding spot image, and classifying the welding spots S, wherein the classification standard is as follows:
Figure BDA0003228015890000081
wherein a1 represents that the welding spot is normal, a2 represents that the welding spot is low in tin, a3 represents that the welding spot is wrapped with tin, a4 represents that the welding spot is bridged, MIN represents a minimum threshold VALUE of a low-tin area, MAX represents a maximum threshold VALUE of a wrapped-tin area, VALUE represents a minimum threshold VALUE of a bridging area, and r represents 1 Is a main area Reg of a circular bonding pad out Inner circle radius of (d) 2 Is a circular ring-shaped bonding pad main region Reg out The outer radius of the circle.
Because the colors of the tin-poor solder and the tin-coated solder are different from the normal colors, the position of the solder-connected pad is blue, and the maximum radius of the blue is the same as the radius of the pad detection area.
The application also provides a wave soldering point detection system, which is used for realizing the wave soldering point detection method and comprises the following steps:
the image acquisition module is used for acquiring a template image of the PCBA board;
the preprocessing module is used for preprocessing the template image, acquiring the character outline characteristics and the template welding spot image of the welding spot detection area, the template soldering tin image of the soldering tin detection area and the template pad image of the pad detection area, and storing the welding spot detection area, the soldering tin detection area and the pad detection area;
the first threshold segmentation module is used for manually selecting segmentation parameters according with the colors of normal welding spots based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model respectively, performing RGB and HSV color image threshold segmentation on the template soldering tin image and the template pad image, and storing the segmentation parameters;
the acquisition coarse positioning module is used for acquiring a real-time detection image of the PCBA, coarsely positioning the real-time detection image, and extracting a real-time welding spot image based on the position of a welding spot detection area after the coarse positioning of the real-time detection image;
the accurate positioning module is used for accurately positioning the real-time welding spot image based on a circular template matching method to obtain a welding spot main area and a soldering tin main area of the real-time welding spot image;
the second threshold segmentation module is used for reading the stored segmentation parameters, respectively extracting a real-time pad image and a real-time soldering tin image based on the positions of the pad main area and the soldering tin main area in the real-time soldering point image, respectively performing RGB (red, green, blue) and HSV (hue, saturation and value) color image threshold segmentation on the real-time pad image and the real-time soldering tin image, and obtaining the characteristic parameters of the real-time soldering point image according to the segmentation result;
and the comparison and classification module is used for setting the characteristic parameters of the template welding spot image, comparing the obtained characteristic parameters of the real-time welding spot image with the image characteristic parameters of the template welding spot, and classifying the welding spot.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the invention provides a method and a system for detecting defects of wave crest welding spots, wherein the method comprises the steps of firstly carrying out the processes of PCBA template image acquisition, preprocessing and color image threshold segmentation, and is different from the traditional single color component threshold segmentation limit, wherein the processes are respectively based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model, and simultaneously carrying out color image threshold segmentation, so that the threshold segmentation process is optimized, the segmentation result is more suitable for the requirements of welding spot detection, the effective extraction of welding spot defect areas is facilitated, a circular template matching optimization method is introduced, the positioning of soldering tin and a welding pad in the wave crest welding spots is optimized, more accurate defect areas are provided for the subsequent second threshold segmentation, finally, the obtained welding spot image characteristic parameters are compared with the template image characteristic parameters, a defect sample is detected, the accuracy of welding spot defect detection is improved, the yield of PCBA plates produced in factories can be improved, and the use effect of scientific and technological products is finally improved.
Drawings
Fig. 1 is a schematic flow chart illustrating a method for detecting a solder bump defect according to embodiment 1 of the present invention;
FIG. 2 is a diagram showing the positioning effect of the matching of the wave solder point circular template obtained by applying the method proposed in embodiment 1 of the present invention;
FIG. 3 is a schematic view showing a normal solder joint proposed in embodiment 1 of the present invention;
FIG. 4 is a schematic view showing solder joint tin coating proposed in embodiment 1 of the present invention;
FIG. 5 is a schematic view showing solder joint tin reduction proposed in embodiment 1 of the present invention;
FIG. 6 is a schematic view showing a solder joint bridge proposed in embodiment 1 of the present invention;
FIG. 7 is a diagram showing another practical example of solder joint with less tin according to embodiment 1 of the present invention;
FIG. 8 is a diagram showing the detection result of the solder joint defect in the case of performing color threshold segmentation by using only G color component in the conventional RGB color model in embodiment 1 of the present invention;
FIG. 9 is a diagram showing the detection result of the solder joint defect in the embodiment 1 of the present invention, which is obtained by performing color threshold segmentation using the combination of the R color component and the B color component in the conventional RGB color model;
fig. 10 is a diagram illustrating a detection result of a solder joint defect in embodiment 1 of the present invention when color threshold segmentation is performed by using R, G, B color components of an RGB color model and H, S, V color components of an HSV color model;
fig. 11 is a structural diagram of a system for detecting a solder bump defect according to embodiment 2 of the present invention.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent;
for better illustration of the present embodiment, certain parts of the drawings may be omitted, enlarged or reduced, and do not represent actual dimensions;
it will be understood by those skilled in the art that certain well-known descriptions of the figures may be omitted.
The positional relationships depicted in the drawings are for illustrative purposes only and should not be construed as limiting the present patent;
the technical solution of the present invention is further described below with reference to the accompanying drawings and examples.
Example 1
Referring to fig. 1, the present application provides a method for detecting a solder bump, which includes the following steps:
s1, collecting a template image of the PCBA;
s2, preprocessing a template image, acquiring character outline characteristics, a template welding spot image of a welding spot detection area, a template soldering tin image of a soldering tin detection area and a template pad image of a pad detection area, and storing the welding spot detection area, the soldering tin detection area and the pad detection area;
s3, manually selecting segmentation parameters according with the colors of normal welding spots based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model, performing RGB and HSV color image threshold segmentation on the template soldering tin image and the template pad image, and storing the segmentation parameters;
s4, collecting a real-time detection image of the PCBA, roughly positioning the real-time detection image, and extracting a real-time welding spot image based on the position of a welding spot detection area after the real-time detection image is roughly positioned;
s5, accurately positioning the real-time welding spot image based on a circular template matching method to obtain a welding spot main area and a soldering tin main area of the real-time welding spot image;
s6, reading the segmentation parameters stored in the S3, respectively extracting a real-time pad image and a real-time soldering tin image based on the positions of the pad main area and the soldering tin main area in the real-time soldering point image, respectively carrying out RGB and HSV color image threshold segmentation on the real-time pad image and the real-time soldering tin image, and obtaining characteristic parameters of the real-time soldering point image according to a segmentation result;
and S7, setting characteristic parameters of the template welding spot image, comparing the obtained characteristic parameters of the real-time welding spot image with the image characteristic parameters of the template welding spot, and classifying the welding spot.
In combination with the above steps, steps S1 to S3 of the wave solder joint detection method provided in this embodiment can be used as a phase of constructing a solder joint model, the phase of constructing the solder joint model includes processes of PCBA template image acquisition, preprocessing and color image threshold segmentation, and steps S4 to S7 can be used as a phase of searching for solder joint defects, the phase of searching for solder joint defects includes acquiring a real-time detection image of the PCBA board, coarsely positioning the real-time detection image, accurately positioning a real-time detection image of a main area of solder and a main area of a pad based on a principle of circular template matching, reading stored segmentation parameters, performing color image threshold segmentation on the real-time detection images of the main areas of the solder and the pad respectively, acquiring characteristic parameters of the real-time solder joint image, comparing whether the solder joint is qualified or not according to set characteristic parameter rules of the template solder joint image, and classifying the solder joints.
In this embodiment, a template image of the PCBA board is collected using a camera and an annular red, green, and blue LED structure light source, and the preprocessing of the template image in step S2 includes:
carrying out gray level conversion on the template image, and scaling the gray level value of the template image by a linear transformation method to ensure that the contrast of a character area in the template image is prominent; selecting welding spot detection area Reg in template image based on circular tool check Manually adjusting Reg check Radius of the annular bonding pad model_out And annular solder detection area Reg model_in Extracting a template solder image Img model_in And a stencil pad image Img model_out The manual adjustment refers to manual operation based on software, and the sliding bar control refers to sliding bar setting of a software interface; and generating a template file based on the character outline characteristics, and respectively generating three detection area files in a welding spot detection area, a soldering tin detection area and a welding pad detection area.
The template image is originally a color image, is converted into a gray image after gray conversion, and then the contrast is increased through a linear transformation method, so that the contrast of a character area is highlighted, the outline of the character area is conveniently obtained, and a template file is generated.
The expression formula of the specific linear transformation is as follows:
Figure BDA0003228015890000111
GMax is the maximum gray value of the image, GMin is the minimum gray value of the image, mult is a scaling factor, and Add is scaling compensation; extracting outline information of partial characters in the template image as a template file and storing the template file in a PCBA characteristic library, and acquiring a template welding spot image of a welding spot detection area, a template soldering tin image of a soldering tin detection area and a template pad image of a pad detection area in a manual selection mode.
In step S3, based on R, G, B three color components of the RGB color model and H, S, V three color components of the HSV color model, the segmentation parameters conforming to the color of the normal solder joint are manually selected, and the process of performing RGB and HSV color image threshold segmentation on the template solder image and the template pad image at the same time is as follows:
will Img model_in Dividing the image into RGB three color characteristics, taking the RGB three color characteristics as the index of color segmentation, and manually selecting a first segmentation parameter pair Img which accords with the color of a normal welding spot model_in Performing threshold segmentation on the RGB color image and taking intersection of connected domains after threshold segmentation to obtain a dark color component;
selecting a first segmentation parameter pair Img model_in The expression for performing threshold segmentation of an RGB color image is:
Figure BDA0003228015890000121
wherein, (i, j) represents pixel, R (i, j), G (i, j), B (i, j) respectively represent red, green, blue components of pixel, img RGB (i, j) represents the result after the threshold segmentation process, R h 、G h And B h Maximum threshold segmentation parameters respectively representing red, green and blue components of RGB; r l 、G l And B l Respectively representing the minimum threshold segmentation parameters of red, green and blue components of RGB;
when in segmentation, a maximum threshold segmentation parameter R of RGB red, green and blue components is introduced simultaneously h 、G h And B h Minimum threshold segmentation parameter R l 、G l And B l Setting maximum threshold segmentation parameter R of red, green and blue components of RGB h 、G h And B h And a minimum threshold segmentation parameter R l 、G l And B l Realizing the template soldering image Img model_in Obtaining a dark color component based on threshold segmentation of an RGB color model;
the process of simultaneously performing threshold segmentation on the template soldering tin image and the template pad image by using H, S, V three color components of the HSV color model is as follows:
will Img model_in And Img model_out Conversion from RGB color model to HSV color modelSelecting a second segmentation parameter pair Img by using H, S, V as an index of color segmentation model_in And Img model_out Performing HSV color image threshold segmentation and taking intersection of connected domains after threshold segmentation to obtain a blue component and an orange component;
selecting a second segmentation parameter pair Img model_in And Img model_out The expression for performing the threshold segmentation of the HSV color image is as follows:
Figure BDA0003228015890000122
wherein, (i, j) represents a pixel point, R (i, j), G (i, j), B (i, j) are red, green and blue components of the pixel point (i, j), img HSV (i, j) is the result after the threshold segmentation process, H h 、S h And V h Maximum threshold segmentation parameters respectively representing hue, saturation and brightness of HSV; h l 、S l And V l Minimum threshold segmentation parameters respectively representing hue, saturation and brightness of HSV;
when in segmentation, maximum threshold segmentation parameters H of hue, saturation and brightness of HSV are introduced simultaneously h 、S h And V h And minimum threshold segmentation parameter H l 、S l And V l Setting maximum threshold segmentation parameters H of hue, saturation and brightness of HSV h 、S h And V h Minimum threshold segmentation parameter H l 、S l And V l And realizing threshold segmentation of the template pad image and the template soldering tin image based on an HSV color model, and acquiring a blue component and an orange component.
In summary, the deep color component, the blue color component and the orange color component are basic color preparations for welding spot detection, are single and are different from the traditional single or two color component segmentation limit, and when the first segmentation parameter is subjected to threshold segmentation, the three color components R, G, B based on an RGB color model are simultaneously segmented, and then the obtained deep color components are combined; when the second segmentation parameter is subjected to threshold segmentation, three color components of hue, saturation and lightness based on the HSV color model are simultaneously segmented to obtain a blue component and an orange component, and the blue component and the orange component are obtained as basic preparation for detecting welding spot defects (blue and orange sensitivity), so that the effective extraction of characteristic parameters of a defect area and the improvement of subsequent detection precision are facilitated. In this embodiment, according to the mapping effect of the ring red, green and blue LED structure light source, the HSV values of the extracted blue component are 145, 155, 69, 255, 116, 255, and the HSV values of the extracted orange component are 0, 61, 118, 255, 132, 255.
In this embodiment, the tools used for acquiring the real-time detection image of the PCBA board in step S4 are the same as the tools in step S1, and are both a camera and an annular red, green and blue LED structure light source, and the real-time detection image of the PCBA board is acquired, and the real-time detection image is coarsely positioned, and based on the position of the solder joint detection area after the real-time detection image is coarsely positioned, the process of extracting the real-time solder joint image is as follows:
reading a template file, acquiring a rotation center and a rotation angle of characters of a real-time detection image based on a shape matching principle, generating an affine matrix, then carrying out affine transformation, rotating the real-time detection image to the same position as the template image, and extracting a welding spot detection real-time image Img of the positioned real-time detection image cur The specific method comprises the following steps: based on Reg check Cutting the real-time welding spot image Img at the position positioned by the real-time detection image cur
Wherein, the expression of the affine matrix is:
Figure BDA0003228015890000131
Figure BDA0003228015890000132
Figure BDA0003228015890000133
whereinHomMat2 Dedentity is the identity matrix, homMat2 DRote is the rotation matrix, phi is the rotation angle, homMat2DTranslate is the translation matrix, T is the rotation angle x Is the horizontal translation distance, T y Is the vertical translation distance. Affine transformation is carried out on the real-time detection image, namely the real-time detection image is rotated to the same position as the template image, and a welding spot detection area Reg is read check This is a region file, then based on Reg check Cutting the real-time welding spot image Img at the position positioned by the real-time detection image cur
In this embodiment, in step S5, the real-time solder joint image is accurately positioned based on a circular template matching method, and the method further includes, before obtaining the pad main area and the solder main area of the real-time solder joint image: performing circle fitting on the real-time welding spot image to obtain circle sets C1 and C2;
the specific process is as follows:
s501, pair Img cur Filtering to obtain filtered image Img filter Calculating Img filter Gradient and gradient direction of each pixel of (1), synthesizing a gradient image Img gradient (ii) a For Img filter Performing edge processing to obtain an edge image Img edge
S502, calculating Img gradient The central coordinate of the X-ray source is used as an original point, and n rays and Img with different directions are established in an angle bisection mode gradient And taking the intersection to form n intersection point sets, respectively solving extreme points from the n intersection point sets to form n extreme point sets, and classifying the extreme points of the n extreme point sets. The classification rule is as follows: calculating the horizontal included angle theta between the nth ray and the image n At θ n Is within +/-90 DEG as the positive gradient direction beta of the nth extreme point set + The other angles are taken as the negative direction beta of the gradient of the nth extreme point set - Obtaining n beta + Extreme point set of directions E1 n+ And n beta - Direction extreme point set E1 n- (ii) a In this example, img is used gradient The central coordinate of the ray source is used as an origin, and the better effect can be achieved by establishing 16 rays with different directions in an angle bisection mode, wherein each ray and the Img gradient All have intersection points, and 16 groups of intersection points form 16 groups of point sets U n Where n is not more than 16, for U respectively n Obtaining extreme points to form n extreme point sets Z n And to Z n And (3) classifying, wherein the specific method of classification is as follows: after the gradient and gradient direction of each pixel have been previously determined, the nth ray and Img are calculated gradient Included angle theta n At θ n Is within +/-90 DEG as the positive gradient direction beta of the nth extreme point set + The other angles are taken as the negative gradient direction beta of the nth extreme point set - . Obtaining n beta as a result of the classification + Set of extreme points Z of direction n+ And n beta - Set of extreme points Z of direction n-
Z n+ And Z n- The gradient values respectively form a one-dimensional array A n+ And A n- For the one-dimensional array A n+ And A n- Conversion to a one-dimensional function F n+ And F n- Search out F n+ And F n- All extreme points of (2) form a new extreme point set E n+ And E n- . Pair of gradient values E represented by extreme points n+ And E n- Sorting in descending order to obtain E n+ The first six extreme point sets E1 n+ And E n- The first three extreme points E1 n- If the number of extreme points is not enough, all the extreme points are taken, and each ray beta is obtained according to the method + Extreme point set E1 in gradient direction n+ ,β - Extreme point set E1 in gradient direction n-
S503, mixing E1 n+ And E1 n- And n rays are mapped to Img edge At Img edge In order to obtain Img gradient In E1 n+ 、E1 n- Extreme point set E1 'of positions corresponding to n rays' n+ 、E1′ n- And n' rays, forming an edge map Img edge Dividing the arc into a plurality of segments, and judging if a plurality of extreme points exist on the segment of arc and belong to m adjacent rays, and the extreme points belong to E1' n+ Or E1' n- Wherein m is less than or equal to n', and the central angle theta of the circular arc c Greater than 45 deg., then remainAnd if not, discarding the arc. The remaining circular arc forms beta + Sets of arcs of direction L1 and beta - A set L2 of arcs of direction;
s504, sequentially taking the arcs in the sets L1 and L2, performing circle fitting on each arc by using a RANSAC random sampling consensus method to obtain a plurality of groups of circles with different radiuses and center coordinates, and mapping the gradient directions of the arcs to the gradient directions of the corresponding circles to form beta + Sets of circles C1 and β of directions - A set of circles of direction C2.
After the real-time welding spot image of the coarse positioning is obtained, if the welding spot is normal, a circle of white thin circular ring-shaped welding disc is arranged on the periphery, and a white thick circular ring-shaped welding disc is arranged on the outermost side of the welding spot, edges of the places can be obtained according to the color of the welding spot and the gradient change of the color of the white ring, a plurality of circles can be obtained by performing circle fitting on each edge, the edge is obtained according to the gradient change of the real-time welding spot image, and circle sets C1 and C2 are fitted out according to the edges meeting the conditions, so that a plurality of circles meeting the conditions are provided, and a foundation is laid for matching of circular templates.
After fitting the circle sets C1 and C2, the step S5 of accurately positioning the real-time welding spot image based on the circle template matching method, wherein the process of obtaining the pad main area and the soldering tin main area of the real-time welding spot image comprises the following steps:
s51, calculating the center coordinates and the radius of each circle in the circle set C1 and the circle set C2;
s52, preprocessing each circle in the circle set C1 and the circle set C2 to further obtain beta + Sets of circles C11 and β of directions - A set of directional circles C21;
s53, calculating the radius r of each circle in the circle set C11 and the circle set C21 t1 And r t2 Taking a circle Q of the circle set C11 according to the rule of descending radius t1 And a circle Q of the circle set C21 t2 Matching is carried out, firstly, the distance D1 between the two circle centers is calculated by adopting the following formula:
Figure BDA0003228015890000151
wherein (x) t1 ,x t2 ) And (y) t1 ,y t2 ) Are respectively Q t1 And Q t2 D1 represents the euclidean distance of the two circle center coordinates, r t1 And r t2 Represents the radius of two circles; if D1 is less than r t1 And r t2 One third of the absolute value of the difference, the matching is successful, the matching is stopped, and the Q of the successful matching is recorded t1 And Q t2 Q1 and Q2, respectively; otherwise, continuing to match until all circles are matched;
s54, selecting all beta in the range of Q2 + The circles in the direction form a circle set C3, and the circles Q of the circle set C3 are sequentially taken according to the rule of descending radius t3 Matching with the circle Q2, firstly, calculating the distance D2 between the two circle center coordinates by adopting the following formula:
Figure BDA0003228015890000152
wherein (x) t2 ,y t2 ) And (x) t3 ,y t3 ) Are circles Q2 and Q, respectively t3 D2 represents the Euclidean distance of two circle center coordinates, r t2 And r t3 Are Q2 and Q, respectively t3 If D2 is less than r t2 And r t3 If the absolute value of the difference is one third, the matching is successful, the matching is stopped, and the Q of the successful matching is recorded t3 Is Q3; otherwise, continuing to match until all circles are matched;
s55, if Q1, Q2 and Q3 are all matched, the matching is successful and reserved, Q1, Q2 and Q3 are an outer circle, a middle circle and an inner circle in sequence, and a difference set is obtained between Q1 and Q2 to obtain an annular region Reg cur_out As Img cur Q3 and a circle Q4 with a half of the radius of Q3 to obtain an annular region Reg cur_in As Img cur Step S6 is executed in the solder main area of (1); if no proper circle is matched after all the circle sets C1 and C2 are traversed, the matching is failed, and Reg is adopted model_out As Img cur Main region Reg of bonding pad cur_out ,Reg model_in As Img cur Solder main region Reg of cur_in Step S6 is executed.
The positioning of soldering tin and pad in the wave soldering spot is optimized through the process of matching the circular templates, the positioning accuracy is improved, more accurate defect regions can be conveniently extracted subsequently, the positioning effect diagram of matching the wave soldering spot circular templates obtained by applying the circular template matching method is shown in fig. 2, three matched circles are an outer circle Q1, a middle circle Q2 and an inner circle Q3 from outside to inside in sequence, the difference set is obtained by taking the Q1 and the Q2 to obtain a circular ring-shaped region as a main region of the pad, and the difference set is obtained by taking the Q3 and a circle Q4 with the half of the radius of the Q3 to obtain the circular ring-shaped region as a main region of the soldering tin.
In the present embodiment, in step S6, based on Reg cur_out And Reg cur_in At Img cur For Img, for cur Respectively extracting real-time pad images Img cur_out And real-time solder image Img cur_in . The stored segmentation parameters comprise a first segmentation parameter and a second segmentation parameter, and the Img is respectively paired by using the first segmentation parameter and the second segmentation parameter cur_in Performing threshold segmentation on RGB and HSV color images, and extracting a dark color component region Reg Deep Blue component region Reg Blue_in And orange component region Reg Orange To get Reg Deep And Reg Blue Intersection is made to obtain new solder region Reg solder Soldering the main area Reg in And Reg soldec Making a complementary set to obtain a characteristic region Reg feature ,Reg feature And Reg orange Intersection forming characteristic region Reg feature2 Calculating Reg feature2 Area characteristic A of 1 As characteristic parameters of the real-time soldering tin image;
here, "calculating" means for Reg feature2 The area of the irregular area can be calculated by the existing mature technology.
For Img cur_out Performing HSV color image threshold segmentation, and extracting blue component region Reg Blue_out For Reg Blue_out Performing polar coordinate transformation to obtain region Reg polar Calculating Reg polar Specific surface area ofSymbol A 2 And height characteristic H 1 As a characteristic parameter of the real-time pad image. Here, "calculating" means for Reg polar The area of the irregular region is calculated, and the height of the region is obtained by taking the bottom line of the region as a vertical line, which can be realized by the existing relatively mature technology.
The characteristic parameters of the real-time soldering tin image and the characteristic parameters of the real-time welding pad image jointly form the characteristic parameters of the real-time welding spot image.
The welding spot types comprise normal, less tin, tin coating and bridging; wherein, the unqualified types comprise: tin is less, tin is wrapped and bridging is carried out;
the characteristic parameters of the template welding spot image comprise: minimum threshold MIN for tin-poor area, maximum threshold MAX for tin-coated area, and minimum threshold VALUE for bridging area, reg in S5 out Radius r of the inner and outer circles of 1 And r 2 (ii) a Comparing the characteristic parameters of the real-time welding spot image obtained in the step S6 with the characteristic parameters of the template welding spot image, and classifying the welding spots S, wherein the classification standard is as follows:
Figure BDA0003228015890000171
wherein a1 represents that the welding spot is normal, a2 represents that the welding spot is low in tin, a3 represents that the welding spot is wrapped with tin, a4 represents that the welding spot is bridged, MIN represents a minimum threshold VALUE of a low-tin area, MAX represents a maximum threshold VALUE of a wrapped-tin area, VALUE represents a minimum threshold VALUE of a bridging area, and r represents 1 Is a circular ring-shaped bonding pad main region Reg out Inner circle radius of (d) 2 Is a circular ring-shaped bonding pad main region Reg out The outer radius of the circle.
More specifically, to further verify the effectiveness of color image threshold segmentation on an image of a solder joint detection area based on three color components R, G, B of an RGB color model and H, S, V of an HSV color model, respectively, compared to the existing segmentation based on a single or two color components, the following description will be further made by taking as an example a situation where a solder joint is tin-poor as shown in fig. 7, an actual schematic view of such a situation refers to fig. 7, a "bright white" in a white circle represents a tin-poor area and is also an area to be detected for a defect, fig. 8 shows a result diagram of a tin-poor defect under color threshold segmentation based on a single G color component of an RGB color model, a defect area matched under the threshold segmentation is a white mark line (black inside), fig. 9 shows a result diagram of a defect area under color threshold segmentation performed based on a R, B color component combination of an RGB color model, a defect area matched under a white mark line (black inside is a white mark line) under the threshold segmentation condition, fig. 10 shows that a defect area matched under the threshold segmentation condition is found by using 3245 of an HSV color model, and a defect area can be detected by a color combination of a white mark line, and the method of a defect detection method of a defect can be performed by using a white mark line (black color component) in a white mark line) when a single G color threshold value, and a defect area under a defect area matching defect area under a threshold value of a defect area matched condition, and a defect detection method of a defect area matched under a defect is found by the invention, sometimes, the color threshold value is poor, and therefore, the color threshold value is unstable, the variation of the welding point cannot be effectively identified by the segmentation parameters of the color threshold value segmentation of the single color component and the combined component of the color threshold value, the false alarm rate is high, and the method provided by the invention is more stable.
Example 2
Referring to fig. 7, the present application further provides a solder bump inspection system, where the system is used to implement the solder bump inspection method described in embodiment 1, and the solder bump inspection system includes:
the image acquisition module is used for acquiring a template image of the PCBA board;
the preprocessing module is used for preprocessing the template image, acquiring the character outline characteristics and the template welding spot image of the welding spot detection area, the template soldering tin image of the soldering tin detection area and the template pad image of the pad detection area, and storing the welding spot detection area, the soldering tin detection area and the pad detection area;
the first threshold segmentation module is used for manually selecting segmentation parameters according with the colors of normal welding spots based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model respectively, performing RGB and HSV color image threshold segmentation on the template soldering tin image and the template pad image, and storing the segmentation parameters;
the acquisition coarse positioning module is used for acquiring a real-time detection image of the PCBA, coarsely positioning the real-time detection image, and extracting a real-time welding spot image based on the position of a welding spot detection area after the coarse positioning of the real-time detection image;
the accurate positioning module is used for accurately positioning the real-time welding spot image based on a circular template matching method to obtain a welding spot main area and a soldering tin main area of the real-time welding spot image;
the second threshold segmentation module is used for reading the stored segmentation parameters, respectively extracting a real-time pad image and a real-time soldering tin image based on the positions of the pad main area and the soldering tin main area in the real-time soldering point image, respectively performing RGB (red, green, blue) and HSV (hue, saturation and value) color image threshold segmentation on the real-time pad image and the real-time soldering tin image, and obtaining the characteristic parameters of the real-time soldering point image according to the segmentation result;
and the comparison and classification module is used for setting the characteristic parameters of the template welding spot image, comparing the obtained characteristic parameters of the real-time welding spot image with the image characteristic parameters of the template welding spot, and classifying the welding spot.
In summary, by combining the above methods, firstly, the processes of PCBA template image acquisition, preprocessing and color image threshold segmentation are performed, and different from the traditional single color component threshold segmentation limit, the color image threshold segmentation is performed simultaneously based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model, so that the threshold segmentation process is optimized, and effective extraction of a defect area is facilitated, a circular template matching optimization method is introduced, the positioning of soldering tin and a soldering pad in a wave crest soldering point is optimized, a more accurate defect area is provided for the subsequent second threshold segmentation, finally, the obtained real-time image characteristic parameters of the soldering point are compared with the template image characteristic parameters, a defect sample is detected, the accuracy of soldering point defect detection is improved, the yield of the PCBA produced in a factory can be improved, and the use effect of scientific and technological products is finally improved.
It should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.

Claims (8)

1. A method for detecting wave crest welding spot defects is characterized by comprising the following steps:
s1, collecting a template image of the PCBA;
s2, preprocessing a template image, acquiring character outline characteristics, a template welding spot image of a welding spot detection area, a template soldering tin image of a soldering tin detection area and a template pad image of a pad detection area, and storing the welding spot detection area, the soldering tin detection area and the pad detection area;
the preprocessing of step S2 includes: carrying out gray level conversion on the template image, and scaling the gray level value of the template image by a linear transformation method to make the contrast of a character area in the template image prominent so as to obtain character outline characteristics; selecting welding spot detection area Reg in template image based on circular tool check Manually adjusting Reg check Radius of the circular pad detection area Reg model_out And an annular solder detection area Reg model_in Extracting a template soldering tin image Img model_in And stencil pad image Img model_out
Generating a template file based on the character outline characteristics, and generating three detection area files based on a welding spot detection area, a soldering tin detection area and a bonding pad detection area;
s3, manually selecting segmentation parameters according with the colors of normal welding spots based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model, performing RGB and HSV color image threshold segmentation on the template solder image and the template pad image, and storing the segmentation parameters;
in step S3, based on R, G, B three color components of the RGB color model and H, S, V three color components of the HSV color model, the segmentation parameters conforming to the color of the normal solder joint are manually selected, and the process of performing RGB and HSV color image threshold segmentation on the template solder image and the template pad image is as follows:
will Img model_in Dividing the image into RGB three color characteristics, taking the RGB three color characteristics as the index of color segmentation, and manually selecting a first segmentation parameter pair Img which accords with the color of a normal welding spot model_in Performing threshold segmentation on the RGB color image and taking intersection of connected domains after threshold segmentation to obtain a dark color component;
selecting a first segmentation parameter pair Img model_in The expression for performing threshold segmentation of an RGB color image is:
Figure FDA0003998692740000011
wherein, (i, j) represents pixel, R (i, j), G (i, j), B (i, j) respectively represent red, green, blue components of pixel, img RGB (i, j) represents the result after the threshold segmentation processing, R h 、G h And B h Maximum threshold segmentation parameters respectively representing red, green and blue components of RGB; r l 、G l And B l Respectively representing the minimum threshold segmentation parameters of red, green and blue components of RGB;
when in segmentation, a maximum threshold segmentation parameter R of RGB red, green and blue components is introduced simultaneously h 、G h And B h Minimum threshold segmentation parameter R l 、G l And B l Setting maximum threshold segmentation parameter R of red, green and blue components of RGB h 、G h And B h And a minimum threshold segmentation parameter R l 、G l And B l Realizing the template soldering image Img model_in Obtaining a dark color component based on threshold segmentation of an RGB color model;
the process of simultaneously performing threshold segmentation on the template soldering tin image and the template pad image by using H, S, V three color components of the HSV color model is as follows:
will Img model_in And Img model_out Converting the RGB color model into HSV color model, taking H, S, V as the index of color segmentation, selecting a second segmentation parameter pair Img model_in And Img model_out Performing threshold segmentation on the HSV color image and taking intersection of connected domains after threshold segmentation to obtain a blue component and an orange component;
selecting a second segmentation parameter pair Img model_in And Img model_out The expression for performing the threshold segmentation of the HSV color image is as follows:
Figure FDA0003998692740000021
wherein, (i, j) represents a pixel, R (i, j), G (i, j), B (i, j) are red, green and blue components of the pixel, img HSV (i, j) is the result of the threshold segmentation process, H h 、S h And V h Maximum threshold segmentation parameters respectively representing hue, saturation and brightness of HSV; h l 、S l And V l Minimum threshold segmentation parameters respectively representing hue, saturation and brightness of HSV;
when in segmentation, the maximum threshold segmentation parameter H of hue, saturation and brightness of HSV is introduced simultaneously h 、S h And V h And minimum threshold segmentation parameter H l 、S l And V l Setting the maximum threshold segmentation parameters H of hue, saturation and brightness of HSV h 、S h And V h Minimum threshold segmentation parameter H l 、S l And V l Threshold segmentation of the template pad image and the template soldering tin image based on the HSV color model is achieved, and a blue component and an orange component are obtained;
s4, collecting a real-time detection image of the PCBA, roughly positioning the real-time detection image, and extracting a real-time welding spot image based on the position of a welding spot detection area after the real-time detection image is roughly positioned;
s5, accurately positioning the real-time welding spot image based on a circular template matching method to obtain a welding spot main area and a soldering tin main area of the real-time welding spot image;
s6, reading the segmentation parameters stored in the S3, respectively extracting a real-time pad image and a real-time soldering tin image based on the positions of the pad main area and the soldering tin main area in the real-time soldering point image, respectively carrying out RGB and HSV color image threshold segmentation on the real-time pad image and the real-time soldering tin image, and obtaining the characteristic parameters of the real-time soldering point image according to the segmentation result;
and S7, setting characteristic parameters of the template welding spot image, comparing the obtained characteristic parameters of the real-time welding spot image with the image characteristic parameters of the template welding spot, and classifying the welding spot.
2. The method for detecting the solder bump defect of a wave crest of claim 1, wherein for the coarse positioning of the real-time detection image, based on the position of the solder bump detection area after the coarse positioning of the real-time detection image, the process of extracting the real-time solder bump image is as follows:
reading a template file, acquiring a rotation center and a rotation angle of a character outline in a real-time detection image based on a shape matching principle, generating an affine matrix, then carrying out affine transformation, and rotating the real-time detection image to the same position as the template image; reading a pad detection area Reg check Based on Reg check Cutting the real-time detection image at the position of the positioned real-time detection image, and extracting a real-time welding spot image Img cur
3. The method for detecting the defect of the wave soldering point according to claim 2, wherein before the step S5 of accurately positioning the real-time soldering point image based on the circular template matching method, obtaining the main area of the pad and the main area of the soldering tin of the real-time soldering point image, the method further comprises: performing circle fitting on the real-time welding spot image to obtain circle sets C1 and C2;
the specific process is as follows:
s501, pair Img cur Filtering to obtain filtered image Img filter Calculating Img filter Gradient and gradient direction of each pixel of (1), synthesizing a gradient image Img gradient (ii) a For Img filter Performing edge processing to obtain an edge image Img edge
S502, calculating Img gradient The central coordinate of (1) is used as an origin, and n rays and Img with different directions are established in an angle bisection mode gradient Taking intersection to form n intersection point sets, respectively solving extreme points from the n intersection point sets to form n extreme point sets, and classifying the extreme points of the n extreme point sets to obtain n beta + Extreme point set of directions E1 n+ And n beta - Direction extreme point set E1 n- (ii) a The classification rules are: calculating the horizontal included angle theta between the nth ray and the image n At θ n Is taken as the positive gradient direction beta of the nth extreme point set within the range of +90 DEG + The other angles are taken as the negative direction beta of the gradient of the nth extreme point set -
S503, mixing E1 n+ And E1 n- And n rays map to Img edge At Img edge To obtain Img gradient In E1 n+ 、E1 n- Extreme point set E1 'of positions corresponding to n rays' n+ 、E1′ n- And n' rays, forming an edge map Img edge Dividing the arc into a plurality of segments, judging if a plurality of extreme points exist on the segment of arc and belong to m adjacent rays, and all the partial extreme points belong to E1' n+ Or E1' n- Wherein m is less than or equal to n', and the central angle theta of the circular arc c If the angle is more than 45 degrees, the arc of the section is reserved, otherwise, the arc of the section is abandoned; the remaining circular arc forms beta + Sets of arcs of direction L1 and beta - A set L2 of arcs of direction;
s504, arcs in the sets L1 and L2 are sequentially taken, circle fitting is carried out on each arc by using a RANSAC random sampling consistency method, a plurality of groups of circles with different radiuses and circle center coordinates are obtained, the gradient directions of the arcs are mapped to the gradient directions of corresponding circles, and beta is formed + Sets of circles C1 and β of directions - A set of circles of direction C2.
4. The method for detecting the wave soldering spot defect of claim 3, wherein the step S5 is to precisely position the real-time soldering spot image based on a circular template matching method, and the process of obtaining the main area of the pad and the main area of the solder of the real-time soldering spot image is as follows:
s51, calculating the center coordinates and the radius of each circle in the circle set C1 and the circle set C2;
s52, preprocessing each circle in the circle set C1 and the circle set C2 to further obtain beta + Sets of circles C11 and β of directions - A set of circles of direction C21;
s53, calculating the radius r of each circle in the circle set C11 and the circle set C21 t1 And r t2 Taking a circle Q of the circle set C11 according to the rule of descending radius t1 And a circle Q of the circle set C21 t2 Matching is carried out, firstly, the distance D1 between the two circle centers is calculated by adopting the following formula:
Figure FDA0003998692740000041
wherein (x) t1 ,x t2 ) And (y) t1 ,y t2 ) Are respectively Q t1 And Q t2 D1 represents the Euclidean distance of two circle center coordinates, r t1 And r t2 Represents the radius of two circles; if D1 is less than r t1 And r t2 One third of the absolute value of the difference, the matching is successful, the matching is stopped, and the Q of the successful matching is recorded t1 And Q t2 Q1 and Q2, respectively; otherwise, continuing to match until all circles are matched;
s54, selecting all beta in the range of Q2 + The circles in the direction form a circle set C3, and the circles Q of the circle set C3 are sequentially taken according to the rule of descending radius t3 Matching with the circle Q2, firstly, calculating the distance D2 between the two circle center coordinates by adopting the following formula:
Figure FDA0003998692740000042
wherein (x) t2 ,y t2 ) And (x) t3 ,y t3 ) Are circles Q2 and Q, respectively t3 D2 represents the euclidean distance of the two circle center coordinates, r t2 And r t3 Are Q2 and Q, respectively t3 If D2 is less than r t2 And r t3 One third of the absolute value of the difference, if the matching is successful, stopping the matching, and recording the Q of the successful matching t3 Is Q3; otherwise, continuing to match until all circles are matched;
s55, if Q1, Q2 and Q3 are all matched, the matching is successful and reserved, Q1, Q2 and Q3 are an outer circle, a middle circle and an inner circle in sequence, and a difference set is obtained between Q1 and Q2 to obtain an annular region Reg cur_out As Img cur The difference between Q3 and a circle Q4 of half the radius of Q3 is used to obtain an annular region Reg cur_in As Img cur Step S6 is executed in the solder main area of (1); if no proper circle is matched after all the circle sets C1 and C2 are traversed, the matching is failed, and Reg is adopted model_out As Img cur Main area Reg of bonding pad cur_out ,Reg model_in As Img cur Solder main region Reg of cur_in Step S6 is executed.
5. The method for detecting solder bump defects according to claim 4, wherein in step S52, the preprocessing of each circle in the set C1 and the set C2 comprises:
let Reg check Has a maximum circumscribed circle radius of R max Calculating the radius of each circle of the circle sets C1 and C2, taking two circles of the circle set C1 or C2 according to the rule of descending the radius, and firstly calculating the distance D between the two circle centers by adopting the following formula:
Figure FDA0003998692740000051
wherein (x) 1 ,y 1 ) And (x) 2 ,y 2 ) Are the coordinates of the centers of two circles, D is the coordinates of two circlesIf Euclidean distance D is smaller than R max One tenth of the first, the two circles are judged to be the same circle; calculating the radius r of two circles 11 And r 12 Comparison of r 11 And r 12 Size, only the circle with the largest radius is reserved; after each circle is pretreated, the remaining circles form beta + Sets of circles C11 and β of directions - A set of circles of direction C21.
6. The method for detecting solder bump defects of claim 5, wherein in step S6, the method is based on Reg cur_out And Reg cur_in At Img cur For Img, for cur Respectively extracting real-time pad images Img cur_out And real-time solder image Img cur_in (ii) a The stored segmentation parameters comprise a first segmentation parameter and a second segmentation parameter, and the Img is respectively paired by using the first segmentation parameter and the second segmentation parameter cur_in Performing RGB and HSV color image threshold segmentation, and extracting dark color component region Reg Deep Blue component region Reg Blue_in And orange component region Reg Orange To get Reg Deep And Reg Blue Intersection is made to obtain new solder region Reg solder Soldering the main area Reg in And Reg solder Make the complement to obtain the characteristic region Reg feature ,Reg feature And Reg Orange Intersection forming characteristic region Reg feature2 Calculating Reg feature2 Area characteristic A of 1 As the characteristic parameters of the real-time soldering tin image;
for Img cur_out Performing HSV color image threshold segmentation, and extracting blue component region Reg Blue_out For Reg Blue_out Performing polar coordinate transformation to obtain region Reg polar Calculating Reg polar Area characteristic A of 2 And height characteristic H 1 As a characteristic parameter of the real-time pad image;
the characteristic parameters of the real-time soldering tin image and the characteristic parameters of the real-time welding pad image jointly form the characteristic parameters of the real-time welding spot image.
7. The method according to claim 6, wherein the solder joint types include normal, low tin, tin-clad, and bridging; wherein, the unqualified types comprise: tin is less, tin is wrapped and bridging is carried out;
the characteristic parameters of the template welding spot image comprise: minimum threshold MIN for tin-poor area, maximum threshold MAX for tin-coated area, and minimum threshold VALUE for bridging area, reg in S5 out Radius r of the inner and outer circles of 1 And r 2 (ii) a Comparing the characteristic parameters of the real-time welding spot image obtained in the step S6 with the characteristic parameters of the template welding spot image, and classifying the welding spots S, wherein the classification standard is as follows:
Figure FDA0003998692740000061
wherein a1 represents that the welding spot is normal, a2 represents that the welding spot is low in tin, a3 represents that the welding spot is wrapped with tin, a4 represents that the welding spot is bridged, MIN represents a minimum threshold VALUE of a low-tin area, MAX represents a maximum threshold VALUE of a wrapped-tin area, VALUE represents a minimum threshold VALUE of a bridging area, and r represents 1 Is a circular ring-shaped bonding pad main region Reg out Inner circle radius of (d) 2 Is a circular ring-shaped bonding pad main region Reg out The outer radius of the circle.
8. A system for detecting solder bump defects, the system being used for implementing the method of any one of claims 1 to 7, the system comprising:
the image acquisition module is used for acquiring a template image of the PCBA board;
the preprocessing module is used for preprocessing the template image, acquiring the character outline characteristics and the template welding spot image of the welding spot detection area, the template soldering tin image of the soldering tin detection area and the template pad image of the pad detection area, and storing the welding spot detection area, the soldering tin detection area and the pad detection area;
the first threshold segmentation module is used for manually selecting segmentation parameters which accord with the colors of normal welding spots based on R, G, B three color components of an RGB color model and H, S, V three color components of an HSV color model respectively, performing RGB and HSV color image threshold segmentation on the template soldering tin image and the template pad image, and storing the segmentation parameters;
the acquisition coarse positioning module is used for acquiring a real-time detection image of the PCBA, coarsely positioning the real-time detection image and extracting a real-time welding spot image based on the position of a welding spot detection area after the coarse positioning of the real-time detection image;
the accurate positioning module is used for accurately positioning the real-time welding spot image based on a circular template matching method to obtain a welding spot main area and a soldering tin main area of the real-time welding spot image;
the second threshold segmentation module is used for reading the stored segmentation parameters, respectively extracting a real-time pad image and a real-time soldering tin image based on the positions of the pad main area and the soldering tin main area in the real-time soldering point image, respectively performing RGB (red, green, blue) and HSV (hue, saturation and value) color image threshold segmentation on the real-time pad image and the real-time soldering tin image, and obtaining the characteristic parameters of the real-time soldering point image according to the segmentation result;
and the comparison and classification module is used for setting the characteristic parameters of the template welding spot image, comparing the obtained characteristic parameters of the real-time welding spot image with the image characteristic parameters of the template welding spot, and classifying the welding spot.
CN202110977751.9A 2021-08-24 2021-08-24 Method and system for detecting wave crest welding spot defects Active CN113724216B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110977751.9A CN113724216B (en) 2021-08-24 2021-08-24 Method and system for detecting wave crest welding spot defects

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110977751.9A CN113724216B (en) 2021-08-24 2021-08-24 Method and system for detecting wave crest welding spot defects

Publications (2)

Publication Number Publication Date
CN113724216A CN113724216A (en) 2021-11-30
CN113724216B true CN113724216B (en) 2023-03-21

Family

ID=78677642

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110977751.9A Active CN113724216B (en) 2021-08-24 2021-08-24 Method and system for detecting wave crest welding spot defects

Country Status (1)

Country Link
CN (1) CN113724216B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114299086B (en) * 2021-12-24 2023-05-26 深圳明锐理想科技有限公司 Image segmentation processing method, electronic equipment and system for low-contrast imaging
CN114627316B (en) * 2022-03-21 2022-11-25 江苏新之阳新能源科技有限公司 Hydraulic system oil leakage detection method based on artificial intelligence
CN114882022B (en) * 2022-07-07 2022-09-30 武汉海微科技有限公司 Dispensing detection device and method
CN115082466B (en) * 2022-08-22 2023-09-01 倍利得电子科技(深圳)有限公司 PCB surface welding spot defect detection method and system
CN115165899B (en) * 2022-09-02 2022-12-09 扬州中科半导体照明有限公司 LED chip welding quality detection method adopting optical means
CN116206381B (en) * 2023-05-04 2023-07-11 深圳市中际宏图科技有限公司 Camera module production management monitoring analysis system based on machine vision
CN116423003B (en) * 2023-06-13 2023-10-31 苏州松德激光科技有限公司 Tin soldering intelligent evaluation method and system based on data mining
CN117456168B (en) * 2023-11-08 2024-04-16 珠海瑞杰电子科技有限公司 PCBA intelligent detection system and method based on data analysis

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106981061A (en) * 2017-03-06 2017-07-25 深圳市恒茂科技有限公司 A kind of spot area detection method
CN107945184A (en) * 2017-11-21 2018-04-20 安徽工业大学 A kind of mount components detection method positioned based on color images and gradient projection

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5786622B2 (en) * 2011-10-04 2015-09-30 富士通株式会社 Image quality inspection method, image quality inspection apparatus, and image quality inspection program
CN105139386B (en) * 2015-08-12 2017-12-26 南京航空航天大学 A kind of image processing method of fast automatic detecting electric connector solder joint defective work
CN110610199B (en) * 2019-08-22 2022-09-13 南京理工大学 Automatic optical detection method for printed circuit board resistance element welding spot based on svm and xgboost

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106981061A (en) * 2017-03-06 2017-07-25 深圳市恒茂科技有限公司 A kind of spot area detection method
CN107945184A (en) * 2017-11-21 2018-04-20 安徽工业大学 A kind of mount components detection method positioned based on color images and gradient projection

Also Published As

Publication number Publication date
CN113724216A (en) 2021-11-30

Similar Documents

Publication Publication Date Title
CN113724216B (en) Method and system for detecting wave crest welding spot defects
CN107945184B (en) Surface-mounted component detection method based on color image segmentation and gradient projection positioning
JP4595705B2 (en) Substrate inspection device, parameter setting method and parameter setting device
CN109520706B (en) Screw hole coordinate extraction method of automobile fuse box
CN108007388A (en) A kind of turntable angle high precision online measuring method based on machine vision
US20040076323A1 (en) Inspection data producing method and board inspection apparatus using the method
JP3906780B2 (en) Data registration method for component code conversion table, board inspection data creation device, registration processing program, and storage medium thereof
CN110108712A (en) Multifunctional visual sense defect detecting system
CN108480223A (en) A kind of workpiece sorting system and its control method
CN115055964A (en) Intelligent assembling method and system based on fuel injection pump
CN115170497A (en) PCBA online detection platform based on AI visual detection technology
CN109447941B (en) Automatic registration and quality detection method in welding process of laser soldering system
JP2010027964A (en) Forming method of region setting data for inspection region and substrate appearance inspection device
CN112634259A (en) Automatic modeling and positioning method for keyboard keycaps
JP4814116B2 (en) Mounting board appearance inspection method
JP2007033126A (en) Substrate inspection device, parameter adjusting method thereof and parameter adjusting device
JP7380332B2 (en) Image processing device, control method and program for the image processing device
CN111415384B (en) Industrial image component accurate positioning system based on deep learning
JP2004132950A (en) Appearance inspection apparatus and appearance inspection method
CN114354491A (en) DCB ceramic substrate defect detection method based on machine vision
JP2023060798A (en) Method for detecting defect, defect detection system, and defect detection program
JP2006078285A (en) Substrate-inspecting apparatus and parameter-setting method and parameter-setting apparatus of the same
CN114594102B (en) Machine vision-based data line interface automatic detection method
TWI786894B (en) Detection method
TWI765402B (en) Detection method

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