PCB defect detection method and device based on HSV color space and computing device

By adopting a PCB board defect detection method based on the HSV color space, the problems of detection accuracy and parameter sensitivity of existing AOI inspection equipment are solved, and efficient and robust PCB board defect detection is achieved.

CN119334972BActive Publication Date: 2025-12-26ADVANCED SEMICON MFG INNOVATION CENT WUXI XISHAN DISTRICT +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411519928.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-12-26
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

Existing AOI inspection equipment has problems such as inaccurate and unreliable inspection results, high parameter sensitivity, and high resource dependence in PCB board solder joint inspection.

Method used

A PCB board defect detection method based on the HSV color space is adopted. By acquiring the image to be detected and converting it into an HSV channel image, the color distribution of the area between adjacent pads is extracted. The color extraction image of insufficient solder and the template image are compared to detect whether there are defects such as short circuit, insufficient solder, empty solder, cold solder, copper peeling and kneeling on the pads.

Benefits of technology

It achieves more accurate and comprehensive detection of PCB board defects, with better robustness, higher detection efficiency, no need for a large amount of training data, low parameter sensitivity, and can intuitively present various defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119334972B_ABST
    Figure CN119334972B_ABST
Patent Text Reader

Abstract

The application discloses a PCB defect detection method and device based on an HSV color space and a computing device, and relates to the technical field of PCB defect detection.The method comprises the following steps: performing coordinate correction on a to-be-detected image based on a template image to obtain a to-be-detected image annotation file; converting the to-be-detected image annotation file from an RGB channel to an HSV channel to obtain an HSV channel image; extracting a region between adjacent pads from the HSV channel image, and determining whether a short-circuit defect exists in a PCB according to the color distribution of the region between the adjacent pads; comparing the HSV channel image with a little-tin color extraction image to determine whether a little-tin defect exists in each pad; extracting a copper color region in each pad region from the HSV channel image to determine whether an empty pad defect, a false pad defect or a copper skin defect exists in each pad; and detecting whether a pin region with a light center and a dark periphery exists in the middle of each pad region in the HSV channel image to determine whether a kneeling pin defect exists in each pad.The application can accurately and comprehensively detect various defects existing in a PCB, and improves the detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of visual detection, and in particular to a PCB defect detection method based on HSV color space, a PCB defect detection device and a computing device. BACKGROUND

[0002] With the rapid development of the electronic industry, PCB (Printed Circuit Board) as the core component of electronic equipment, its manufacturing quality is crucial to the overall performance and reliability of the product. The solder joints on the PCB board as the key link connecting electronic components and PCB board, its quality directly affects the electrical connection and signal transmission performance of the circuit board. Therefore, the detection of the solder joints on the back of the PCB board becomes a key step to ensure the quality of the circuit board. Nowadays, visual detection means has occupied a very important position in the industrial manufacturing process, for example, it can be used to detect the surface defects of the product, and its non-contact and high-precision detection characteristics enable it to replace people to complete special work.

[0003] According to the existing AOI detection equipment, three methods are mainly used to detect the solder joints on the PCB board. One is template matching: the AOI equipment will store the image template of the standard solder joint in advance, and judge whether the solder joint meets the standard by template matching with the actually collected solder joint image, but the matching effect is affected by many factors, resulting in inaccurate and unreliable detection results. Two is feature extraction and recognition: the key features (such as shape, size, position, etc.) of the solder joint are extracted by using image processing algorithm, and compared with the preset standard value to identify the solder joint defects. This method is very sensitive to parameters. Three is machine learning algorithm: with the development of artificial intelligence technology, some AOI detection equipment begins to use machine learning algorithm to train detection model, improve the accuracy and efficiency of defect recognition, and this method needs a large amount of training data and strong resource dependence. It can be seen that the existing AOI detection equipment for detecting the solder joints on the PCB board has some defects.

[0004] Therefore, a PCB defect detection method based on HSV color space is needed to solve the problems in the above technical solutions. SUMMARY

[0005] Therefore, the present application provides a PCB defect detection method based on HSV color space and a PCB defect detection device to solve or at least alleviate the above problems.

[0006] According to one aspect of the present application, there is provided a PCB defect detection method based on HSV color space, executed in a computing device, the PCB having a plurality of pads for soldering, the method comprising: obtaining a to-be-detected image, a little tin color extraction image and a template image of the PCB to be detected; performing feature point matching on the to-be-detected image and the template image, so as to correct coordinates of the to-be-detected image based on the template image, and obtain a to-be-detected image annotation file; converting the to-be-detected image annotation file from an RGB channel to an HSV channel based on the HSV color space distribution rule, and obtaining an HSV channel image; extracting a region between adjacent pads from the HSV channel image, and determining whether the PCB has a short circuit defect according to the color distribution of the region between the adjacent pads; comparing the HSV channel image with the little tin color extraction image, so as to determine whether each pad of the PCB has a little tin defect; extracting a copper color region in each pad region from the HSV channel image, and determining whether each pad of the PCB has an empty soldering defect, a false soldering defect or a copper skin defect based on the copper color region in each pad region; and detecting whether a pin region with a bright color in the middle and a dark color around exists in the middle of each pad region in the HSV channel image, so as to determine whether each pad of the PCB has a kneeling pin defect.

[0007] Optionally, in the PCB defect detection method based on the HSV color space according to the present application, the step of extracting a region between adjacent pads from the HSV channel image comprises: extracting a pad dense distribution region from the HSV channel image, the pad dense distribution region comprising a plurality of pad regions densely distributed; and removing the plurality of pad regions from the pad dense distribution region based on a short circuit mask image, to obtain the region between adjacent pads.

[0008] Optionally, in the PCB defect detection method based on the HSV color space according to the present application, the step of determining whether the PCB has a short circuit defect according to the color distribution of the region between the adjacent pads comprises: judging whether the region between the adjacent pads has a color distribution; if the region between the adjacent pads has the color distribution, determining that the region between the adjacent pads of the PCB has a short circuit defect, and extracting a red-green-blue three-color image from the HSV channel image, performing threshold segmentation on the red-green-blue three-color image to obtain a threshold segmentation image, and performing contour extraction on the threshold segmentation image to extract a short circuit defect region; and if the region between the adjacent pads does not have the color distribution, determining that the PCB does not have a short circuit defect.

[0009] Optionally, in the PCB defect detection method based on HSV color space according to the present application, the comparison between the HSV channel image and the little-tin color extraction image is used to determine whether each pad of the PCB has a little-tin defect, comprising: extracting a plurality of pad regions from the HSV channel image as a plurality of comparison regions; for each comparison region, determining the mean square error value between the comparison region and the corresponding region in the little-tin color extraction image; if the mean square error value is greater than a mean square error threshold, extracting a first red region from the comparison region, and comparing the first red region with a second red region corresponding to the first red region in the little-tin color extraction image to determine whether the pad corresponding to the comparison region has a little-tin defect.

[0010] Optionally, in the PCB defect detection method based on HSV color space according to the present application, the comparison between the first red region and the second red region corresponding to the first red region in the little-tin color extraction image is used to determine whether the pad corresponding to the comparison region has a little-tin defect, comprising: calculating the red pixel difference value between the first red region and the second red region; if the red pixel difference value between the first red region and the second red region is greater than a preset pixel difference value, it is determined that the pad corresponding to the comparison region has a little-tin defect, and the first red region is determined as a little-tin defect region.

[0011] Optionally, in the PCB defect detection method based on HSV color space according to the present application, the extraction of the copper color region in each pad region from the HSV channel image comprises: extracting the region with H channel value distribution in 3-8 from each pad region in the HSV channel image to obtain the copper color region in each pad region.

[0012] Optionally, in the PCB defect detection method based on the HSV color space according to the present application, based on the copper color region in each pad region, it is determined whether each pad of the PCB has a missing solder defect, a false solder defect, or a copper skin defect, comprising: for the copper color region in each pad region, determining the area ratio of the copper color region in the corresponding pad region, if the area ratio is greater than a first predetermined ratio, and there is a black ring near the pin of the pad region, it is determined that the pad corresponding to the pad region has a missing solder defect; it is determined whether there is a black hollow region between the copper color region in the pad region and the pin of the pad region, if there is a black hollow region, it is further determined whether there is an overlapping region between the circumscribed rectangle of the copper color region and the circumscribed rectangle of the black hollow region, if there is an overlapping region, it is determined that the pad corresponding to the pad region has a false solder defect; if the area ratio is greater than a third predetermined ratio and less than a second predetermined ratio, it is determined that the pad corresponding to the pad region has a copper skin defect, wherein the third predetermined ratio is less than the second predetermined ratio, and the second predetermined ratio is less than the first predetermined ratio.

[0013] Optionally, in the PCB defect detection method based on the HSV color space according to the present application, it is determined whether each pad of the PCB has a pin defect by detecting whether there is a pin region with light color in the middle and dark color around in the middle part of each pad region in the HSV channel image, comprising: converting the HSV channel image into a grayscale image, and performing binaryzation processing on the grayscale image to obtain a binaryzation image; detecting whether there is a light color region in the middle part of each pad region in the binaryzation image, and whether there is a dark color region with an average brightness value lower than a brightness threshold value around the light color region; if it is detected that there is a light color region in the middle part of the pad region and there is a dark color region around the light color region, it is determined that there is a pin region in the middle part of the pad region, and the pad corresponding to the pad region does not have a pin defect; if it is not detected that there is a light color region in the middle part of the pad region and there is a dark color region around the light color region, it is determined that there is no pin region in the middle part of the pad region, and the pad corresponding to the pad region has a pin defect.

[0014] Optionally, in the PCB defect detection method based on the HSV color space according to the present application, further comprising: labeling each defect existing in the PCB in the image to be detected in the image label file to obtain a defect detection result.

[0015] According to an aspect of the present application, there is provided a PCB defect detection device deployed in a computing device, the PCB having a plurality of pads for soldering, the device comprising: an acquisition unit adapted to acquire a to-be-detected image of the PCB to be detected, a little tin color extraction image, and a template image; a matching unit adapted to perform feature point matching between the to-be-detected image and the template image, so as to perform coordinate correction on the to-be-detected image based on the template image, and obtain a to-be-detected image annotation file; a conversion unit adapted to convert the to-be-detected image annotation file from an RGB channel to an HSV channel based on an HSV color space distribution rule, and obtain an HSV channel image; a first detection unit adapted to extract a region between adjacent pads from the HSV channel image, and determine whether the PCB has a short circuit defect according to a color distribution of the region between the adjacent pads; a second detection unit adapted to compare the HSV channel image with the little tin color extraction image, so as to determine whether each pad of the PCB has a little tin defect; a third detection unit adapted to extract a copper color region in each pad region from the HSV channel image, and determine whether each pad of the PCB has an empty soldering defect, a false soldering defect, or a copper skin defect based on the copper color region in each pad region; and a fourth detection unit adapted to detect whether a pin region with a bright color in the middle and a dark color around exists in the middle of each pad region in the HSV channel image, so as to determine whether each pad of the PCB has a kneeling pin defect.

[0016] According to an aspect of the present application, there is provided a computing device, comprising: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions comprise instructions for performing the above-mentioned PCB defect detection method based on an HSV color space.

[0017] According to an aspect of the present application, there is provided a computer program product comprising computer programs / instructions, wherein the computer programs / instructions, when executed by a processor, implement the above-mentioned method.

[0018] According to an aspect of the present application, there is provided a readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform the above-mentioned PCB defect detection method based on an HSV color space.

[0019] According to the technical scheme of the application, a PCB defect detection method based on an HSV color space is provided, first, a to-be-detected image of a PCB to be detected under three-color light, a little-tin color extraction image and a template image are acquired, the to-be-detected image is corrected based on the template image to obtain a to-be-detected image annotation file, and the to-be-detected image annotation file is converted into an HSV channel image based on an HSV color space. Further, whether the PCB has a short circuit defect is determined according to the color distribution of the region between adjacent pads. Whether each pad of the PCB has a little-tin defect is determined by comparing the HSV channel image with the little-tin color extraction image; whether each pad of the PCB has an empty welding defect, a false welding defect or a copper skin defect is determined based on the copper color region in each pad region extracted from the HSV channel image; and whether each pad of the PCB has a kneeling foot defect is determined by detecting whether the middle part of each pad region in the HSV channel image has a pin region with light color in the middle and dark color around. Based on this, the image based on the HSV color space of the application can more intuitively present various defects in the PCB, and thus can more accurately and comprehensively detect various defects existing in the PCB, has better robustness and higher detection efficiency. In addition, the PCB defect detection according to the application does not need to rely on training data, has low sensitivity to parameters, and is convenient for adjusting the threshold according to actual detection requirements.

[0020] The above description is only a summary of the technical scheme of the application, in order to more clearly understand the technical means of the application, the content of the specification can be implemented, and in order to make the above and other purposes, characteristics and advantages of the application more obvious and easy to understand, the following specific embodiments of the application are described. BRIEF DESCRIPTION OF DRAWINGS

[0021] To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings. These aspects are indicative of various ways in which the principles disclosed herein can be practiced and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The foregoing and other objects, features, and advantages of the application will become more fully apparent from the following detailed description, appended claims, and accompanying drawings in which like reference numerals identify like components and elements throughout the several views. The detailed description implements the above-mentioned and other objects, features, and advantages with reference to the attaching drawings, in which:

[0022] Figure 1 A schematic diagram of a computing device 100 is shown according to an embodiment of the application;

[0023] Figure 2 A flowchart of a PCB defect detection method 200 based on an HSV color space is shown according to an embodiment of the application;

[0024] Figure 3A schematic diagram of a to-be-detected image in an embodiment of the present application is shown;

[0025] Figure 4 A schematic diagram of a little-tin color extraction image in an embodiment of the present application is shown;

[0026] Figure 5 A schematic diagram of a template image in an embodiment of the present application is shown;

[0027] Figure 6 A schematic diagram of an extracted pad dense distribution area in an embodiment of the present application is shown;

[0028] Figure 7 A schematic diagram of a short circuit mask image in an embodiment of the present application is shown;

[0029] Figure 8 A schematic diagram of a pad with little-tin defect in an embodiment of the present application is shown;

[0030] Figure 9 A schematic diagram of a pad with empty welding defect in an embodiment of the present application is shown;

[0031] Figure 10 A schematic diagram of a pad with false welding defect in an embodiment of the present application is shown;

[0032] Figure 11 A schematic diagram of a pad with copper skin defect in an embodiment of the present application is shown;

[0033] Figure 12 A schematic diagram of a pad with kneel defect in an embodiment of the present application is shown;

[0034] Figure 13 A schematic diagram of a PCB defect detection device 1200 provided by an embodiment of the present application is shown. DETAILED DESCRIPTION

[0035] Exemplary embodiments of the present application will be described herein below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thoroughly and completely understood, and so that the scope of the present application will be fully conveyed to those skilled in the art.

[0036] In view of the problems existing in the detection method of the existing AOI detection equipment for the soldering points of the PCB, the embodiment of the present application provides a PCB defect detection method based on an HSV color space, and the image based on the HSV color space can more intuitively present various defects in the PCB, and thus can more accurately and comprehensively detect various defects existing in the PCB, has better robustness, and has higher detection efficiency.

[0037] The PCB defect detection method based on the HSV color space in the embodiment of the present application can be executed in a computing device.

[0038] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0039] Figure 1 A schematic diagram of a computing device 100 is shown according to an embodiment of the present application. Figure 1 As shown, in a basic configuration, the computing device 100 includes at least one processing unit 102 and a system memory 104. According to an aspect, depending on the configuration and type of computing device, the processing unit 102 can be implemented as a processor. The system memory 104 includes, but is not limited to, volatile (e.g., random access memory (RAM)), non-volatile (e.g., read-only memory (ROM)), flash memory, or any combination thereof. According to an aspect, the system memory 104 includes an operating system 105.

[0040] According to an aspect, the operating system 105 is suitable for controlling the operation of the computing device 100, for example. In addition, the example is practiced in conjunction with a graphics library, other operating systems, or any other application programs, and is not limited to any particular application or system. In Figure 1 The basic configuration is shown by those components within the dashed line. According to an aspect, the computing device 100 has additional features or functionality. For example, according to an aspect, the computing device 100 includes additional data storage devices (removable and / or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in Figure 1 by removable storage 109 and non-removable storage 110.

[0041] As stated above, according to an aspect, a program module 103 is stored in the system memory 104. According to an aspect, the program module 103 can include one or more applications, and the present application does not limit the type of application, for example, the application can include: an email and contact application, a word processing application, a spreadsheet application, a database application, a slide show application, a drawing or computer-aided application, a web browser application, and the like.

[0042] According to an aspect, the program module 103 can include a plurality of program instructions adapted to perform the HSV color space based PCB board defect detection method 200 of the present application, such that the computing device 100 is configured to perform the HSV color space based PCB board defect detection method 200 of the present application.

[0043] According to an aspect, the program module 103 can include the PCB board defect detection apparatus 1200, which can be configured to perform the HSV color space based PCB board defect detection method 200 of the present application.

[0044] According to an aspect, the examples can be practiced on a circuit comprising discrete electronic elements, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic elements or a microprocessor, for example. The examples can be practiced using other technologies, including application- specific circuitry. Figure 1 The examples can be practiced in a system-on-a-chip (SOC) where each or many of the components illustrated in FIG. 1 can be integrated on a single integrated circuit, according to an aspect. According to an aspect, such an SOC device can include one or more processing units, graphics units, communications units, system virtualization units, and various application functionality all of which are integrated (or "burned") onto the chip substrate as a single integrated circuit (or "chip"). When operating via an SOC, the functionality, described herein, can be operated via application-specific logic integrated with other components of the computing device 100 on the single integrated circuit (chip). Embodiments of the application can also be practiced using other technologies where

[0045] According to an aspect, the computing device 100 can also have one or more input device(s) 112, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output device(s) 114, such as a display, speakers, a printer, etc., can also be included. The aforementioned devices are examples and others can also be used. The computing device 100 can include one or more communication connections 116 allowing communications with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver, and / or transceiver circuitry; universal serial bus (USB), parallel, and / or serial ports.

[0046] The term computer readable media as used herein includes computer storage media. Computer storage media can include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, or program modules 103. The system memory 104, the removable storage device 109, and the non-removable storage device 110 are all computer storage media examples (i.e., memory storage.) Computer storage media can include Random Access Memory (RAM), Read Only Memory (ROM), Electronically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other article of manufacture which can be used to store information and which can be accessed by the computing device 100. According to an aspect, any of this computer storage media can be a part of the computing device 100. Computer storage media does not include a carrier wave or other propagated data signal.

[0047] According to an aspect, communication media typically embodies computer readable instructions, data structures, program modules 103, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and includes any information delivery media. According to an aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0048] In an embodiment according to the present application, the computing device 100 is configured to perform the HSV color space based PCB board defect detection method 200 of the present application. The computing device 100 includes one or more processors, and one or more readable storage media having stored therein program instructions which, when configured to be executed by the one or more processors, cause the computing device to perform the HSV color space based PCB board defect detection method 200 in an embodiment of the present application.

[0049] Figure 2 A flow diagram of an HSV color space based PCB board defect detection method 200 according to an embodiment of the present application is shown. The HSV color space based PCB board defect detection method 200 can be performed in a computing device, such as the aforementioned computing device 100.

[0050] According to the PCB board defect detection method 200 based on HSV color space of the present invention, the types of defects that can be detected on the PCB board include, but are not limited to, short circuit defects, insufficient solder defects, open solder joint defects, cold solder joint defects, copper peeling defects, and kneeling defects.

[0051] It should be noted that a PCB board has multiple solder pads for soldering. A solder pad is a metal part on a PCB board used for soldering component leads or metal ends.

[0052] like Figure 2 As shown, the PCB board defect detection method 200 based on the HSV color space includes the following steps 210-260.

[0053] First, in step 210, the computing device 100 can acquire the image to be inspected, the image of the PCB board with insufficient solder color extraction, and the template image. Here, the image to be inspected is the image of the PCB board under three-color light, and the image to be inspected is an RGB channel image.

[0054] here, Figure 3 A schematic diagram of an image to be detected according to an embodiment of the present invention is shown. Figure 4 A schematic diagram of a tin-free color extraction image according to an embodiment of the present invention is shown. Figure 5 A schematic diagram of a template image according to an embodiment of the present invention is shown. It should be noted that the tin-deficient color extraction image is an image used to detect tin-deficient defects in the annotation file of the image to be detected; "tin-deficient" refers to an area with a relatively low tin content.

[0055] Subsequently, in step 220, the computing device 100 can use a comparison algorithm to match feature points between the image to be detected and the template image, so as to correct the coordinates of the image to be detected based on the template image and obtain the annotation file of the image to be detected (i.e., the JSON file of the image to be detected).

[0056] It should be noted that the image annotation file to be detected contains the coordinate position information of each defect type to be detected and each part to be detected (including pads).

[0057] Next, in step 230, the computing device 100 can convert the image to be detected from the RGB channel to the HSV channel based on the distribution law of the HSV color space to obtain the HSV channel image.

[0058] Subsequently, in step 240, the computing device 100 can extract the area between adjacent pads (including the area between any two adjacent pads) from the HSV channel image and determine whether there is a short circuit defect on the PCB board based on the color distribution of the area between adjacent pads.

[0059] In some embodiments of the present application, in step 240, the computing device 100 can extract the region between adjacent pads from the HSV channel image by the following way: first, the computing device 100 extracts the pad dense distribution region from the HSV channel image. Figure 6 A schematic diagram of the pad dense distribution region extracted according to an embodiment of the present application is shown, Figure 7 A schematic diagram of the short circuit mask image according to an embodiment of the present application is shown. It should be noted that the pad region corresponds to the purple region of the short circuit mask image. As Figure 6 And Figure 7 As shown, the pad dense distribution region includes a plurality of pad regions densely distributed, and the shape of the pad region can be circular, square, or water drop-shaped.

[0060] Further, the computing device 100 can remove the plurality of pad regions from the pad dense distribution region based on the short circuit mask image to obtain the region between adjacent pads (corresponding to the yellow region of the short circuit mask image).

[0061] It should be noted that if the region between adjacent pads of the PCB board exists solder, color distribution will appear under three-color light. Based on this, after the computing device 100 extracts the region between adjacent pads from the HSV channel image in step 240, it can determine whether the region between adjacent pads exists color distribution. If the region between adjacent pads exists color distribution, it means that the region between adjacent pads of the PCB board exists solder, and then it can be determined that the region between adjacent pads of the PCB board exists short circuit defect, and the color distribution position is the short circuit defect position. If the region between adjacent pads does not exist color distribution, it means that the region between adjacent pads of the PCB board does not exist solder, and then it can be determined that the PCB board does not exist short circuit defect.

[0062] Further, if it is determined that the region between adjacent pads of the PCB board exists short circuit defect, the computing device 100 can extract the short circuit defect region by the following way: extracting a red-green-blue three-color image from the HSV channel image, performing threshold segmentation on the red-green-blue three-color image to obtain a threshold segmentation image, and performing contour extraction on the threshold segmentation image to extract the short circuit defect region. Wherein, the threshold segmentation on the red-green-blue three-color image is performed in the following way: setting all the brightness values greater than 190 in the red-green-blue three-color image to 255, and setting all the brightness values less than 190 in the red-green-blue three-color image to 0, so as to realize the threshold segmentation on the red-green-blue three-color image.

[0063] Next, in step 250, the computing device 100 can compare the HSV channel image with the less solder color extraction image to determine whether each pad of the PCB board exists less solder defect.

[0064] It should be noted that, due to less tin on the PCB board, the surface is flat, and it appears red under three-color light, so if there is a red part in the HSV channel image of the PCB board, it means that the PCB board may have a little tin defect. It should be pointed out that when the H channel value in the HSV channel image is distributed in 0-34 or 150-180, it will appear red, which is more intuitive compared to the RBG three channels with illumination invariance.

[0065] In some embodiments, the specific way in which the computing device 100 compares the HSV channel image with the little tin color extraction image is as follows: first, the computing device 100 can extract a plurality of pad regions from the HSV channel image as a plurality of comparison regions, wherein each pad region is a comparison region. For example, the comparison region size can be determined to be 15x15 based on the pad size. Further, the computing device 100 can determine, for each comparison region, a mean square error value (MSE value) of the comparison region and a corresponding region in the little tin color extraction image, determine whether the mean square error value (MSE value) of the comparison region and the corresponding region in the little tin color extraction image is greater than a mean square error threshold (MSE threshold), and if the mean square error value of the comparison region and the corresponding region in the little tin color extraction image is greater than the mean square error threshold, then a first red region can be further extracted from the comparison region, and the first red region in the comparison region is compared with a second red region in the corresponding region in the little tin color extraction image to determine whether the pad corresponding to the comparison region has a little tin defect. Specifically, for the comparison region whose mean square error value with the corresponding region in the little tin color extraction image is greater than the mean square error threshold, the red pixel difference value of the first red region in the comparison region and the second red region in the corresponding region in the little tin color extraction image can be calculated, and whether the red pixel difference value is greater than a preset pixel difference value. If the red pixel difference value is greater than the preset pixel difference value, it can be determined that the pad corresponding to the comparison region has a little tin defect, and the first red region in the comparison region can be determined as a little tin defect region.

[0066] Here, Figure 8 A schematic diagram of a pad with a little tin defect according to an embodiment of the present application is shown, and the red region (first red region) in the diagram is a little tin defect region.

[0067] In some embodiments, the preset mean square error threshold is, for example, 80. The preset pixel difference value is, for example, 0.2. However, the present application is not limited thereto, and it should be understood that the preset mean square error threshold and the preset pixel difference value can be adjusted according to actual use requirements.

[0068] Subsequently, in step 260, the computing device 100 can extract the copper color region in each solder pad region from the HSV channel image, and then can determine whether each solder pad of the PCB has a missing solder defect, a false solder defect, or a copper skin defect based on the copper color region in each solder pad region.

[0069] It should be noted that in the embodiments of the present application, the missing solder, i.e., the case where the solder pad is completely not soldered, will cause a large copper color region to exist on the solder pad. The false solder, i.e., the case where the solder pad is partially not soldered, will cause a partial copper color region to exist on the solder pad, and a black hollow region to exist between the partial copper color region and the pin.

[0070] In some embodiments, the copper color region is a region where the H channel value is distributed in 3-8. In step 250, the computing device 100 can obtain the copper color region in each solder pad region by extracting the region where the H channel value is distributed in 3-8 from the HSV channel image. Optionally, in the process of extracting the copper color region in each solder pad region, the copper color region with a small area can also be filtered out, for example, the copper color region with an area ratio less than or equal to 4% in the solder pad region can be filtered out.

[0071] Figure 9 A schematic diagram of a solder pad with a missing solder defect in an embodiment of the present application is shown. In some embodiments, based on the copper color region in each solder pad region, whether each solder pad of the PCB has a missing solder defect can be determined by the following method: for the copper color region in each solder pad region, first, the area ratio of the copper color region in the corresponding solder pad region can be determined, and it is determined whether the area ratio is greater than a first predetermined ratio. If the area ratio of the copper color region in the corresponding solder pad region is greater than the first predetermined ratio, it can be further determined whether a black ring exists near the pin (the pin is located at the middle position of the solder pad region) of the solder pad region. If the black ring exists near the pin of the solder pad region, it is determined that the solder pad corresponding to the solder pad region has a missing solder defect, and the process of determining whether each solder pad of the PCB has a missing solder defect is completed. Figure 9 In one embodiment, the first predetermined ratio can be, for example, 50%.

[0072] Figure 10Fig. 2 shows a schematic diagram of a false soldering defect existing in a soldering pad according to an embodiment of the present application. In some embodiments, based on the copper color region in each soldering pad region, whether each soldering pad of the PCB has a false soldering defect can be determined by the following method: for the copper color region in each soldering pad region, first, it can be determined whether there is a black hollow region between the copper color region and the pin of the soldering pad region, here, the region with a gray level lower than 30 can be defined as a black hollow region. If there is a black hollow region between the copper color region and the pin of the soldering pad region, it can be further determined whether there is an overlapping region between the circumscribed rectangle of the copper color region and the circumscribed rectangle of the black hollow region, if there is an overlapping region (i.e., the copper color region is connected with the black hollow region), it is determined that the soldering pad corresponding to the soldering pad region has a false soldering defect. Figure 10

[0073] Figure 11 Fig. 3 shows a schematic diagram of a copper skin defect existing in a soldering pad according to an embodiment of the present application. In some embodiments, based on the copper color region in each soldering pad region, whether each soldering pad of the PCB has a copper skin defect can be determined by the following method: for the copper color region in each soldering pad region, first, it can be determined that the area ratio of the copper color region in the corresponding soldering pad region, and it is determined whether the area ratio is greater than a third predetermined ratio and less than a second predetermined ratio, if the area ratio is greater than the third predetermined ratio and less than the second predetermined ratio, it is determined that the soldering pad corresponding to the soldering pad region has a copper skin defect.

[0074] It should be noted that the third predetermined ratio is less than the second predetermined ratio, and the second predetermined ratio is less than the first predetermined ratio. The third predetermined ratio can be greater than or equal to 4%. The first predetermined ratio can be 50%.

[0075] Finally, in step 270, the computing device 100 can determine whether each soldering pad of the PCB has a kneeling pin defect by detecting whether there is a pin region (i.e., a region with a bright center and a dark periphery) in the middle of each soldering pad region in the HSV channel image.

[0076] The kneeling pin is in a specified region (the middle region of the soldering pad). In the embodiments of the present application, whether the soldering pad has a kneeling pin defect can be determined by judging whether the middle region of the soldering pad has a pin. If the middle region of the soldering pad has a pin, it is determined that the soldering pad does not have a kneeling pin defect. Conversely, if the middle region of the soldering pad does not have a pin, it is determined that the soldering pad has a kneeling pin defect.

[0077] ​It should be noted that, under the light of three-color light, the periphery of the pin has a slope and appears dark blue, and the surface of the pin appears bright red because the surface of the pin is flat. Therefore, the region with the middle being bright and the periphery being dark in each pad region of the HSV channel image can be determined as the pin region. In other words, in the embodiment of the present application, the pin region is the region with the middle being bright and the periphery being dark.

[0078] Based on this, in step 270, if the pin region with the middle being bright and the periphery being dark is detected in the middle of the pad region from the HSV channel image, it can be determined that the pad corresponding to the pad region does not have the kneeling foot defect. Conversely, if the pin region with the middle being bright and the periphery being dark is not detected in the middle of the pad region from the HSV channel image, it can be determined that the pad corresponding to the pad region has the kneeling foot defect. Here, Figure 12 A schematic diagram of the pad having the kneeling foot defect is shown according to the embodiment of the present application.

[0079] In some embodiments, the computing device 100 can detect whether the pin region exists in the middle of each pad region in the HSV channel image in the following manner: first, the HSV channel image can be converted into a gray-scale image, and the gray-scale image can be binarized to obtain a binarized image. Further, whether the bright region exists in the middle of each pad region in the binarized image can be detected, and whether the dark region with the average brightness value lower than the brightness threshold value exists around the bright region can be detected. If the bright region exists in the middle of the pad region and the dark region exists around the bright region, it is determined that the pin region exists in the middle of the pad region, and the pad corresponding to the pad region does not have the kneeling foot defect. Conversely, if the bright region does not exist in the middle of the pad region and the dark region exists around the bright region, it is determined that the pin region does not exist in the middle of the pad region, and the pad corresponding to the pad region has the kneeling foot defect.

[0080] In an implementation manner, the binarized image can be obtained in the following manner: the gray-scale value greater than 140 in the gray-scale image is set to 255, and the gray-scale value less than 140 in the gray-scale image is set to 0. Further, the bright region contour located in the middle of the pad region can be extracted from the binarized image, and it is judged whether the average brightness value of the surrounding region (for example, the region expanded outward by 10 pixels) of the bright region contour is less than the brightness threshold value. If the average brightness value of the surrounding region of the bright region contour is less than the brightness threshold value, it is determined that the dark region exists around the bright region, and thus it can be determined that the pad corresponding to the pad region does not have the kneeling foot defect. Conversely, if the average brightness value of the surrounding region of the bright region contour is greater than or equal to the brightness threshold value, it is determined that the dark region does not exist around the bright region, and thus it can be determined that the pad corresponding to the pad region has the kneeling foot defect.

[0081] It can be understood that the dark region in the embodiment of the present application refers to a region with an average brightness value lower than a brightness threshold. In an embodiment, the brightness threshold can be 100, for example. However, it should be understood that the brightness threshold can be set by a person skilled in the art according to actual detection needs, and the present application does not limit the specific value of the brightness threshold.

[0082] In addition, in some embodiments of the present application, after the detection of various defects of the PCB is completed, the various defects existing in the PCB can be labeled (including labeling the defect type and the defect position) in the image to be detected image labeling file to obtain a defect detection result. It can be understood that the type of defect existing in the PCB detected according to the present application can include one or more of short circuit defect, less tin defect, empty welding defect, false welding defect, copper skin defect, and kneeling foot defect.

[0083] Figure 13 A schematic diagram of a PCB defect detection device 1200 according to an embodiment of the present application is shown. The PCB defect detection device 1200 can be deployed in the computing device 100, and the PCB defect detection device 1200 is configured to execute the HSV color space-based PCB defect detection method 200 of the present application.

[0084] As shown in Figure 13 In an embodiment of the present application, the PCB defect detection device 1200 includes an acquisition unit 1210, a matching unit 1220, a conversion unit 1230, a first detection unit 1240, a second detection unit 1250, a third detection unit 1260, and a fourth detection unit 1270 connected in sequence and in communication.

[0085] The acquisition unit 1210 is configured to acquire a to-be-detected image of a PCB under three-color light, a less-tin color extraction image, and a template image.

[0086] The matching unit 1220 is configured to perform feature point matching between the to-be-detected image and the template image, so as to perform coordinate correction on the to-be-detected image based on the template image, and obtain a to-be-detected image labeling file.

[0087] The conversion unit 1230 is configured to convert the to-be-detected image labeling file from an RGB channel to an HSV channel based on the HSV color space distribution rule, and obtain an HSV channel image.

[0088] The first detection unit 1240 is configured to extract a region between adjacent pads from the HSV channel image, and determine whether the PCB has a short circuit defect based on the color distribution of the region between the adjacent pads.

[0089] The second detection unit 1250 is configured to compare the HSV channel image with the little-tin color extraction image to determine whether each pad of the PCB has a little-tin defect.

[0090] The third detection unit 1260 is configured to extract a copper color region in each pad region from the HSV channel image, and determine whether each pad of the PCB has an empty welding defect, a false welding defect or a copper skin defect based on the copper color region in each pad region.

[0091] The fourth detection unit 1270 is configured to detect whether a pin region with a bright color in the middle and a dark color around the middle exists in each pad region in the HSV channel image to determine whether each pad of the PCB has a kneeling pin defect.

[0092] It should be noted that the acquisition unit 1210, the matching unit 1220, the conversion unit 1230, the first detection unit 1240, the second detection unit 1250, the third detection unit 1260 and the fourth detection unit 1270 are respectively configured to perform the foregoing steps 210-270. Here, the specific execution logic of each unit can be referred to the description of the steps 210-270 in the method 200 above, which will not be described here again.

[0093] According to the PCB defect detection method 200 based on the HSV color space in the embodiment of the present application, first, the to-be-detected image of the PCB under three-color light, the little-tin color extraction image and the template image are acquired, the to-be-detected image is coordinate-corrected based on the template image to obtain a to-be-detected image annotation file, and the to-be-detected image annotation file is converted into an HSV channel image based on the HSV color space. Further, whether the PCB has a short circuit defect is determined according to the color distribution of the region between adjacent pads. By comparing the HSV channel image with the little-tin color extraction image, whether each pad of the PCB has a little-tin defect is determined; by extracting a copper color region in each pad region from the HSV channel image, whether each pad of the PCB has an empty welding defect, a false welding defect or a copper skin defect is determined based on the copper color region in each pad region; and by detecting whether a pin region with a bright color in the middle and a dark color around the middle exists in each pad region in the HSV channel image, whether each pad of the PCB has a kneeling pin defect is determined. Based on this, the image based on the HSV color space of the present application can more intuitively present various defects in the PCB, and thus can more accurately and comprehensively detect various defects existing in the PCB, has better robustness and higher detection efficiency. In addition, the PCB defect detection according to the present application does not need to rely on training data, has low sensitivity to parameters, and is convenient for adjusting the threshold according to actual detection requirements.

[0094] The various techniques described herein can be implemented in connection with hardware or software or, where appropriate, with a combination of both. Thus, the methods and apparatus of the present application, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard disks, USB flash drives, floppy diskettes, CD-ROMs, ROM or

[0095] Where a program code is executed on a programmable computer, the mobile terminal generally includes a processor, a processor readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute instructions in the program code stored in the memory to perform the HSV color space based PCB defect detection method of the present application.

[0096] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.

[0097] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.

[0098] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.

[0099] Similarly, it is to be understood that the above description is intended to be illustrative and not restrictive. Many embodiments of the present application will be apparent to those of skill in the art upon reviewing the above description, and it is therefore contemplated that the claims should be construed in light of the full scope of the disclosure and the equivalents thereof.

[0100] Those skilled in the art will understand that the modules, or units, or components of the devices in the examples disclosed herein can be arranged in the devices as described in the examples, or alternatively can be located in one or more devices different from the devices in the examples. The modules in the foregoing examples can be combined as a module or further divided into multiple sub-modules.

[0101] Unless otherwise defined, use of the ordinal adjectives "first," "second," "third," etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects, referred to necessarily have to appear in a given order.

Claims

1. A PCB defect detection method based on HSV color space, executed in a computing device, the PCB having a plurality of pads for soldering, the method comprising: obtaining a to-be-detected image, a little-tin color extraction image and a template image of a PCB to be detected; performing feature point matching on the to-be-detected image and the template image, so as to correct coordinates of the to-be-detected image based on the template image, and obtain a to-be-detected image annotation file; converting the to-be-detected image annotation file from an RGB channel to an HSV channel based on a distribution rule of the HSV color space, and obtaining an HSV channel image; extracting a region between adjacent pads from the HSV channel image, and determining whether a short circuit defect exists in the PCB according to a color distribution of the region between the adjacent pads; comparing the HSV channel image with the little-tin color extraction image, to determine whether a little-tin defect exists in each pad of the PCB; extracting a copper color region in each pad region from the HSV channel image, the copper color region being a region in which an H channel value is distributed in a range of 3-8, and determining whether an empty pad defect, a false pad defect or a copper skin defect exists in each pad of the PCB based on the copper color region in each pad region, including: for the copper color region in each pad region, determining an area ratio of the copper color region in the corresponding pad region, if the area ratio is greater than a first predetermined ratio and a black ring exists near a pin of the pad region, determining that the pad corresponding to the pad region has an empty pad defect; judging whether a black hollow region exists between the copper color region and the pin of the pad region, if the black hollow region exists, further judging whether an overlapping region exists between an external rectangle of the copper color region and an external rectangle of the black hollow region, if the overlapping region exists, determining that the pad corresponding to the pad region has a false pad defect; if the area ratio is greater than a third predetermined ratio and less than a second predetermined ratio, determining that the pad corresponding to the pad region has a copper skin defect, wherein the third predetermined ratio is less than the second predetermined ratio, and the second predetermined ratio is less than the first predetermined ratio; detecting whether a pin region with a bright color in the middle and a dark color around exists in a middle part of each pad region in the HSV channel image, to determine whether a kneeling pin defect exists in each pad of the PCB.

2. The method of claim 1, wherein, extracting a region between adjacent pads from the HSV channel image, including: extracting a pad dense distribution region from the HSV channel image, the pad dense distribution region including a plurality of pad regions densely distributed; removing the plurality of pad regions from the pad dense distribution region based on a short circuit mask image, to obtain a region between adjacent pads.

3. The method of claim 1, wherein, determining whether a short circuit defect exists in the PCB according to a color distribution of the region between the adjacent pads, including: judging whether the region between the adjacent pads has a color distribution; if the color distribution exists, determining that a short circuit defect exists in a region between adjacent pads of the PCB board, and extracting a red-green-blue three-color image from the HSV channel image, performing threshold segmentation on the red-green-blue three-color image to obtain a threshold segmentation image, and performing contour extraction on the threshold segmentation image to extract a short circuit defect region; if the color distribution does not exist, determining that the PCB board does not have a short circuit defect.

4. The method of any one of claims 1-3, wherein, comparing the HSV channel image with the little tin color extraction image to determine whether each pad of the PCB board has a little tin defect, including: extracting a plurality of pad regions from the HSV channel image as a plurality of comparison regions; for each comparison region, determining a mean square error value of the comparison region and a corresponding region in the little tin color extraction image; if the mean square error value is greater than a mean square error threshold value, extracting a first red region from the comparison region, and comparing the first red region with a second red region corresponding to the first red region in the little tin color extraction image to determine whether the pad corresponding to the comparison region has a little tin defect.

5. The method of claim 4, wherein, comparing the first red region with the second red region corresponding to the first red region in the little tin color extraction image to determine whether the pad corresponding to the comparison region has a little tin defect, including: calculating a red pixel difference value of the first red region and the second red region; if the red pixel difference value of the first red region and the second red region is greater than a preset pixel difference value, determining that the pad corresponding to the comparison region has a little tin defect, and determining the first red region as a little tin defect region.

6. The method of any one of claims 1-3, wherein, detecting whether a pin region with a light color in the middle and a dark color around the middle exists in each pad region in the HSV channel image to determine whether each pad of the PCB board has a pin defect, including: converting the HSV channel image into a grayscale image, and performing binaryzation processing on the grayscale image to obtain a binaryzation image; detecting whether a light color region exists in the middle of each pad region, and whether a dark color region with an average brightness value lower than a brightness threshold value exists around the light color region; if it is detected that a light color region exists in the middle of the pad region and a dark color region exists around the light color region, it is determined that a pin region exists in the middle of the pad region, and the pad corresponding to the pad region does not have a pin defect; if it is not detected that a light color region exists in the middle of the pad region and a dark color region exists around the light color region, it is determined that a pin region does not exist in the middle of the pad region, and the pad corresponding to the pad region has a pin defect.

7. The method of any one of claims 1-3, wherein, further comprising: annotating each defect existing in the PCB board in the to-be-detected image annotation file to obtain a defect detection result.

8. A PCB board defect detection device deployed in a computing device, adapted to execute the method of any one of claims 1-7, the PCB board having a plurality of pads for soldering, the device comprising: an acquisition unit adapted to acquire a to-be-detected image of a to-be-detected PCB board, a little tin color extraction image, and a template image; The matching unit is adapted to perform feature point matching on the to-be-detected image and a template image, so as to perform coordinate correction on the to-be-detected image based on the template image, and obtain a to-be-detected image annotation file; The conversion unit is adapted to convert the to-be-detected image annotation file from an RGB channel to an HSV channel based on a distribution rule of an HSV color space, and obtain an HSV channel image; The first detection unit is adapted to extract a region between adjacent pads from the HSV channel image, and determine whether the PCB board has a short circuit defect according to a color distribution of the region between the adjacent pads; The second detection unit is adapted to compare the HSV channel image with the little tin color extraction image, so as to determine whether each pad of the PCB board has a little tin defect; The third detection unit is adapted to extract a copper color region in each pad region from the HSV channel image, and determine whether each pad of the PCB board has an empty welding defect, a false welding defect or a copper skin defect based on the copper color region in each pad region; The fourth detection unit is adapted to detect whether a pin region with a bright color in the middle and a dark color around the periphery exists in the middle of each pad region in the HSV channel image, so as to determine whether each pad of the PCB board has a kneeling pin defect.

9. A computing device comprising: at least one processor; and a memory having stored program instructions configured to be processed by the at least one processor, the program instructions comprising instructions for processing the method of any one of claims 1-7.

10. A computer program product comprising computer programs / instructions, wherein, The computer program / instructions, when executed by a processor, implement the method of any one of claims 1-7.

11. A readable storage medium having stored program instructions, which, when read and processed by a computing device, cause the computing device to process the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Wave-soldering spot defect detection method and system

    CN113724216A

  • PCB surface welding spot defect detection method and system

    CN115082466A