Circuit board defect detection method and system, storage medium and program product
The circuit board defect detection method using a single camera and multi-source flashing illumination solves the problems of high cost and low efficiency in existing technologies by utilizing shadow geometry parameters and contour feature analysis, and achieves low-cost and high-efficiency circuit board defect detection.
Patent Information
- Application Number
- CN202511604587.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2025-12-05
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies for circuit board defect detection require multiple high-resolution cameras, resulting in high costs and system complexity, and making it difficult to efficiently identify small and irregularly shaped foreign objects.
A flickering illumination method combining a single camera with multiple controllable light sources is employed. By performing differential operations on the shadowless reference image and the shadow-captured image, the geometric parameters of the shadow region are extracted. Combined with signal values and contour feature analysis, defect detection is performed.
It reduces hardware costs, improves detection efficiency and accuracy, effectively identifies small and irregularly shaped foreign objects, optimizes the allocation of detection resources, and enables intelligent detection process management.
Smart Images

Figure CN121068636A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the general field of image data processing, and more particularly to a method, system, storage medium, and program product for detecting defects in circuit boards. Background Technology
[0002] In modern electronics manufacturing, printed circuit board assembly (PCBA) quality inspection is a crucial step in ensuring product reliability. As electronic products trend towards higher density and miniaturization, various defects may occur in PCBAs during production, such as component misalignment, lead warping, and abnormal solder joints. Furthermore, residual protective films, adhesives, and minute foreign objects introduced during manufacturing can also affect product quality.
[0003] In related technologies, a camera array-based stereo vision system is employed. Multiple industrial cameras are deployed at different locations to simultaneously capture images of the PCBA surface from different angles. After acquiring images from multiple perspectives, the system uses a feature matching algorithm to find corresponding points of the same object in different images. Then, utilizing the known camera positional relationships and based on triangulation principles, the three-dimensional coordinates of each point on the object's surface are calculated. This purely visual approach reconstructs the three-dimensional contour of the PCBA surface, enabling defect detection.
[0004] However, the relevant technology requires the simultaneous deployment of multiple high-resolution industrial cameras, resulting in high system costs. Summary of the Invention
[0005] This application provides a method, system, storage medium, and program product for detecting defects in circuit boards, which reduces the cost of defect detection in circuit boards while ensuring detection effectiveness.
[0006] In a first aspect, this application provides a circuit board defect detection method applied to a detection system. The method includes: acquiring a shadowless reference image of a target circuit board; sequentially flashing multiple lighting sources at preset positions and capturing multiple shadow capture images of the target circuit board during the flashing of the lighting sources; performing a difference operation on the shadow capture images and the shadowless reference image to obtain multiple target shadow images; extracting target shadow regions associated with preset detection devices from the multiple target shadow images; calculating the geometric parameters of the target shadow regions; and determining the defect detection result of the preset detection device based on the geometric parameters.
[0007] In the above embodiments, the detection system extracts the geometric parameters of the target shadow area based on the shadowless reference image of the target circuit board and the flashing illumination of multiple preset position lighting sources to perform defect detection. It does not require multiple high-resolution cameras to work at the same time, which reduces hardware costs. By replacing traditional 3D reconstruction with shadow geometric feature analysis, the algorithm complexity is simplified and the detection efficiency is improved.
[0008] In conjunction with some embodiments of the first aspect, in some embodiments, the geometric parameter includes the projected detection length; the step of calculating the geometric parameter of the target shadow area and determining the defect detection result of the preset detection device based on the geometric parameter specifically includes: calculating the projected detection length of the target shadow area according to the projection reference coordinate system; obtaining the reference projected length of the preset detection device from the preset device parameter library; and determining that the preset detection device has a floating height defect when the length difference between the projected detection length and the reference projected length is higher than the preset deviation value.
[0009] In the above embodiments, the detection system establishes a correspondence between device height and shadow geometric features by comparing and analyzing the projected detection length with the reference projected length. When the difference between the projected detection length and the reference value exceeds a preset threshold, it can be directly determined that the device has a floating height defect, thus improving detection efficiency.
[0010] In conjunction with some embodiments of the first aspect, in some embodiments, the step of calculating the geometric parameters of the target shadow region and determining the defect detection result of the preset detection device based on the geometric parameters specifically includes: extracting the signal value of the target shadow image within the reference plane region of the target circuit board; extracting the contour features of the feature region corresponding to the signal value exceeding the background signal threshold; calculating the shape feature value of the feature region based on the contour features, and determining the foreign object detection result based on the shape feature value.
[0011] In the above embodiments, the detection system extracts signal values in the reference plane region, analyzes the contours of feature regions exceeding the background threshold, and identifies foreign objects through shape feature values. This effectively identifies various types of foreign objects, including protective film residues and welding slag, improving the comprehensiveness of the detection. Particularly for the detection of small foreign objects, contour feature analysis can improve detection accuracy.
[0012] In conjunction with some embodiments of the first aspect, in some embodiments, after calculating the shape feature value of the feature region based on the contour feature and determining the foreign object detection result based on the shape feature value, the method further includes: adjusting the spectral parameters of the illumination source to determine the shadow features under different spectral conditions; constructing a feature mapping table of shadow features changing with spectral parameters; matching the feature mapping table with a preset spectral feature template to determine the material type of the foreign object; and generating a foreign object processing scheme based on the material type.
[0013] In the above embodiments, the detection system constructs a mapping relationship between shadow features and spectral parameters by adjusting the spectral parameters of the illumination source, thereby achieving accurate identification of foreign object materials. It can not only detect the presence of foreign objects, but also determine the type of foreign objects, providing a basis for subsequent processing and improving the practicality and intelligence level of the detection.
[0014] In conjunction with some embodiments of the first aspect, in some embodiments, after the step of acquiring the shadowless reference image of the target circuit board, the method further includes: partitioning the shadowless reference image to obtain a device distribution map; identifying the image features of each preset detection device within the device distribution map; and determining preset detection devices whose image features are preset defect types and whose confidence level is greater than a preset confidence threshold as key detection devices.
[0015] In the above embodiments, the detection system performs partitioning processing on the shadowless reference image, identifies the image features of each preset detection device, determines the key detection devices, improves detection efficiency, focuses on monitoring high-risk areas, reduces the false negative rate, and ensures detection quality.
[0016] In conjunction with some embodiments of the first aspect, in some embodiments, after determining a preset detection device whose image features are of a preset defect type and whose confidence level is greater than a preset confidence threshold as a key detection device, the method further includes: acquiring historical defect records of the key detection devices, and determining the defect detection level of the key detection devices based on the defect features in the historical defect records; calculating the regional clustering degree of the key detection devices based on the position coordinates of the key detection devices in the device distribution map, and determining a key detection area when the regional clustering degree exceeds a preset clustering threshold; adjusting the flickering duration of the illumination source within the key detection area according to the defect detection level, and establishing a mapping relationship between the key detection area and the flickering duration; generating a detection control strategy based on the mapping relationship; the detection control strategy includes the triggering order of the illumination source in the key detection area.
[0017] In the above embodiments, the detection system determines the detection level and key detection areas based on historical defect records and location information, optimizes the lighting control strategy, and can adjust the detection parameters according to the actual situation, thereby improving detection efficiency while ensuring detection quality.
[0018] In conjunction with some embodiments of the first aspect, in some embodiments, the step of sequentially flashing multiple lighting sources at preset positions and capturing multiple shadow capture images of the target circuit board during the flashing of the lighting sources specifically includes: acquiring historical detection data of the target circuit board; adjusting the flashing parameters of the lighting sources based on the historical detection data; the flashing parameters include flashing duration and flashing brightness; acquiring multiple frames of shadow images during each flashing of the lighting sources; performing superposition and averaging processing on the multiple frames of shadow images to generate a shadow capture image; and increasing the flashing duration and flashing brightness when the sharpness or contrast index of the shadow capture image is lower than a preset quality threshold, and re-acquiring the shadow capture image.
[0019] In the above embodiments, the detection system adjusts the flicker parameters based on historical data, uses multi-frame superposition averaging to improve image quality, and supplements the acquisition by increasing flicker time and brightness when the image quality is substandard, thus ensuring the reliability and accuracy of the detection data.
[0020] In a second aspect, embodiments of this application provide a detection system comprising: one or more processors and a memory; the memory is coupled to the one or more processors and is used to store computer program code, the computer program code including computer instructions, wherein the one or more processors invoke the computer instructions to cause the detection system to perform the method described in the first aspect and any possible implementation thereof.
[0021] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a detection system, cause the detection system to perform the method described in the first aspect and any possible implementation thereof.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a detection system, cause the detection system to perform the method described in the first aspect and any possible implementation thereof.
[0023] Understandably, the detection system provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the methods provided in the embodiments of this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here.
[0024] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. By employing a detection method based on shadowless reference images and multi-source flashing illumination, the system can acquire the shadow features of the target circuit board under different lighting conditions through the cooperation of a single camera and multiple illumination sources. By comparing the differences between the shadowless reference image and the shadow-captured image, the system can accurately extract the shadow features of the device, effectively solving the problems of high cost and system complexity caused by the simultaneous operation of multiple high-resolution cameras in existing technologies, thereby achieving low-cost and high-efficiency circuit board defect detection.
[0025] 2. By employing a foreign object detection method based on signal values and contour features, the system can accurately extract abnormal signals within the reference plane area and identify foreign objects by analyzing contour features. This method not only analyzes signal intensity but also incorporates shape feature analysis, effectively solving the problem of insufficient sensitivity in detecting small and irregularly shaped foreign objects in existing technologies, thereby achieving high-precision foreign object detection capabilities.
[0026] 3. By employing an intelligent detection method based on image partitioning and key detection, the system can identify potential high-risk areas and key detection devices by analyzing shadowless reference images. This differentiated detection strategy effectively solves the problems of unreasonable allocation of detection resources and low efficiency in existing technologies, thereby achieving intelligent detection process management. Attached Figure Description
[0027] Figure 1 This is a flowchart illustrating a circuit board defect detection method in an embodiment of this application; Figure 2 This is another flowchart illustrating the circuit board defect detection method in this application embodiment; Figure 3 This is a schematic diagram of the physical device structure of the detection system in the embodiments of this application. Detailed Implementation
[0028] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification of this application, the singular expressions “a,” “an,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to any or all possible combinations including one or more of the listed items.
[0029] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0030] It should be noted that this application is particularly effective when processing electronic components with a certain height and volume, and also provides a complete solution for densely arranged components and the detection of different types of components.
[0031] Specifically, taller or larger components on a circuit board (such as electrolytic capacitors and connectors) can be likened to buildings on the ground, while multiple preset lighting sources at different positions (angles) can be likened to the sun at different times. When the light source (sun) shines at a specific angle, the taller components (buildings) will cast clear and considerable shadows. This method efficiently determines whether a component has three-dimensional positional defects such as floating or tilting by accurately calculating the geometric parameters of this shadow (e.g., "projection detection length") and comparing it with the reference shadow length of the component under normal conditions.
[0032] For very flat surface-mount components (such as chip resistors and capacitors), although the shadows cast by their own height are relatively short, this solution can still achieve effective defect detection through optimized configuration of the illumination source and multi-dimensional analysis of shadow characteristics. The "multiple preset illumination sources" in this solution are not arbitrarily set, but can include some lower-angle oblique light sources. Just as the sun at dawn or dusk casts long shadows on tiny objects on the ground, when the detection system identifies a flat component as the target area, it can prioritize the use of these low-angle light sources. This method can transform minute height changes into shadow features that are more pronounced and easier to measure.
[0033] Meanwhile, at the data processing level, the focus of detection can be expanded from simply measuring shadow length to analyzing the "shape feature values" of the shadow. A flat component with a slight tilt or welding defects at the edges will project an irregular shadow contour. By calculating these anomalies in contour features, the system can also accurately identify defects such as slight warping or poor soldering that are difficult to detect with traditional two-dimensional vision.
[0034] Furthermore, the implementation environment of this application addresses the issue of shadow occlusion that may result from the dense arrangement of components on a circuit board by optimizing the manufacturing process. For example, when the shadow of a tall component might cover and interfere with the inspection of a short component next to it, the soldering and inspection process can be adjusted: first, only the short components that might be obscured are soldered and inspected; since the tall component has not yet been installed at this time, no shadow occlusion will occur. Subsequently, the soldering and inspection of the tall component are performed. Through this step-by-step implementation strategy, shadow interference between components is effectively avoided, ensuring the coverage and accuracy of inspection of all critical components on the circuit board.
[0035] To facilitate understanding, the application scenarios of the embodiments of this application are described below.
[0036] The circuit board defect detection method in this application achieves rapid detection of device defects by using a single camera in conjunction with the flickering illumination of multiple controllable light sources. The system replaces the traditional 3D reconstruction process with shadow feature analysis, simplifying the system structure, reducing hardware costs, and improving detection efficiency. An electronics factory deploys an industrial camera and multiple controllable LED light sources at the inspection station. The system first acquires a shadowless reference image, and then captures the shadow features of the device by controlling the flickering of light sources at different positions. Through differential analysis between the shadow image and the reference image, the system can quickly extract the height and orientation information of the device. This approach reduces hardware costs and simplifies the system structure. Especially when detecting the floating height of a device, by analyzing the change in projection length, a quantified height deviation can be directly obtained, greatly improving detection efficiency and accuracy.
[0037] To facilitate understanding, the method provided in this implementation will be described in detail below, using the above scenario as an example. Please refer to [link / reference]. Figure 1 This is a flowchart illustrating a circuit board defect detection method in an embodiment of this application.
[0038] S101. Obtain the shadowless reference image of the target circuit board.
[0039] The target circuit board refers to the circuit board to be tested that needs to be defect-detected, including the soldered printed circuit board assembly (PCBA) and the bare board to be soldered; the shadowless reference image refers to the circuit board image acquired under uniform diffuse illumination conditions that does not contain obvious shadows, and is used as a benchmark for subsequent shadow feature extraction.
[0040] Before initiating the defect detection process, the inspection system first needs to acquire a shadowless reference image as baseline data. Specifically, the system first adjusts the parameters of the diffuse illumination source, including illumination intensity, illumination angle, and spectral range, to ensure that the light uniformly covers the entire circuit board surface. Then, the system acquires images of the circuit board using an industrial camera and performs preprocessing, including noise reduction, illumination compensation, and distortion correction, to obtain a clear reference image without obvious shadows. The system also performs a quality assessment on the reference image to ensure it meets the requirements for subsequent processing.
[0041] In some embodiments, the acquisition of shadowless reference images can be achieved in various ways: Optionally, the detection system can acquire high-quality shadowless reference images through the following steps: First, establish an illumination environment model and analyze the influence of light source position, intensity, and spectral characteristics on imaging quality; then, adjust various parameters through iterative optimization algorithms until the optimal illumination effect is obtained; finally, acquire multiple frames of images and stack them for averaging to improve the image signal-to-noise ratio. Optionally, the detection system can also adopt an adaptive illumination control scheme: First, acquire the CAD data of the circuit board and analyze the device distribution characteristics of each area; then, dynamically adjust the local illumination parameters according to the device characteristics; finally, synthesize a complete shadowless reference image through image stitching technology. It is understood that other methods can also be used to acquire shadowless reference images, such as using deep learning methods for image enhancement and optimization, which are not limited here.
[0042] S102, sequentially flash multiple lighting sources at preset positions, and capture multiple shadow capture images of the target circuit board during the flashing of the lighting sources.
[0043] Among them, the preset position refers to the optimized installation position of the fixed light source, including its height, angle and spatial distribution relative to the target circuit board; the lighting source refers to the independently controllable directional lighting device, including LED point light sources, laser light sources, etc.; flashing refers to the light source switching control process performed according to a predetermined sequence, including the trigger time, duration and light intensity change.
[0044] After acquiring the shadowless reference image, the detection system enters the shadow feature acquisition stage. Specifically, the system first determines the optimal light source triggering sequence based on the size and component distribution characteristics of the target circuit board. Then, according to a preset timing control scheme, it activates the illumination sources at each location one by one. Within the flicker cycle of each light source, the system strictly controls the start-up time, duration, and turn-off time to ensure precise synchronization with the camera's exposure sequence. Simultaneously, the system monitors changes in ambient light and vibration effects in real time, making compensation adjustments as necessary. Finally, the system performs a quality assessment on each shadow image to ensure that the image sharpness and contrast meet the requirements of subsequent analysis. The detection system dynamically adjusts the illumination parameters based on real-time feedback to optimize the image acquisition effect.
[0045] It's important to note that optimizing the angle and position layout of the lighting sources involves finding the optimal solution to an objective function under certain constraints. This process aims to maximize the signal-to-noise ratio of shadow features generated by critical defects (such as float) while minimizing interference caused by the complexity of component layout (such as shadow occlusion). Specifically, this optimization process can be accomplished through simulation calculations based on circuit board CAD data. First, a 3D digital twin model of the inspection system needs to be established, precisely defining the camera position, field of view, and the position of the circuit board plane. Then, the 3D models (including position, height, and outline) of all components on the target circuit board are imported from the CAD file. The optimization objective function F(L) can be designed to comprehensively evaluate the merits of a light source layout L (L represents the set of all light source position and angle parameters). This function should contain at least one gain term and one penalty term: the gain term rewards layouts that produce clear, independent, and sufficiently long shadows for all components under test; the penalty term suppresses poor layouts that cause critical areas to be gloomy, component shadows to overlap, or shadows to be projected onto other components under test.
[0046] By employing optimization algorithms, such as genetic algorithms or simulated annealing, the light source layout L that maximizes the objective function F(L) is searched in all possible physical installation location spaces. This layout is the optimal "preset location".
[0047] For example, suppose we need to optimize the light source layout for a region containing a high-capacitance C1 and a low-profile chip IC2 next to it.
[0048] 1. Model building: In the simulation environment, place the three-dimensional models of C1 (10mm high) and IC2 (1mm high).
[0049] 2. Define the objective function F(L): The objective is to clearly detect the floating height of C1 and the pin of IC2. Where: Gain term: derived from the shadow length S_C1 of C1 and the total sharpness Clarity_IC2 of the tiny shadows produced by all pins of IC2. Therefore, the gain term can be: G = w1 * S_C1 + w2 * Clarity_IC2 (w1 and w2 are weights).
[0050] Penalty: If the shadow of C1 overlaps IC2, a huge penalty value P_overlap will be generated.
[0051] Final function: MaximizeF(L)=G-P_overlap=w1*S_C1+w2*Clarity_IC2-P_overlap.
[0052] 3. Run the optimization algorithm: Iteration 1: The algorithm randomly tries a light source position A, where the light shines from directly behind C1. The result is that C1 produces a very long shadow (S_C1 is very large), but this shadow completely covers IC2, causing the P_overlap value to be extremely large, Clarity_IC2 to be zero, and ultimately the F(L_A) score to be very low.
[0053] Iteration 2: The algorithm tries another light source position B, located at a 45-degree angle to the side and front of C1 and IC2. This position causes the shadow of C1 to be cast onto an empty circuit board area without obstructing IC2 (P_overlap is zero). At the same time, this oblique light also produces a clearly discernible small shadow on the side of the IC2 pin (S_C1 and Clarity_IC2 both have good positive values), resulting in a very high score for F(L_B).
[0054] After several iterations and optimizations, the algorithm will eventually converge to a set of optimal light source layouts, such as position B. This set of layouts will then be fixed as the preset positions for the detection of this type of circuit board.
[0055] In practical applications, the height differences of components on circuit boards are significant, and a single lighting parameter may not be sufficient to capture the ideal shadow characteristics of components of varying heights simultaneously. To address this issue, the inspection system employs a layered lighting strategy: first, the circuit board is divided into different height levels based on CAD data; then, specific lighting parameters are designed for each level, including light source height, illumination angle, and light intensity; for each level, the most suitable flicker timing and exposure parameters are used for image acquisition. For example, for lower surface-mount components, a smaller illumination angle is used to enhance shadow contrast; for taller connectors, a larger illumination angle is used to avoid shadow overlap. The system also considers the reflective characteristics of the components, suppressing the effects of specular reflection by adjusting the light source parameters. This layered lighting scheme can adapt to the inspection needs of components of different heights, providing reliable shadow feature data.
[0056] S103. Perform a difference operation on the shadow capture image and the shadowless reference image to obtain multiple target shadow images.
[0057] Among them, the difference operation refers to pixel-level subtraction and post-processing of two images; the target shadow image represents the pure shadow feature image obtained after the difference operation, which only contains the shadow information generated by the device under specific lighting conditions.
[0058] After acquiring shadow capture images for all light source locations, the detection system needs to extract clean shadow feature information. Specifically, the system first registers the shadow capture images with the shadowless reference image to ensure precise spatial correspondence. Then, it performs image preprocessing, including illumination non-uniformity correction, noise filtering, and grayscale normalization. Next, it performs pixel-level difference calculations to obtain initial difference results. Then, it applies an adaptive threshold segmentation algorithm to extract the shadow regions. Finally, it optimizes the shadow contours through morphological operations, removing fine noise and broken connections to generate a clear target shadow image. The system performs the same processing flow for the shadow capture images at each light source location, ultimately obtaining a complete set of target shadow images.
[0059] In some embodiments, image differencing and shadow extraction can be implemented in various ways: Optionally, the detection system can employ a multi-scale differencing analysis scheme, first constructing an image pyramid structure and performing differencing operations at different resolution levels; then, shadow features are identified through scale-space analysis; finally, the analysis results at each scale are fused to obtain a more accurate shadow contour. Optionally, the detection system can also employ a background modeling-based differencing scheme, first establishing a background model of the circuit board surface, combining material and texture features; then, statistical methods are used to separate foreground shadows and background regions; finally, a region growing algorithm is used to optimize the shadow boundary. It is understood that other methods can also be used to implement differencing operations and shadow extraction, such as feature enhancement methods based on frequency domain analysis, which are not limited here.
[0060] In real-world production environments, surface reflections and insufficient local contrast on circuit boards can lead to artifacts or missing shadow information in the differential results. To address this issue, the detection system employs an adaptive differential enhancement scheme: first, it performs region analysis on the image to identify potentially problematic areas; then, it uses different differential strategies for different types of problem areas, such as using a nonlinear differential algorithm to suppress highlight effects in reflective areas and employing local contrast enhancement for low-contrast areas; finally, it ensures the accuracy of the differential results through adaptive parameter adjustments. For example, a higher differential threshold is used in metal pad areas to suppress reflective interference, while a lower threshold is used in plastic encapsulation areas to retain subtle shadow information. This adaptive scheme effectively handles shadow extraction problems under various complex surface conditions.
[0061] S104. Extract the target shadow region associated with the preset detection device from multiple target shadow images.
[0062] Among them, the preset detection device refers to the electronic component that needs to be defect-detected, including its basic information such as location, size, and type; the target shadow area refers to the shadow feature area corresponding to a specific device.
[0063] After obtaining the target shadow image, the detection system needs to establish a correspondence between the shadow features and the actual devices. Specifically, the detection system first imports the device layout data of the circuit board and establishes a position index for the preset detection devices; then, it locates the region of interest in each target shadow image, which covers the projection range of the preset detection device and its surrounding area; next, it performs adaptive segmentation on the located region to identify the shadow boundary and internal structure; then, it verifies the matching degree between the shadow region and the preset device through morphological feature analysis; finally, it marks the shadow regions that meet the conditions as target regions and records their association information with the corresponding devices. The system performs the same processing flow for each preset detection device to ensure that all devices that need to be detected can find their corresponding shadow feature regions.
[0064] In some embodiments, shadow region extraction and association can be achieved in various ways: Optionally, the detection system can employ a template matching-based extraction scheme. First, a standard shadow template library is established based on the device type; then, regions similar to the templates are searched in the target shadow image; finally, the best matching region is determined through similarity scoring, establishing a correspondence between the device and the shadow. Optionally, the detection system can also employ a region growing algorithm for extraction. First, seed points are determined at preset device locations; then, the region is gradually expanded based on shadow grayscale values and gradient information; finally, the complete target shadow region is obtained through boundary optimization. It is understood that other methods can also be used to extract shadow regions, such as semantic segmentation methods based on deep learning, which are not limited here.
[0065] S105. Calculate the geometric parameters of the target shaded area, and determine the defect detection result of the preset detection device based on the geometric parameters.
[0066] Among them, geometric parameters represent quantitative indicators describing the morphological characteristics of the shadow area, including key features such as area, perimeter, aspect ratio, and projected length; defect detection results represent the evaluation of the device's installation status, including the determination of defects such as floating height, offset, and missing parts.
[0067] After extracting the shadowed area, the detection system enters the defect judgment stage. Specifically, the system first performs boundary tracking on the target shadowed area to extract complete contour information; then it calculates basic geometric features, including parameters such as area moment, moment of inertia, and directionality; next, it compares the calculated feature values with a standard parameter library to assess the degree of deviation; then, it performs a comprehensive analysis of each feature parameter according to preset judgment rules; finally, it generates a defect detection result report, including defect type, location information, and reliability assessment. The system will classify the detection results, marking results with low confidence levels as items requiring re-inspection.
[0068] In some embodiments, geometric parameter analysis and defect determination can be achieved in various ways: Optionally, the detection system can employ a statistical model analysis scheme, first establishing a parameter distribution model of a large number of normal samples; then calculating the Mahalanobis distance of the sample to be tested; and finally determining whether an anomaly exists through a probability threshold. Optionally, the detection system can also employ a multi-feature fusion scheme, first extracting multi-dimensional geometric feature vectors; then performing feature space mapping through classifiers such as support vector machines; and finally outputting classification results and confidence scores. It is understood that other methods can also be used to achieve defect detection, such as fuzzy logic-based reasoning methods, which are not limited here.
[0069] In actual production, manufacturing tolerances and installation errors inherent in the components can cause fluctuations in geometric parameters, affecting detection accuracy. To address this issue, the detection system employs an adaptive threshold adjustment scheme: first, a normal distribution model of component characteristics is established through historical data analysis; then, the judgment threshold is dynamically adjusted based on product batches and process parameters; and differentiated judgment standards are used for different types of components. For example, a relatively lenient angular deviation threshold is used for large-size components, while a stricter positional deviation standard is applied to precision components. The system also considers the influence of environmental factors, such as dimensional drift caused by temperature changes, and uses compensation algorithms to ensure detection stability. This adaptive scheme balances detection accuracy and production efficiency, improving the practicality of defect detection.
[0070] The following provides a more detailed description of the process of the method provided in this implementation. Please refer to [link / reference]. Figure 2 This is another flowchart illustrating the circuit board defect detection method in this application.
[0071] S201. Obtain the shadowless reference image of the target circuit board.
[0072] Referring to step S101, the detection system will acquire a reference image of the target circuit board under uniform lighting conditions.
[0073] S202. Partition the shadowless reference image to obtain the device distribution map.
[0074] Among them, partitioning refers to the process of dividing the entire image into multiple sub-regions according to specific rules; device distribution map refers to a feature map that reflects the spatial distribution of electronic components.
[0075] After acquiring the shadowless reference image, the detection system needs to perform regional analysis. Specifically, the detection system first preprocesses and enhances the image to improve the contrast between regions; then, it uses a multi-scale segmentation algorithm to perform preliminary partitioning based on the image's grayscale and texture features; next, it merges the segmented regions, combining similar regions into larger semantic units; then, it extracts feature descriptors for each region, including grayscale statistics, shape features, and spatial relationships; finally, it generates a feature map reflecting the spatial distribution of the device for subsequent device identification and localization.
[0076] S203. Identify the image features of each preset detection device within the device distribution map.
[0077] Among them, the preset detection device refers to the predefined list of electronic components that need to be feature extracted; the image feature refers to the set of appearance features of the device, including feature parameters such as shape, size, texture and topology; the feature extraction process includes operations such as feature point detection, feature vector calculation and feature matching.
[0078] After obtaining the device distribution map, the detection system needs to extract feature information for each device region. Specifically, the system first loads a pre-defined feature template library containing standard feature descriptions for various devices; then, it performs feature point detection on each region, extracting local invariant features such as SIFT and SURF; next, it calculates the global features of the region, including shape descriptors, Hough features, and moment features; then, it matches the extracted features with the template library and calculates a similarity score; finally, it determines the device type based on the matching results and records its feature parameters. The system performs a reliability assessment of the recognition results and performs secondary verification for results with low confidence.
[0079] In some embodiments, device feature recognition can be achieved in multiple ways: Optionally, the detection system can employ a hierarchical feature extraction scheme, first performing coarse-grained shape matching to determine the major device categories; then extracting fine-grained local features for precise classification; and finally integrating the judgment results of multiple features through a voting mechanism. Optionally, the detection system can also employ a deep feature learning scheme, first using a pre-trained feature extraction network to obtain deep feature representations; then adapting to the specific device recognition task through transfer learning; and finally establishing a mapping relationship between features and device types. It is understood that other methods can also be used to achieve feature recognition, such as structured analysis methods based on graph grammar, which are not limited here.
[0080] S204. Pre-defined detection devices whose image features are of the preset defect type and whose confidence level is greater than the preset confidence threshold are identified as key detection devices.
[0081] Among them, the preset defect type represents the various possible device defect modes predefined by the system; the confidence level represents the reliability evaluation index of the feature matching results; the preset confidence threshold represents the judgment criteria used to screen high-reliability test results; and the key test devices represent high-risk devices that need to be tested in depth.
[0082] After completing device feature identification, the detection system enters the key device screening stage. Specifically, the system first loads a pre-set defect type library, containing feature descriptions and judgment rules for various typical defects; then, it calculates the matching degree between the features and defect patterns of each device to obtain preliminary risk assessment results; next, it calculates the confidence level of the matching results to determine the stability of features and the impact of environmental factors; then, it compares the confidence level with a pre-set threshold to screen out potential defects with high confidence; finally, devices that meet the criteria are marked as key inspection targets and allocated more inspection resources to them. The system dynamically adjusts the confidence threshold according to product quality requirements to achieve a balance between detection accuracy and efficiency.
[0083] In actual production, defect characteristics may vary between different batches of products, and fixed judgment criteria may lead to missed or false detections. To address this issue, the detection system employs a dynamic threshold optimization scheme: first, a statistical distribution model of defect characteristics is established to analyze the range of characteristic fluctuations; then, the confidence calculation model is updated based on recent detection data; and differentiated judgment criteria are used for different types of defects. For example, a higher confidence threshold is used for geometric defects such as component misalignment, while a more flexible judgment standard is used for material defects such as welding quality. The system also determines the stability of the production process, appropriately lowering the threshold to improve detection sensitivity when process fluctuations are significant. This adaptive scheme improves the system's practicality while ensuring detection reliability.
[0084] In some embodiments, the detection system optimizes the detection strategy based on historical defect data. Specifically, the detection system acquires historical defect records of key detection devices and determines the defect detection level of the key detection devices based on the defect characteristics in the historical defect records. Based on the location coordinates of the key detection devices in the device distribution map, the system calculates the regional clustering degree of the key detection devices and determines the key detection area when the regional clustering degree exceeds a preset clustering threshold. Within the key detection area, the system adjusts the flickering duration of the illumination source according to the defect detection level and establishes a mapping relationship between the key detection area and the flickering duration. A detection control strategy is generated based on the mapping relationship. This detection control strategy includes the triggering order of the illumination source in the key detection area.
[0085] Among them, historical defect records represent quality problem data found in previous inspections of this type of device; defect detection level represents the inspection priority and intensity determined based on historical data; regional clustering degree refers to the density of key inspection devices in spatial distribution; preset clustering threshold represents the density standard used to determine high-risk areas; key inspection area represents the local area that needs to be monitored more closely; flicker duration represents the length of time the light source is turned on; and detection control strategy represents the optimized lighting sequence and parameter configuration.
[0086] After identifying key inspection devices, the detection system enters the intelligent inspection strategy generation stage. Specifically, the system first analyzes the historical defect database to statistically analyze the frequency and severity of various defects. Then, based on the statistical results, it assigns an inspection level to each key inspection device, with high-risk devices receiving higher inspection priority. Next, it calculates the spatial distribution characteristics of the devices to identify densely populated areas. Following this, based on the area characteristics and inspection level, it dynamically plans lighting parameters, including light source selection, triggering sequence, and duration. Finally, it generates a complete inspection control scheme to ensure the rational allocation of inspection resources. The detection system monitors the inspection results in real time and dynamically adjusts the control strategy accordingly.
[0087] It should be noted that the calculation of regional clustering degree utilizes spatial point pattern analysis to quantify the distribution density of key inspection devices in physical space, thereby identifying hotspot areas with high defect incidence. One feasible calculation method is based on kernel density estimation (KDE). First, the system abstracts each component identified as a key inspection device into its centroid coordinates (x_i, y_i). Then, using each pixel or grid point (x, y) in the image as the center, its clustering degree value is calculated. The clustering degree D(x, y) of this point is the sum of the "contributions" of all key inspection devices to it, and its calculation formula is: D(x, y) = ΣK((x-x_i) / h, (y-y_i) / h), where the summation symbol Σ iterates over all key detection devices i. K is the kernel function (e.g., a Gaussian kernel), and h is the bandwidth parameter, which determines the size of the neighborhood affected by each key device and can be set according to the average device spacing on the circuit board. This formula represents the density value of a point (x, y), which is the sum of the density contributions of all surrounding key detection devices; the closer the device, the greater its contribution. After calculation, a density map with the same size as the original image is obtained. The system only needs to apply a preset aggregation threshold to this density map (e.g., a density value higher than 3 times the average density value) to segment the regions above the threshold, and these regions are identified as key detection areas.
[0088] For example, on a circuit board, the system identifies five key detection devices with center coordinates P1 (10, 10), P2 (12, 15), P3 (80, 80), P4 (82, 78), and P5 (85, 83). The bandwidth h is set to 10 pixels. When calculating the density of point A (11, 12), P1 and P2, being close together, contribute significantly through the Gaussian kernel function, while P3, P4, and P5, being far apart, contribute almost nothing, resulting in a high density value for point A. Conversely, when calculating the density of point B (45, 45), its density is low due to its distance from all five points. When calculating near point C (81, 80), the density is also high because P3, P4, and P5 are close together. The resulting density map will show two highlighted areas near (10, 10) and (80, 80). If the preset aggregation threshold is a specific value, and the density values of these two regions both exceed the threshold, then the system will mark these two regions as key detection areas and apply more stringent or time-consuming parameter settings for detection in these areas.
[0089] In practical applications, there may be conflicts between production line cycle time requirements and inspection quality requirements; simply increasing inspection time can negatively impact production efficiency. To address this issue, the inspection system employs a tiered inspection strategy: first, components are classified into risk levels, and different levels of inspection parameter requirements are determined; then, within the time budget, inspection resource allocation is optimized, with higher-risk areas using more detailed inspection parameters; for components in adjacent areas, the system coordinates lighting sequences to reuse inspection resources. For example, when multiple high-risk components are concentrated in one area, the system designs overlapping lighting areas, allowing for simultaneous acquisition of information from multiple components with a single illumination, improving efficiency while ensuring inspection quality.
[0090] S205. Flash multiple lighting sources at preset positions sequentially, and capture multiple shadow capture images of the target circuit board during the flashing of the lighting sources.
[0091] Referring to step S102, the detection system will trigger each light source one by one to collect shadows according to the preset lighting sequence.
[0092] In some embodiments, the detection system dynamically adjusts the acquisition parameters according to the image quality. That is, the detection system acquires historical detection data of the target circuit board and adjusts the flicker parameters of the lighting source based on the historical detection data. The flicker parameters include flicker duration and flicker brightness. During each lighting source flicker, multiple frames of shadow images are acquired, and the multiple frames of shadow images are superimposed and averaged to generate a shadow capture image. When the sharpness or contrast index of the shadow capture image is lower than a preset quality threshold, the flicker duration and flicker brightness are increased, and the shadow capture image is reacquired.
[0093] Among them, historical test data represents the parameter configuration and effect evaluation information accumulated by the circuit board in previous test processes; flicker parameters represent the set of timing characteristic parameters controlling the light source switch; and multi-frame shadow images represent the image sequence continuously acquired under the same lighting conditions.
[0094] Before executing a detection task, the detection system needs to perform parameter optimization and quality control. Specifically, the system first analyzes historical detection data and extracts parameter configuration patterns from successful cases; then, based on statistical analysis results, it initially sets the flicker duration and brightness parameters; next, it acquires a preset number of consecutive images within each light source trigger cycle; then, it registers and weights these images to generate a high-quality composite image; finally, it evaluates the quality of the composite image, including indicators such as edge sharpness, contrast, and signal-to-noise ratio. When the quality is substandard, the detection system automatically increases the exposure parameters to ensure reliable detection data.
[0095] In some embodiments, image quality optimization can be achieved in several ways: Optionally, the detection system can employ an adaptive exposure control scheme, first determining the initial exposure parameters through trial shots; then dynamically adjusting the light source parameters based on image histogram analysis; and finally achieving the best imaging effect through iterative optimization. Optionally, the detection system can also employ an intelligent image enhancement scheme, first performing motion compensation on multiple frames of images; then using a deep learning model for image reconstruction; and finally verifying the enhancement effect through a quality evaluation module. It is understood that other methods can also be used to achieve image quality optimization, such as frequency domain enhancement methods based on Fourier analysis, which are not limited here.
[0096] S206. Perform a difference operation on the shadow capture image and the shadowless reference image to obtain multiple target shadow images.
[0097] Referring to step S103, the detection system will extract pure shadow features through image processing algorithms.
[0098] S207. Extract the target shadow region associated with the preset detection device from multiple target shadow images.
[0099] Referring to step S104, the detection system will locate and segment the shadow areas corresponding to each device to be detected.
[0100] S208. Extract the signal value of the target shadow image within the reference plane area of the target circuit board.
[0101] Among them, the reference plane region represents a flat reference area on the circuit board that is not covered by any components; the signal value represents the gray intensity or color information of the pixels in the image; the signal features of the target shadow image include gray distribution, local contrast and gradient information.
[0102] After acquiring the target shadow image, the detection system needs to perform baseline signal analysis. Specifically, the system first identifies baseline planar regions on the circuit board, which are typically bare board surfaces without any components. Then, the identified regions are preprocessed, including noise suppression and illumination compensation. Next, uniform sampling is performed within the baseline regions to obtain the signal statistical characteristics of the local areas. Afterward, a regional signal distribution model is established, and statistical quantities such as mean and variance are calculated. Finally, the extracted signal features are used as a reference baseline for subsequent foreign object detection. The system evaluates the effectiveness of the baseline regions and eliminates areas that may be affected by interference.
[0103] In some embodiments, reference signal extraction can be achieved in multiple ways: Optionally, the detection system can employ an adaptive sampling scheme, first dividing the reference region into grids; then adjusting the sampling density according to local signal changes; and finally constructing a complete signal distribution map through an interpolation algorithm. Optionally, the detection system can also employ a multi-scale analysis scheme, first extracting signal features at different spatial scales; then eliminating the influence of local noise through scale fusion; and finally obtaining a stable reference signal representation. It is understood that other methods can also be used to achieve signal extraction, such as filtering methods based on frequency domain analysis, which are not limited here.
[0104] In practical applications, the reference plane area may exhibit localized reflections or texture variations, affecting the accuracy of signal extraction. To address this issue, the detection system employs a region-adaptive processing scheme: first, the reference area is segmented for analysis, and the signal stability of each sub-region is evaluated; then, different signal extraction strategies are applied to regions with different characteristics, such as using nonlinear mapping to suppress specular highlights in reflective areas and local mean filtering for textured areas; the system also analyzes the impact of ambient light changes and ensures signal extraction stability through real-time correction. For example, when an anomaly is detected in a localized area, the system automatically expands the sampling range or switches to a backup reference area to ensure a reliable reference signal is obtained. This adaptive scheme effectively handles various complex surface conditions and improves the reliability of signal extraction.
[0105] S209. Extract the contour features of the feature regions whose signal values exceed the background signal threshold.
[0106] Among them, the background signal threshold represents the judgment criterion used to distinguish between normal and abnormal regions; the feature region represents the suspicious region with abnormal signal values; and the contour feature represents the geometric description of the region boundary, including the boundary point set, shape parameters, and topological structure.
[0107] After obtaining the baseline signal, the detection system enters the anomaly region identification stage. Specifically, the system first establishes a dynamic threshold model based on the signal statistical characteristics of the baseline region; then, it scans the entire image and marks anomalies exceeding the threshold; next, it performs connected component analysis on the anomalies to form preliminary feature regions; then, it applies a boundary tracking algorithm to extract the complete contour of the region; finally, it calculates the geometric features of the contour, including parameters such as perimeter, area, and roundness. The system smooths the extracted contour to remove subtle fluctuations caused by noise.
[0108] In practical detection, the boundaries of abnormal regions may be blurred or broken, making contour extraction difficult. To address this issue, the detection system employs a robust contour extraction scheme: first, local image enhancement is performed to improve boundary contrast; then, adaptive thresholding is used to determine local background variations; for regions with unclear boundaries, the system uses a probabilistic boundary model, determining the most likely boundary location through multiple samplings. For example, when encountering gradient boundaries, the system combines gradient information and region growing algorithms to gradually refine the contour description. The system also saves contour confidence information, providing a reliable reference for subsequent shape analysis. This scheme can extract stable contour features against complex backgrounds, providing reliable shape information for foreign object detection.
[0109] S210. Calculate the shape feature value of the feature region based on the contour features, and determine the foreign object detection result based on the shape feature value.
[0110] Among them, shape feature values represent numerical indicators that quantitatively describe the geometric shape of the feature region, including area ratio, perimeter ratio, eccentricity, etc.
[0111] After obtaining the contour features, the detection system proceeds to the final foreign object determination stage. Specifically, the system first calculates standardized shape feature values to eliminate the influence of size variations; then, it matches these feature values with a pre-defined foreign object feature model to assess shape similarity; next, it combines multiple feature parameters for comprehensive scoring to determine advanced features such as shape regularity and symmetry; then, based on the scoring results and determination rules, it identifies the foreign object type; finally, it generates a detection report including the foreign object's location, type, and reliability assessment. The system performs tiered processing of the detection results to ensure that critical defects are addressed promptly.
[0112] It should be noted that the calculation of shape feature values and the identification of foreign objects are achieved by quantifying the geometric morphology of the abnormal region to distinguish different types of foreign objects or artifacts. After extracting the contour of the feature region, the system calculates a series of shape descriptors with scale, translation, and rotation invariance or partial invariance. For example, a key feature value is compactness, calculated using the formula C = 4πA / P. 2Where A is the area of the feature region (obtained by calculating the total number of pixels within the region), and P is its perimeter (obtained by calculating the number of pixels or connection length on the contour line). The theoretical maximum value of this value is 1 (corresponding to a circle), and the closer it is to 1, the more regular and circular the shape. Another commonly used feature value is elongation, which can be obtained by calculating the second central moment of the region to obtain its smallest circumscribed ellipse, and then calculating the ratio of the major axis to the minor axis of the ellipse. This value is greater than 1, and the larger the value, the more slender the shape. The system pre-sets standard ranges for these shape feature values for different types of foreign objects (such as nearly circular solder balls, long and thin fibrous debris, and irregularly shaped pieces of glue residue). During detection, the system calculates a set of feature values such as compactness and elongation of the region to be tested, and then compares this feature vector with various preset foreign object templates, such as by calculating Euclidean distance or using a multi-feature classifier such as Support Vector Machine (SVM), and finally classifies the region as a specific type of foreign object or as normal background.
[0113] For example, the system detects an abnormal area on the reference plane of a circuit board. After extracting the contour, its area A = 78 pixels and perimeter P = 32 pixels are calculated. Its compactness C = 4 * 3.14159 * 78 / (32 * 32) ≈ 0.95. This value is very close to 1. At the same time, the calculated elongation is approximately 1.1. In the foreign object feature library, the feature template for "solder ball" is defined as a compactness between [0.9, 1.0] and an elongation between [1.0, 1.2]. Since the calculated feature value falls entirely within this range, the system will determine that the foreign object is a "solder ball". In contrast, if another area is detected with a compactness of 0.2 and an elongation of 8.5, this will highly match the feature template for "fiber" (e.g., compactness [0.1, 0.3], elongation [7.0, 10.0]), thus making a corresponding determination.
[0114] In real-world production environments, the shape and size of foreign objects can vary significantly, making it difficult to apply a single criterion to all situations. To address this issue, the detection system employs an adaptive foreign object identification scheme: first, it establishes a probability distribution model of the foreign object's shape characteristics, considering a reasonable range of shape variation; then, it dynamically adjusts the judgment parameters based on product type and process requirements; and it uses differentiated judgment strategies for different types of foreign objects. For example, for welding residues, the system focuses on analyzing their irregularity and dispersion; for protective film residues, it focuses on the continuity and transparency of their boundaries. The system also continuously optimizes the feature model by incorporating historical data to improve the adaptability of the detection.
[0115] In some embodiments, the detection system utilizes spectral features for foreign object analysis. Specifically, the detection system adjusts the spectral parameters of the illumination source to determine the shadow features under different spectral conditions; constructs a feature mapping table of shadow features varying with spectral parameters; matches the feature mapping table with a preset spectral feature template to determine the material type of the foreign object; and generates a foreign object processing solution based on the material type.
[0116] Among them, spectral parameters represent the characteristics of the lighting source, such as wavelength, bandwidth, and intensity distribution; shadow features represent the shadow morphology and grayscale variation characteristics observed under different spectral conditions; feature mapping table refers to the data structure describing the correspondence between shadow features and spectral parameters; spectral feature template represents the standard response characteristics of different materials under specific spectral conditions; material type refers to the physical composition category of the foreign object; and foreign object handling scheme represents the removal or protection measures formulated based on the material characteristics.
[0117] After identifying the abnormal area, the detection system proceeds to the material analysis stage. Specifically, the system first adjusts the center wavelength and bandwidth parameters of the illumination source sequentially according to a preset spectral scanning sequence. Then, it captures shadow images under each spectral condition, extracting key feature parameters, including transmittance, reflectance, and scattering characteristics. Next, these feature data are organized into a multi-dimensional mapping table, recording the trend of feature changes with the spectrum. The obtained mapping table is then matched with a pre-established material feature library to calculate a similarity score. Finally, based on the matching results, the specific material type of the foreign object is determined, and a corresponding solution is retrieved from the processing solution library. The detection system combines the confidence level of material identification with multiple verifications for cases that are difficult to determine.
[0118] In some embodiments, the detection system determines the device state by shadow geometric features. That is, the detection system calculates the projection detection length of the target shadow area according to the projection reference coordinate system; obtains the reference projection length of the preset detection device from the preset device parameter library; and determines that the preset detection device has a floating height defect when the length difference between the projection detection length and the reference projection length is higher than the preset deviation value.
[0119] Among them, the projection reference coordinate system represents the spatial reference system used to standardize and describe the characteristics of shadow projection; the projection detection length represents the actual projection size of the target shadow area in the reference coordinate system; and the reference projection length refers to the standard projection size of the device under normal installation conditions.
[0120] After extracting the shadow area, the detection system proceeds to the buoyancy defect detection stage. Specifically, the system first establishes a standardized projection reference coordinate system to ensure the consistency of the measurement benchmark. Then, it calculates the projected length of the target shadow area within this coordinate system, determining the projection direction and the accuracy of boundary positioning. Next, it accesses the device parameter library to obtain the standard projection parameters for that device model. Afterward, it calculates the difference between the measured value and the standard value and performs error compensation. Finally, it compares the compensated difference with a preset threshold to determine if a buoyancy defect exists. The detection system dynamically adjusts the judgment threshold based on the device type to ensure detection accuracy.
[0121] It's important to note that establishing the projection reference coordinate system and calculating the projection detection length involves converting the height information of components in the three-dimensional world into a measurable shadow length in a two-dimensional image through illumination at a specific angle. First, a projection reference coordinate system associated with the illumination direction needs to be established. This coordinate system is typically a one-dimensional coordinate axis, with its direction vector parallel to the direction of the light rays projected from the illumination source onto the circuit board plane. This direction can be precisely determined by the physical location of the light source and the camera's position calibration. After obtaining the target shadow image, the system first extracts the set of pixels in the target shadow region using an image segmentation algorithm (such as adaptive thresholding or region growing). Next, to calculate the projection detection length, the system projects the coordinates of all pixels within the shadow region onto this predefined one-dimensional coordinate axis. This projection process is mathematically equivalent to calculating the dot product of the coordinate vector of each shadow pixel and the unit vector of the coordinate system direction. After projecting all points, a series of projection values are obtained, and the system identifies the maximum and minimum values. The distance between these two extreme points, i.e., the difference between the maximum and minimum projection values, is defined as the projection detection length. This length value is initially in pixels. Through pre-calibrated camera calibration (e.g., using a checkerboard calibration board), the conversion ratio between pixels and physical units (such as millimeters) can be obtained, thereby converting the pixel length into a physical length. This length is then compared with the reference projected length of the component stored in the database to determine whether there is a floating height defect.
[0122] Suppose a light source illuminates an electrolytic capacitor with a nominal height of 5mm at a 45-degree angle, and a camera is positioned perpendicular to the circuit board to capture the image. After calibration, it is determined that the projection direction of the light onto the circuit board plane is consistent with the positive X-axis direction of the image; therefore, the projection reference coordinate system is the X-axis of the image. The system extracts the capacitor's shadow area, which consists of a series of pixels (x, y). The system iterates through all these points, focusing only on their x-coordinates. Assume the smallest x-coordinate found is x_min = 150 (pixels), and the largest x-coordinate is x_max = 250 (pixels). Then, the projection detection length (in pixels) is L_pixel = x_max - x_min = 100 pixels. If the camera calibration result indicates that each pixel represents 0.05mm, then the physical projection length is 100 * 0.05 = 5.0mm. If the reference projection length of the capacitor is 4.8mm, and the preset deviation value is 0.3mm, since the length difference |5.0 - 4.8| = 0.2mm is less than 0.3mm, the device is determined to have no floating height defect. Conversely, if the measured length is 5.5mm and the difference is 0.7mm, it is determined to be a floating height defect.
[0123] In actual production, tilted installation of components can lead to abnormal projection lengths, which can be confused with floating defects. To address this issue, the detection system employs a composite feature analysis approach: First, a component attitude model is established to analyze the different effects of tilt and floating on projection features; then, a combination of multiple feature parameters, including projection shape, symmetry, and edge gradient, is used for judgment; for suspected tilting cases, the system initiates an additional attitude detection process to accurately distinguish between tilt and floating through multi-dimensional feature analysis. For example, when an abnormal projection of a component is detected, the system analyzes the deformation characteristics of its projection contour and, combined with light source position information, infers the actual installation state, avoiding misjudgment.
[0124] In this embodiment, by employing a detection method based on shadowless reference images and multi-source flicker illumination, combined with intelligent detection strategy optimization technology, defect detection can be achieved by analyzing the shadow characteristics of devices. Furthermore, detection performance is improved through historical data analysis, spectral feature recognition, and adaptive parameter adjustment. This effectively solves the problems of complex system structure, high hardware cost, low detection efficiency, and poor adaptability in existing technologies, thus realizing a circuit board defect detection solution that is simple in structure, low in cost, highly efficient, and highly intelligent. This solution can not only accurately identify common defects such as device floating and offset, but also identify foreign materials through spectral analysis, optimize detection strategies through historical data, and improve detection quality through adaptive control, providing a comprehensive quality control solution for the electronics manufacturing industry.
[0125] The detection system in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link / reference]. Figure 3This is a schematic diagram of the physical device structure of the detection system in this application embodiment.
[0126] It should be noted that, Figure 3 The structure of the detection system shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0127] like Figure 3 As shown, the detection system includes a CPU 301, which can perform various appropriate actions and processes according to a program stored in ROM 302 or a program loaded from storage section 308 into RAM 303, such as executing the methods described in the above embodiments. RAM 303 also stores various programs and data required for system operation. CPU 301, ROM 302, and RAM 303 are interconnected via bus 304. I / O interface 305 is also connected to bus 304.
[0128] The following components are connected to I / O interface 305: input section 306 including audio input devices, push-button switches, etc.; output section 307 including liquid crystal display (LCD) and audio output devices, indicator lights, etc.; storage section 308 including hard disks, etc.; and communication section 309 including network interface cards such as LAN (Local Area Network) cards, modems, etc. Communication section 309 performs communication processing via a network such as the Internet. Drive 310 is also connected to I / O interface 305 as needed. Removable media 311, such as disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on drive 310 as needed so that computer programs read from them can be installed into storage section 308 as needed.
[0129] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by CPU 301, it performs the various functions defined in the present invention.
[0130] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.
[0131] Specifically, the detection system in this embodiment includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the circuit board defect detection method provided in the above embodiment.
[0132] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the detection system described in the above embodiments; or it may exist independently and not assembled into the detection system. The storage medium carries one or more computer programs that, when executed by a processor of the detection system, cause the detection system to implement the circuit board defect detection method provided in the above embodiments.
[0133] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0134] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
Claims
1. A method of detecting defects in a circuit board, characterized by, The method is applied to a detection system, and the method comprises: obtaining a shadow-free reference image of a target circuit board; sequentially flashing illumination light sources at a plurality of preset positions, and capturing a plurality of shadow capture images of the target circuit board during the flashing of the illumination light sources; performing difference operation on the shadow capture images and the shadow-free reference image to obtain a plurality of target shadow images; extracting a target shadow area associated with a preset detection device from the plurality of target shadow images; calculating a geometric parameter of the target shadow area, and determining a defect detection result of the preset detection device according to the geometric parameter.
2. The method of claim 1, wherein, The geometric parameter comprises a projection detection length; the step of calculating the geometric parameter of the target shadow area and determining the defect detection result of the preset detection device according to the geometric parameter specifically comprises: calculating the projection detection length of the target shadow area according to a projection reference coordinate system; obtaining a reference projection length of the preset detection device from a preset device parameter library; when a length difference between the projection detection length and the reference projection length is higher than a preset deviation value, determining that the preset detection device has a floating defect.
3. The method of claim 1, wherein, The step of calculating the geometric parameter of the target shadow area and determining the defect detection result of the preset detection device according to the geometric parameter specifically comprises: extracting a signal value of the target shadow image in a reference plane area of the target circuit board; extracting a contour feature of a feature area corresponding to a signal value exceeding a background signal threshold value; calculating a shape feature value of the feature area according to the contour feature, and determining a foreign matter detection result based on the shape feature value.
4. The method of claim 3, wherein, After the step of calculating the shape feature value of the feature area according to the contour feature and determining the foreign matter detection result based on the shape feature value, the method further comprises: adjusting a spectral parameter of the illumination light source to determine a shadow feature under different spectral conditions; constructing a feature mapping table of the shadow feature changing with the spectral parameter; matching the feature mapping table with a preset spectral feature template to obtain a material type of the foreign matter; generating a foreign matter processing scheme based on the material type.
5. The method of claim 1, wherein, After the step of obtaining the shadow-free reference image of the target circuit board, the method further comprises: performing partition processing on the shadow-free reference image to obtain a device distribution map; identifying an image feature of each preset detection device in the device distribution map; determining a preset detection device whose image feature is of a preset defect type and whose confidence degree is greater than a preset confidence threshold value as a key detection device.
6. The method of claim 5, wherein, After the step of determining the preset detection device whose image feature is of the preset defect type and whose confidence degree is greater than the preset confidence threshold value as the key detection device, the method further comprises: obtaining a historical defect record of the key detection device, and determining a defect detection level of the key detection device according to a defect feature in the historical defect record; calculating an area aggregation degree of the key detection device according to a position coordinate of the key detection device in the device distribution map, and determining a key detection area when the area aggregation degree exceeds a preset aggregation threshold value; In the focus detection area, the flashing duration of the illumination light source is adjusted according to the defect detection level, and a mapping relationship between the focus detection area and the flashing duration is established; A detection control strategy is generated according to the mapping relationship; the detection control strategy includes the triggering order of the illumination light source of the focus detection area.
7. The method of claim 1, wherein, The step of flashing the illumination light source of each preset position in turn and capturing a plurality of shadow capture images of the target circuit board during the flashing of the illumination light source specifically includes: Obtaining historical detection data of the target circuit board, and adjusting the flashing parameters of the illumination light source based on the historical detection data; the flashing parameters include flashing duration and flashing brightness; During the flashing of each illumination light source, a plurality of shadow images are collected, and the plurality of shadow images are superimposed and averaged to generate a shadow capture image; When the clarity or contrast index of the shadow capture image is lower than a preset quality threshold, the flashing duration and the flashing brightness are increased, and the shadow capture image is re-collected.
8. A detection system characterized by, The detection system includes one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors invoke the computer instructions to enable the detection system to perform the method of any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instructions run on the detection system, the detection system performs the method of any one of claims 1-7.
10. A computer program product, characterised in that, When the computer program product runs on the detection system, the detection system performs the method of any one of claims 1-7.