Computer vision defect detection system and method on electric control board production line
By using multi-angle image partitioning and feature enhancement processing, combined with lighting and viewing angle information, the problem of defect identification caused by sample imbalance on the electronic control board production line was solved, enabling early identification and reliable detection of rare defects and reducing the risk of rework.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NINGBO SHUNHE ELECTRONIC TECH CO LTD
- Filing Date
- 2025-09-10
- Publication Date
- 2026-06-23
AI Technical Summary
Existing electronic control board production line defect detection systems struggle to identify rare, early-stage critical hidden defects due to unbalanced training samples, leading to increased rework risks.
By acquiring multi-angle images and combining lighting conditions and viewing angle information, the overall area of the electronic control board is divided into partitions to generate images of the surface area, solder joint area, and trace area. Image block processing is performed to extract texture, brightness, and geometric edge features. Rare defect feature enhancement processing is performed, and difference comparison and multi-angle reproducibility analysis are conducted to generate reliable defect areas.
It improves the ability to detect rare defects, reduces interference from environmental factors, ensures the stability and reliability of test results, and provides high-quality defect location and rework support.
Smart Images

Figure CN121120584B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a computer vision defect detection system and method for electronic control board production lines. Background Technology
[0002] In existing technologies, defect detection on electronic control board (ECB) production lines typically employs automated inspection methods based on machine vision. These methods utilize industrial cameras to acquire images of the ECB surface and then analyze component soldering positions, pin morphology, and circuit traces using image processing or deep learning algorithms to determine the presence of defects such as cold solder joints, misalignments, and cracks. Compared to manual inspection, these methods offer significant advantages in inspection speed and consistency. In particular, convolutional neural network-based solutions demonstrate higher robustness when identifying complex surface features and are increasingly being applied to large-scale production lines.
[0003] However, in specific production scenarios, the aforementioned existing technologies still have shortcomings. For example, deep learning detection methods typically require large-scale defect sample data for training. However, in actual production, it is often difficult to collect enough samples for certain critical defects (such as hidden delamination cracks inside multi-layer control boards, or tiny solder joint voids that only gradually appear after high-temperature reflow soldering) in the early stages, leading to sample imbalance in model training. In practical applications, this may manifest as the system having high accuracy in detecting common surface defects, but difficulty in timely identifying rare, early-stage critical hidden defects. For example, when a void-induced loose solder joint is only exposed during the functional testing phase of the control board, the front-end visual inspection system may completely fail to identify it, thereby increasing the risk of rework and the burden on the testing phase. Summary of the Invention
[0004] The purpose of this invention is to provide a computer vision defect detection system and method for electronic control board production lines, aiming to solve the problems mentioned in the background art.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0006] A first aspect is a computer vision defect detection method for electronic control board production lines, the method comprising:
[0007] Based on the multi-angle images of the electronic control board collected at the production line station, combined with lighting conditions and viewing angle information, the overall area of the electronic control board is divided into zones to form surface area images, solder joint area images, and wiring area images.
[0008] Based on the surface area image, solder joint area image, and trace area image, image block processing is performed to generate multiple image sub-regions. Texture features, brightness distribution features, and geometric edge features are extracted within each image sub-region to form sub-region combination features.
[0009] Based on the sub-region combination characteristics, rare defect feature enhancement processing is performed, low-frequency abnormal textures are repeatedly superimposed at multiple scales, and directional extension is performed at edge breaks to obtain a defect enhancement feature map.
[0010] Based on the combination features of the defect enhancement feature map and the corresponding normal region, a difference comparison is performed, and normalization correction is performed in combination with lighting conditions and viewing angle information to obtain a set of candidate defect regions.
[0011] Based on the set of candidate defect regions, perform multi-angle reproducibility analysis. If the same suspected defect is detected from different angles, a reliable defect region is formed; otherwise, the interfering region is removed, and the electronic control board defect detection result is generated.
[0012] Secondly, a computer vision defect detection system for the electronic control board production line, the system comprising:
[0013] The image acquisition module is used to divide the entire area of the electronic control board into areas such as surface area, solder joint area, and wiring area based on multi-angle images acquired by the electronic control board at the production line station, combined with lighting conditions and viewing angle information.
[0014] The feature extraction module is used to perform image block processing based on the surface area image, solder joint area image and trace area image, generate multiple image sub-regions, and extract texture features, brightness distribution features and geometric edge features in each image sub-region to form sub-region combination features;
[0015] The feature enhancement module is used to perform rare defect feature enhancement processing based on the combined features of sub-regions, perform multi-scale repeated superposition of low-frequency abnormal textures, and perform directional extension of edge breaks to obtain a defect enhancement feature map.
[0016] The difference comparison module is used to perform difference comparison based on the combination features of the defect enhancement feature map and the corresponding normal region, and to perform normalization correction in combination with lighting conditions and viewing angle information to obtain a set of candidate defect regions.
[0017] The multi-angle analysis module is used to perform multi-angle reproducibility analysis based on the set of candidate defect areas. When the same suspected defect is detected at different angles, a reliable defect area is formed; otherwise, the interfering area is removed, and the electronic control board defect detection results are generated.
[0018] The above-described solution of the present invention has at least the following beneficial effects:
[0019] First, by acquiring multi-angle images of the electronic control board at the production line station, and combining lighting conditions and viewing angle information, the overall area of the electronic control board is divided into zones, forming surface area images, solder joint area images, and trace area images. This allows different functional areas to be processed specifically during the imaging stage. Compared with existing technologies that rely solely on single-angle imaging, this zoning strategy effectively reduces the interference of reflections, local overexposure, or trace blurring on subsequent analysis, thereby enhancing the utilization value of the images from the source.
[0020] Based on obtaining high-quality partitioned images, multiple sub-regions are generated through image block processing. Texture features, brightness distribution features, and geometric edge features are extracted within each sub-region to form sub-region combined features, enabling comprehensive capture of defect signs at a local scale. For example, trace breaks manifest as abrupt changes in grayscale brightness and edge interruptions in geometric features, while surface scratches are mainly reflected in texture anomalies. The combination of these three types of features allows the system to not only detect obvious defects but also to detect potential latent anomalies in advance.
[0021] Furthermore, based on the combination of multiple features, rare defect feature enhancement processing is performed on the combined features of sub-regions. Low-frequency abnormal textures are repeatedly superimposed at multiple scales, and edge fractures are directionally extended, thereby amplifying key hidden dangers that are originally difficult to detect. For example, early voids formed inside solder joints are almost invisible under ordinary imaging, but after multi-scale texture superposition, their local grayscale fluctuations are gradually amplified and highlighted in the enhanced image, enabling the system to provide early warning before the defect expands. This processing mechanism overcomes the limitation of existing methods that rely on large-scale defect sample training, and can still maintain the ability to detect rare defects even when the sample is insufficient.
[0022] After obtaining the enhanced feature map of defects, a difference comparison is performed between the enhanced feature map and the combined feature map of normal regions. Normalization correction is then applied using lighting conditions and viewing angle information, effectively eliminating false defects caused by external environmental factors. For example, the grayscale difference of the same weld point under strong and weak light is unified after normalization, allowing the system to focus only on genuine structural anomalies, unaffected by differences in lighting and angle. This process significantly improves the stability and accuracy of the candidate defect region set.
[0023] Finally, by performing multi-angle reproducibility analysis on the candidate defect region set, a suspected defect is confirmed as a reliable defect when it is detected at different angles; otherwise, it is judged as an interference area, thus achieving the final verification of the detection results. For example, false scratches caused by reflection usually only appear in single-angle images and do not persist at multiple angles, so they are automatically rejected; while real solder joint defects or broken traces are stable at multiple angles and can therefore be reliably identified. The resulting electronic control board defect detection results not only include location coordinates, defect type, and image markers, but also have higher reliability, providing direct support for defect location and rework on the production line. Attached Figure Description
[0024] Figure 1 This is a flowchart of a computer vision defect detection method for an electronic control board production line provided by an embodiment of the present invention. Detailed Implementation
[0025] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0026] like Figure 1 As shown, embodiments of the present invention propose a computer vision defect detection method for an electronic control board production line, the method comprising:
[0027] Based on the multi-angle images of the electronic control board collected at the production line station, combined with lighting conditions and viewing angle information, the overall area of the electronic control board is divided into zones to form surface area images, solder joint area images, and wiring area images.
[0028] Based on the surface area image, solder joint area image, and trace area image, image block processing is performed to generate multiple image sub-regions. Texture features, brightness distribution features, and geometric edge features are extracted within each image sub-region to form sub-region combination features.
[0029] Based on the sub-region combination characteristics, rare defect feature enhancement processing is performed, low-frequency abnormal textures are repeatedly superimposed at multiple scales, and directional extension is performed at edge breaks to obtain a defect enhancement feature map.
[0030] Based on the combination features of the defect enhancement feature map and the corresponding normal region, a difference comparison is performed, and normalization correction is performed in combination with lighting conditions and viewing angle information to obtain a set of candidate defect regions.
[0031] Based on the set of candidate defect regions, perform multi-angle reproducibility analysis. If the same suspected defect is detected from different angles, a reliable defect region is formed; otherwise, the interfering region is removed, and the electronic control board defect detection result is generated.
[0032] In this embodiment of the invention, by acquiring multi-angle images of the electronic control board at the production line station, and combining the lighting conditions and viewing angle information, the overall area of the electronic control board is divided into zones to form surface area images, solder joint area images, and wiring area images. This ensures that different structural areas are accurately covered during the imaging process, avoiding feature confusion caused by regional differences, thereby improving the targeting and reliability of the detection.
[0033] Furthermore, based on the surface area image, solder joint area image, and trace area image, image segmentation is performed to generate multiple image sub-regions. Texture features, brightness distribution features, and geometric edge features are extracted within each sub-region to form a combined sub-region feature set, enabling precise capture of local features. For example, when a trace exhibits a minor break, its texture features will manifest as periodic interruptions, its brightness distribution features as abnormal grayscale gradients, and its geometric edge features as discontinuous edges. These three types of features complement each other, enabling more accurate anomaly identification.
[0034] Furthermore, based on the combined features of sub-regions, rare defect feature enhancement processing is performed. Low-frequency anomalous textures are repeatedly superimposed at multiple scales, and edge fractures are directionally extended to obtain a defect enhancement feature map, effectively amplifying the originally weak defect signal. For example, slight scratches on the surface of the electronic control board may be masked by noise at a single scale, but through multi-scale enhancement, the scratches will form obvious linear features in the enhancement map, thereby improving the detection sensitivity.
[0035] Furthermore, based on the combined features of the enhanced feature map of defects and the corresponding normal region, a difference comparison is performed, and normalization correction is applied in conjunction with illumination conditions and viewing angle information to obtain a set of candidate defect regions, thereby reducing the impact of environmental factors on the detection results. Under different illumination conditions, the grayscale values of the same region vary significantly. Without correction, normal regions are easily misclassified as defects. Through normalization processing, image features under different illuminations can be mapped to a unified standard, making the determination of candidate defect regions more stable and reliable.
[0036] Furthermore, based on the candidate defect region set, a multi-angle reproducibility analysis is performed. When the same suspected defect is detected from different angles, a reliable defect region is formed; otherwise, interfering regions are eliminated, ultimately generating the electronic control board defect detection result. This not only identifies real defects but also effectively eliminates false defects caused by reflections, dust, or noise. For example, a bright spot appearing in a frontal image will be considered interference and eliminated if there is no corresponding anomaly in a side image. However, if an abnormal region at the same location can be detected from multiple angles, the anomaly will be confirmed as a reliable defect, and its location coordinates, type label, and image marker will be output, ensuring the practicality and traceability of the detection results.
[0037] Specifically, based on multi-angle images of the electronic control board captured at the production line station, combined with lighting conditions and viewing angle information, the overall area of the electronic control board is divided into zones, forming surface area images, solder joint area images, and trace area images, including:
[0038] As the electronic control board passes through the production line station, multiple camera devices are used to capture images from the front, oblique, and side views to obtain multi-angle image data.
[0039] Based on the environmental parameters during image acquisition, lighting condition information is extracted, including light intensity, light source direction, and reflection characteristics;
[0040] Based on the installation location of the camera equipment, extract the perspective information, including the shooting angle, shooting distance, and perspective ratio;
[0041] In the acquired multi-angle images, the structural features of the electronic control board are used as the basis for partitioning, and the overall area of the electronic control board is divided into surface area, solder joint area and trace area, and the corresponding images are extracted respectively.
[0042] The surface area image, solder joint area image, and trace area image are generated and used as input data for subsequent segmentation and feature extraction.
[0043] In a preferred embodiment of the present invention, image segmentation processing is performed based on the surface area image, solder joint area image, and trace area image to generate multiple image sub-regions. Texture features, brightness distribution features, and geometric edge features are extracted within each image sub-region to form a sub-region combination feature, including:
[0044] Based on the surface region image, orientation-dependent adaptive block division is performed to obtain the first type of image sub-region;
[0045] Based on the first type of image sub-region, calculate the local gray-level difference and generate texture features;
[0046] Based on the solder joint area image, local focusing and segmentation are performed to obtain the second type of image sub-region;
[0047] Based on the second type of image sub-region, the gray-level histogram distribution is statistically analyzed to generate brightness features;
[0048] Based on the trace area image, regular block segmentation is performed to obtain the third type of image sub-region;
[0049] Based on the third type of image sub-region, the gradient direction distribution is calculated to generate geometric edge features;
[0050] Based on texture features, brightness features, and geometric edge features, a weighted combination is performed according to preset weights to form a unified feature vector. Then, through feature normalization processing, sub-region combination features are obtained.
[0051] In this embodiment of the invention, by performing direction-dependent adaptive segmentation based on the surface area image, the segmentation boundaries can be kept consistent with the texture or wiring direction of the control board surface, avoiding the problem of key features being segmented, thereby improving the completeness of texture feature extraction. For example, if the wiring area is arbitrarily cut, the break features may be disassembled, leading to a decrease in recognition accuracy, while adaptive segmentation can ensure that the entire wiring path is completely included in the sub-region.
[0052] Furthermore, by performing local focusing and segmentation on the solder joint area image, each solder joint and its adjacent pads can be completely contained within a single image sub-region, avoiding interference between features of different solder joints. For example, cold solder joints or poor solder joints often appear at the contact edge between the solder joint and the pad. If these are segmented into different sub-regions, the detection system will have difficulty capturing them correctly. Local focusing and segmentation, however, ensures that the abnormal features of the solder joints are fully presented.
[0053] Furthermore, performing regularized block division based on the trace area image ensures that the trace area is divided in a uniform manner, which facilitates the extraction of geometric edge features. For example, when the trace has bends or breaks, regularized block division can maintain the continuity of edge detection, making the break points appear as obvious discontinuities in the geometric edge features.
[0054] Furthermore, by weighting and combining texture features, brightness features, and geometric edge features, and then performing feature normalization, feature information from different sources can be unified into comparable feature vectors, avoiding biases caused by single features. For example, in strong light environments, brightness features may be distorted, while texture and geometric features remain stable. Through weighted combination and normalization, the detection results are more robust.
[0055] Specifically, based on the surface region image, orientation-dependent adaptive segmentation is performed to obtain the first type of image sub-region, which includes:
[0056] Preliminary orientation detection is performed on the surface area image to identify the main direction of textures or lines in the image;
[0057] Based on the detected main direction, adjust the boundaries of the blocks to make the block direction consistent with the texture or trace direction;
[0058] During the segmentation process, ensure that the area covered by each segment is approximately the same size, while avoiding the cutting off of key textures;
[0059] The output consists of multiple first-class image sub-regions, each of which retains complete directional features for subsequent feature extraction.
[0060] Specifically, based on the first type of image sub-region, local gray-level differences are calculated to generate texture features, including:
[0061] For each first-class image sub-region, extract the grayscale value distribution of the pixels within it;
[0062] Within each sub-region, the grayscale difference between adjacent pixels is calculated, and the distribution of this difference throughout the entire region is statistically analyzed.
[0063] The average value of grayscale difference is used to characterize the overall brightness variation, and the fluctuation range of grayscale difference is used to characterize the texture coarseness.
[0064] Based on the overall performance of grayscale differences, corresponding texture features are generated for subsequent fusion analysis with brightness features and geometric edge features.
[0065] Specifically, based on the solder joint area image, local focusing and segmentation are performed to obtain the second type of image sub-region, which includes:
[0066] In the solder joint area image, first determine the geometric center of the solder joint and the range of its surrounding pads;
[0067] Based on the actual dimensions of the solder joints and pads, set the boundary range of the blocks so that each block covers a solder joint and its adjacent pad area;
[0068] During the segmentation process, ensure that the boundary falls within the neutral region between solder joints to avoid two solder joints being simultaneously divided into the same sub-region.
[0069] The segmented results are output as second-class image sub-regions, each of which fully contains a solder joint region, facilitating subsequent feature extraction.
[0070] Specifically, based on the second type of image sub-region, the gray-level histogram distribution is statistically analyzed to generate brightness features, including:
[0071] For each second-class image sub-region, extract the grayscale values of all pixels within that region;
[0072] The grayscale values are divided into multiple brightness levels according to the range from dark to light, and the number of pixels corresponding to each brightness level is counted to form a grayscale histogram distribution.
[0073] Based on the overall shape of the grayscale histogram, extract key parameters such as the concentration of the main grayscale value ranges and the uniformity of grayscale distribution.
[0074] These key parameters are converted into brightness characteristics to reflect the illumination status and surface uniformity of the solder joint area.
[0075] Specifically, based on the trace area image, regular segmentation is performed to obtain the third type of image sub-region, which includes:
[0076] Perform a full scan of the wiring area image to extract the main directions and layout range of the wiring;
[0077] The wiring area is divided into regular sections according to a preset rectangular or strip pattern to ensure that the coverage of each section is roughly the same.
[0078] During the segmentation process, try to keep the segmentation boundary parallel to the routing direction to avoid the routing being over-segmented;
[0079] The segmented results are output as third-class image sub-regions. Each sub-region fully preserves the local features of the trace, which facilitates the subsequent extraction of geometric features.
[0080] Specifically, based on the third type of image sub-region, the gradient direction distribution is calculated to generate geometric edge features, including:
[0081] For each third-class image sub-region, the direction information of brightness change is extracted pixel by pixel to reflect the direction of the edge;
[0082] The orientation information of all pixels in the sub-region is statistically analyzed and classified into several orientation intervals, such as horizontal, vertical and diagonal.
[0083] Calculate the distribution ratio of pixels in each directional interval to characterize the main direction and distribution pattern of the edges in the sub-region;
[0084] The statistically obtained directional distribution is used as a geometric edge feature for subsequent fusion analysis with texture and brightness features.
[0085] Specifically, based on texture features, brightness features, and geometric edge features, a weighted combination is performed according to preset weights to form a unified feature vector. Then, through feature normalization processing, sub-region combination features are obtained, including:
[0086] In the same image sub-region, input the texture features, brightness features and geometric edge features extracted in the previous step respectively;
[0087] A weight value is preset for each type of feature. The weight value is determined according to the importance of the feature in defect detection. For example, the weight of texture features can be increased in surface scratch detection, and the weight of brightness or edge features can be increased in solder joint anomaly detection.
[0088] The three types of features are numerically superimposed according to preset weight values to obtain a unified feature vector in the form of a single vector, which is used to characterize the overall feature performance of the sub-region.
[0089] Standardize each feature component in the unified feature vector to adjust the values of different components to the same range, so as to avoid excessive influence of a certain feature on the result due to the difference in units.
[0090] After weighted combination and normalization, the unified feature vectors of each sub-region are stored and combined to form complete sub-region combined features, which are used as input data for subsequent rare defect feature enhancement processing.
[0091] In a preferred embodiment of the present invention, based on the sub-region combination features, rare defect feature enhancement processing is performed, low-frequency abnormal textures are repeatedly superimposed at multiple scales, and edge breaks are directionally extended to obtain a defect enhancement feature map, including:
[0092] Based on the sub-region combination characteristics, low-frequency abnormal textures are decomposed to form texture candidate data;
[0093] Based on the candidate texture data, texture maps are generated at multiple resolutions and then superimposed layer by layer to obtain magnified texture features;
[0094] Based on the characteristics of sub-region combinations, edge break points are decomposed to form break candidate data;
[0095] Based on the fracture candidate data, the edge gradient direction is extracted, and pixel interpolation is performed along the direction to obtain the extended edge features;
[0096] Based on the magnified texture features and extended edge features, pixel-level alignment is performed and the features are superimposed point by point. Interpolation compensation is then applied to the difference regions to form a defect enhancement feature map.
[0097] In this embodiment of the invention, by obtaining low-frequency abnormal textures based on sub-region combination feature decomposition and generating texture candidate data, subtle but abnormal areas on the surface of the electronic control board can be independently marked, facilitating subsequent enhancement processing. For example, when there are fine cracks on the surface, they are not obvious in the overall image, but after decomposition, they can be stored as independent candidate textures.
[0098] Furthermore, generating texture maps at multiple resolutions based on texture candidate data and stacking them layer by layer can effectively amplify low-frequency texture anomalies, making them more prominent in the final image. For example, a slight scratch may resemble noise at a single resolution, but after multi-scale stacking, the scratch signal accumulates and strengthens, exhibiting obvious linear characteristics.
[0099] Furthermore, by obtaining edge break points and forming break candidate data based on the sub-region combination feature decomposition, it is possible to focus on analyzing potential break defects in the circuit board traces. For example, if a trace break causes the circuit to not conduct, its edge break point can be extracted independently and then subjected to specialized extension processing.
[0100] Furthermore, by extracting the edge gradient direction from the fracture candidate data and performing directional interpolation, the fracture at the edge can be completed, making the edge contour of potential defects more continuous. For example, weld cracks may appear as short, discontinuous point-like anomalies in the original image, but through directional interpolation, they can be extended into complete cracks, improving the recognition accuracy.
[0101] Furthermore, by pixel-level alignment and point-by-point superposition of amplified texture features and extended edge features, and by interpolating and compensating for discrepancies, a defect enhancement feature map can be generated, making potential defects more noticeable in the image than in normal areas. For example, when tiny air bubbles remain on the surface, the enhancement feature map can display them as highlighted anomalous points, facilitating subsequent difference comparison.
[0102] Among them, based on the sub-region combination characteristics, low-frequency abnormal textures are decomposed to form texture candidate data, specifically including:
[0103] For the input sub-region combination features, frequency components are first divided, and the overall feature signal is divided into high-frequency and low-frequency components according to the spatial change rate.
[0104] In the segmentation results, texture components that change slowly and have a large scale are selected as low-frequency components.
[0105] In the low-frequency part, we further analyze the differences between it and the normal area. For example, the texture distribution in the normal area is uniform, while the abnormal area often shows local dark or bright bands.
[0106] These low-frequency components that differ significantly from the normal pattern are extracted and labeled as texture candidate data, which are then used as input for subsequent enhancement.
[0107] Specifically, based on candidate texture data, texture maps are generated at multiple resolutions and then layered to obtain magnified texture features. This includes:
[0108] The texture candidate data is copied to multiple resolution spaces to generate texture maps at high, medium and low resolutions, respectively.
[0109] At different resolutions, the extracted texture maps show different levels of detail. For example, high resolution can highlight subtle changes, while low resolution can reflect the overall trend.
[0110] The texture maps generated at different resolutions are superimposed layer by layer, and the brightness or texture intensity is accumulated by using a pixel correspondence method, so that the originally inconspicuous low-frequency anomalies are gradually amplified.
[0111] The superimposed result is output as an amplified texture feature for subsequent fusion with edge features.
[0112] Specifically, based on the sub-region combination characteristics, edge break points are decomposed to form break candidate data, which includes:
[0113] For the combined features of the input sub-regions, perform edge detection to identify the main edge directions within the region;
[0114] In the detection results, look for locations where the edges are interrupted or discontinuous, and mark these locations as breakpoints;
[0115] For each break point, extract the grayscale changes and edge direction information of the surrounding pixels for subsequent extension processing;
[0116] These sets of fracture points, which contain location and orientation information, are stored as fracture candidate data and used as input for subsequent interpolation.
[0117] Specifically, based on the candidate fracture data, the edge gradient direction is extracted, and pixel interpolation is performed along the direction to obtain the extended edge features, including:
[0118] For each candidate break point, extract the gradient direction of its surrounding pixels to determine the edge extension trend;
[0119] In a defined direction, check the grayscale changes pixel by pixel, and infer the grayscale value of the missing pixel based on the change pattern of adjacent pixels.
[0120] The predicted gray values are filled into the gaps between the break points to restore the continuity of the edges in that direction;
[0121] The result of interpolating and repairing all breakpoints is output as an extended edge feature to ensure a more complete edge contour.
[0122] In a preferred embodiment of the present invention, a difference comparison is performed based on the combination features of the defect enhancement feature map and the corresponding normal region, and normalization correction is performed in conjunction with illumination conditions and viewing angle information to obtain a set of candidate defect regions, including:
[0123] Based on the combination features of the defect enhancement feature map and the normal region, corresponding features are extracted, the difference index is calculated, and the first candidate region set is obtained.
[0124] Based on the first candidate region set and the lighting conditions, brightness normalization correction is performed to correct the gray values of regions under different lighting intensities and incident angles to a uniform brightness range, thus obtaining the second candidate region set.
[0125] Based on the second candidate region set and the viewpoint information, spatial normalization correction is performed to correct the regional position shift caused by different shooting angles to a unified coordinate system, thus obtaining the third candidate region set.
[0126] Based on the difference, brightness stability, and spatial consistency of the third candidate region set, and based on the preset first difference threshold, brightness threshold, and position threshold, regions that do not meet any of the threshold conditions are eliminated, and regions that simultaneously meet the requirements of the three thresholds are retained to form a candidate defect region set.
[0127] In this embodiment of the invention, by extracting corresponding feature vectors based on the combined features of the defect enhancement feature map and the normal region, and calculating the difference index, quantitative differentiation between defective and normal regions can be achieved. For example, if the texture roughness of a certain region in the enhancement feature map is significantly higher than that of the normal region, the difference index will be significantly improved, enabling the region to be quickly identified as a suspected defect.
[0128] Furthermore, performing brightness normalization correction based on the first candidate region set and lighting conditions can eliminate misjudgments caused by differences in ambient lighting. For example, the same solder joint may appear as a bright spot or a dark spot under different light sources. Without correction, it may be mistakenly identified as a cold solder joint. However, brightness normalization can restore its true brightness characteristics, ensuring the stability of the judgment.
[0129] Furthermore, spatial normalization correction is performed based on the second candidate region set and viewpoint information to correct positional offsets caused by different shooting angles, ensuring that candidate regions are aligned in a unified coordinate system. For example, a small defect may be located at the center of the coordinate system in a frontal view but at an offset position in an oblique view. Without correction, it would be counted repeatedly as a different defect. Spatial normalization ensures that the defect is correctly merged at different angles.
[0130] Furthermore, by filtering based on the difference, brightness stability, and spatial consistency of the third candidate region set using preset difference thresholds, brightness thresholds, and location thresholds, it can be ensured that the final candidate defect region set contains only stable and reliable defects. For example, dust particles may appear different at a single angle, but they do not meet the requirements in brightness and spatial consistency checks and are ultimately eliminated, thus ensuring the accuracy of the detection results.
[0131] Specifically, based on the first candidate region set and the lighting conditions, brightness normalization correction is performed to correct the grayscale values of regions under different lighting intensities and incident angles to a uniform brightness range, resulting in the second candidate region set, which includes:
[0132] First, during the image acquisition process, the lighting conditions for each candidate region are recorded, including the intensity of the light source, the angle of incidence of the light source, and the reflectivity of the region's surface.
[0133] In the first candidate region set, the gray value distribution of each candidate region is extracted one by one, and the average brightness and brightness fluctuation range of the region are analyzed.
[0134] The average brightness of the area is compared with the reference brightness under standard lighting conditions, and the difference between the current brightness of the area and the standard brightness is calculated.
[0135] A correction factor is generated based on the brightness difference, and the magnitude of the correction factor is determined by the degree of brightness difference.
[0136] The grayscale distribution of the candidate region is linearly adjusted using a correction coefficient. For example, the overall grayscale is increased when the region brightness is low, and the overall grayscale is decreased when the region brightness is high.
[0137] After the correction is completed, the corrected candidate regions are recombined to form a second set of candidate regions, which serves as the input for subsequent spatial normalization correction.
[0138] Specifically, based on the second candidate region set and viewpoint information, spatial normalization correction is performed to correct the regional positional shifts caused by different shooting angles to a unified coordinate system, resulting in the third candidate region set, which includes:
[0139] First, obtain the shooting parameters of the image acquisition device at different angles, including the relative angle between the camera and the electronic control board, the shooting distance, and the optical distortion parameters;
[0140] In the second candidate region set, the coordinate information of each candidate region is extracted one by one, including the coordinates of the center point and the boundary range of the region;
[0141] Based on the camera's shooting angle and perspective ratio, calculate the position that the candidate area should correspond to under a standard orthographic view.
[0142] By using coordinate mapping, the position of the current candidate region is gradually adjusted to the position under the standard orthogonal view, ensuring that the relative relationship between regions remains unchanged;
[0143] During the coordinate mapping process, the deformed areas are scaled or rotated to make the geometry of the candidate areas consistent with the real areas.
[0144] After the correction is completed, all the corrected location data are recombined to form a third candidate region set, providing an accurate spatial reference for subsequent multi-threshold screening.
[0145] The preset first difference threshold, brightness threshold, and position threshold specifically include:
[0146] First, based on the existing electronic control board detection dataset, the difference magnitude between normal areas and defective areas in terms of texture features, brightness features, and edge features is statistically analyzed for the difference threshold.
[0147] In the statistical results, the numerical range that can distinguish most defective areas from normal areas is selected, and this value is used as the first difference threshold for subsequent difference comparison.
[0148] Then, based on the brightness threshold, images of the standard electronic control board were acquired under various lighting conditions, and the grayscale fluctuation range of the normal area under changes in lighting was recorded.
[0149] The upper limit of the fluctuation range is set as the brightness threshold. When the grayscale fluctuation of a certain area exceeds this range, it can be determined as an unstable area.
[0150] Finally, based on the position threshold, images of the electronic control board were acquired from different perspectives, the coordinate offset of the same area under perspective changes was measured, and the ratio between the offset and the area size was calculated.
[0151] The maximum value of this ratio in the normal area is used as the location threshold. When the offset ratio of the candidate area exceeds this value, it is determined that its location consistency is insufficient.
[0152] In a preferred embodiment of the present invention, a multi-angle reproducibility analysis is performed based on the candidate defect region set. If the same suspected defect is detected at different angles, a reliable defect region is formed; otherwise, interfering regions are eliminated, and an electronic control board defect detection result is generated, including:
[0153] Based on the corresponding candidate defect regions of the same suspected defect in different angle images from the candidate defect region set, spatial mapping is performed to align the candidate defect regions at each angle to a unified coordinate system, resulting in an aligned region set.
[0154] The overlapping area is calculated based on the overlapping portion between the corresponding candidate defect regions in the alignment region set, and the joint area is calculated based on the union of all corresponding candidate defect regions to obtain the overlap ratio.
[0155] The overlap ratio is compared with a preset threshold. If it is higher than the threshold, the corresponding candidate defect area is marked as a reliable defect area. If it is lower than the threshold, it is removed as an interference area.
[0156] Based on the reliable defect area, generate the electronic control board defect detection results, including the defect location coordinates, defect type label, and marking information in the original image.
[0157] In this embodiment of the invention, by performing multi-angle reproducibility analysis based on the candidate defect region set, a reliable defect region is formed when the same suspected defect is detected at different angles; otherwise, interfering regions are eliminated, thereby improving the accuracy of defect determination. For example, if a bright spot appears in a frontal image, and no corresponding abnormal region is detected in the side or oblique angle images, it indicates that the bright spot may be reflection interference, which can be eliminated through this step.
[0158] Furthermore, by performing spatial mapping on the corresponding candidate defect regions of the same suspected defect at different angles within the candidate defect region set, and aligning them to a unified coordinate system, it can be ensured that the same defect can be accurately mapped at different angles. For example, the imaging position of a weld crack may shift at different angles. Without unified mapping, it is easy to be regarded as multiple different defects. Spatial mapping can merge them into the same defect.
[0159] Furthermore, by calculating the overlapping area between the corresponding candidate defect regions in the aligned region set, and calculating the joint area based on the union of all corresponding candidate defect regions, the overlap ratio can be obtained, enabling a quantitative judgment on the repeatability of defects at multiple angles. For example, when the overlap ratio is greater than a set threshold, it indicates that the defect is consistent at different angles, thereby improving the reliability of the judgment.
[0160] Furthermore, by comparing the overlap ratio with a preset threshold, areas exceeding the threshold are marked as reliable defect areas, while areas below the threshold are removed as interference areas, effectively ensuring the reliability of the final output results. Finally, based on the reliable defect areas, the electronic control board defect detection results are generated, including defect location coordinates, defect type labels, and marking information in the original image, providing an intuitive reference for subsequent repairs or rework.
[0161] Specifically, the overlapping area is calculated based on the overlapping portion between corresponding candidate defect regions in the aligned region set, and the joint area is calculated based on the union of all corresponding candidate defect regions to obtain the overlap ratio. This includes:
[0162] First, in the aligned region set, candidate defect regions corresponding to the same suspected defect under different angle images are determined;
[0163] For these corresponding regions, analyze their boundary information in a unified coordinate system one by one, and extract the coordinate points and contour shapes of the boundaries;
[0164] Candidate defect regions from different angles are superimposed to find the parts they cover in common, and these parts are marked as overlapping regions.
[0165] The number of pixels covered by the overlapping region is calculated based on the boundary range of the overlapping region, which is used to represent the overlapping area;
[0166] At the same time, the boundary ranges of all corresponding candidate defect regions are merged to form a set of regions covering the entire suspected defect, and the number of pixels contained in the set is calculated to represent the joint area;
[0167] Finally, the overlapping area and the joint area are converted into a ratio, and this ratio is used as the overlap ratio for subsequent threshold determination.
[0168] Specifically, based on reliable defect areas, the electronic control board defect detection results are generated, including defect location coordinates, defect type labels, and marking information in the original image, including:
[0169] Within the reliable defect region, the center coordinates and boundary coordinates of each region are extracted one by one to generate defect location coordinate data;
[0170] Based on the characteristics of the defective area, such as texture abnormalities, brightness abrupt changes, or edge breaks, it is mapped to a preset defect type library and a defect type label is automatically assigned.
[0171] In the original image, the locations of the reliable defect areas are marked using visual annotation methods such as rectangular boxes, outline highlighting, or color overlay.
[0172] The location coordinate data, defect type labels, and image marking information are combined to generate a complete electronic control board defect detection result file;
[0173] The test result file can be directly used as output data in the production line quality inspection process to prompt operators to perform subsequent processing on the electronic control board.
[0174] The preset ratio threshold specifically includes:
[0175] Under multi-angle imaging conditions, the standard electronic control board is sampled to extract candidate regions of the same real defect at different angles;
[0176] Calculate the overlapping area and joint area of these candidate regions in the unified coordinate system, and find the ratio between the two as the overlap ratio;
[0177] By statistically analyzing the overlap ratio of a large number of real defects, a minimum value that can effectively distinguish real defects from interference areas is selected as the preset ratio threshold.
[0178] If the overlap ratio of a candidate defect region is higher than the threshold during the detection process, the defect can be determined to exist stably from multiple angles; if it is lower than the threshold, it is discarded as interference.
[0179] In a preferred embodiment of the present invention, pixel-level alignment and point-by-point superposition are performed based on amplified texture features and extended edge features, and interpolation compensation is applied to the difference regions to form a defect enhancement feature map, including:
[0180] Based on the magnified texture features and extended edge features, their respective coordinate ranges are extracted to generate sub-region index data;
[0181] Based on the sub-region index data, coordinate mapping is performed to unify the magnified texture features and extended edge features into the same coordinate system, generating alignment reference data;
[0182] Based on the alignment reference data, perform point-by-point overlay on the corresponding pixels. If two types of features exist at the same time, calculate the weighted sum. If only a single feature exists, keep the feature value and generate the first enhanced image.
[0183] Based on the first enhancement map, the uncovered fracture area is located, the gradient direction and intensity changes of adjacent pixels are extracted, directional interpolation is performed, the pixels at the fracture are filled, and the second enhancement map is generated.
[0184] Based on the second enhancement map, local consistency correction is performed to smooth out areas with discontinuous edges, forming a defect enhancement feature map.
[0185] In this embodiment of the invention, by extracting the coordinate ranges of the amplified texture features and the extended edge features and generating sub-region index data, it can be ensured that features from different sources can be compared according to the same region during the subsequent fusion process, avoiding feature misalignment. For example, if the crack edge features extend beyond the original texture region, feature alignment errors will occur if index matching is not performed.
[0186] Furthermore, by performing coordinate mapping based on the sub-region index data, the amplified texture features and extended edge features are unified into the same coordinate system, enabling spatial alignment of different feature channels. For example, the same scratch may appear as a line in the texture features but as a breakpoint in the edge features. Coordinate mapping allows them to overlap at the same location, ensuring the accuracy of the enhancement effect.
[0187] Furthermore, point-by-point superposition is performed on the corresponding pixels based on the alignment reference data. If both types of features exist simultaneously, a weighted sum is calculated; if only a single feature exists, that feature value is retained. This ensures that the enhancement result highlights both overlapping features and retains individual features. For example, a weld crack that is clearly visible in both edge and texture features will have a more prominent enhancement effect, while a single noise point that only appears in one feature channel will not be over-amplified.
[0188] Furthermore, based on the first enhanced image, the uncovered fracture areas are located, and the gradient direction and intensity changes of adjacent pixels are extracted and directional interpolation is performed to complete the defect edges, making the fracture features more continuous. For example, when a trace is interrupted, directional interpolation can extend the edge into a complete line, making it easier to identify. Finally, local consistency correction is used to smooth the discontinuous areas of the edges, generating a defect enhanced feature map that ensures that the defect features are both prominent and stable.
[0189] Specifically, based on the magnified texture features and extended edge features, their respective coordinate ranges are extracted to generate sub-region index data, which includes:
[0190] First, in the magnified texture feature map, determine the boundary range covered by the texture features, and extract the start and end coordinate points of this range;
[0191] In the extended edge feature map, the boundary range covered by the edge extension is also extracted, and its coordinate point information is recorded;
[0192] By comparing the coverage of the two features, their corresponding coordinate ranges are indexed in a unified manner so that subsequent alignment can be processed according to the same coordinate system.
[0193] The final output is sub-region index data, which contains the spatial correspondence between texture features and edge features.
[0194] Specifically, based on the sub-region index data, coordinate mapping is performed to unify the magnified texture features and extended edge features into the same coordinate system, generating alignment reference data, which includes:
[0195] Based on the sub-region index data, read the coordinate information of the magnified texture features and extended edge features one by one;
[0196] By using spatial mapping, data points with different characteristics are transformed into a unified reference coordinate system;
[0197] During the mapping process, offsets caused by scaling or viewpoint differences are corrected to ensure that features can be accurately aligned in the same position.
[0198] The generated alignment reference data includes the matching relationship between magnified texture features and extended edge features under unified coordinates.
[0199] Specifically, based on alignment reference data, pixel-by-pixel overlay is performed on the corresponding pixels. If both types of features exist simultaneously, a weighted sum is calculated; if only a single feature exists, that feature value is retained, and a first enhanced image is generated. This process includes:
[0200] For each pixel in the alignment reference data, read the magnified texture feature value and the extended edge feature value respectively;
[0201] If a pixel has two types of feature values at the same time, the two are weighted and added together according to a preset ratio to generate a new pixel value;
[0202] If a pixel has only one feature value, then that feature value is directly retained as the output.
[0203] The calculation results of all pixels are combined and output as the first enhanced image, which is used to represent the enhancement effect after superposition.
[0204] Specifically, based on the first enhanced image, the uncovered fracture regions are located, the gradient direction and intensity changes of adjacent pixels are extracted, directional interpolation is performed to fill in the pixels at the fracture points, and a second enhanced image is generated, which includes:
[0205] In the first enhanced image, areas that still have gaps or breaks are detected and marked, which are typically manifested as fracture zones with discontinuous edges;
[0206] For each fracture region, the brightness variation trend of the surrounding pixels is extracted, and the gradient direction is calculated to infer the extension direction of the edge.
[0207] Following the gradient direction, new pixels are inserted point by point before and after the break point, and the brightness value of the new pixels is calculated based on the brightness difference between adjacent pixels.
[0208] Gradually fill in the complete fracture zone to make the edges more continuous, and output the second enhanced image.
[0209] Specifically, based on the second enhancement map, local consistency correction is performed to smooth out regions with discontinuous edges, forming a defect enhancement feature map, which includes:
[0210] In the second enhanced image, regions where local mutations still exist are detected, which are characterized by uneven edge brightness or uneven lines;
[0211] Within the detected area, extract the grayscale values and edge direction information of adjacent pixels to determine whether the abrupt change belongs to noise or anomaly.
[0212] These outliers are corrected by smoothing algorithms, adjusting the pixel values to be closer to the surrounding pixels, thereby reducing abrupt changes;
[0213] The final output is a defect enhancement feature map, in which defect features are enhanced while the overall image maintains high smoothness and consistency.
[0214] In a preferred embodiment of the present invention, based on the combined features of the defect enhancement feature map and the normal region, corresponding features are extracted, and a difference index is calculated to obtain a first candidate region set, including:
[0215] Based on the defect enhancement feature map, texture features, brightness features, and edge features are extracted and combined to form enhancement feature data;
[0216] Based on the normal region combination features, the corresponding texture features, brightness features and edge features are extracted to form the baseline feature data;
[0217] Based on the enhanced feature data and the baseline feature data, the difference is calculated to obtain the difference data;
[0218] Based on the difference data, it is compared with a preset second difference threshold, and regions that are higher than the threshold are selected to form a first candidate region set.
[0219] In this embodiment of the invention, by extracting texture features, brightness features, and edge features from the defect enhancement feature map and combining them to form enhanced feature data, a unified description of multiple abnormal manifestations in the same area can be achieved, avoiding omission of information. For example, a poor solder joint may manifest as abnormal brightness or irregular edges; by combining the feature data, the defect characteristics can be comprehensively reflected.
[0220] Furthermore, based on the combined features of normal regions, corresponding texture features, brightness features, and edge features are extracted to form baseline feature data, which can provide a reliable reference for subsequent comparisons. For example, in adjacent normal regions, brightness features are often more uniform and edges are more regular, which can help identify regions with significant differences as a baseline.
[0221] Furthermore, by performing difference calculations based on the enhanced feature data and the baseline feature data to obtain difference data, the degree of difference between defective and normal regions can be quantified. For example, when the texture roughness of a certain region is significantly higher than that of a normal region, the difference data will increase rapidly, thus marking that region as a suspected defect.
[0222] Furthermore, by comparing the difference data with a preset second difference threshold, areas exceeding the threshold form a first candidate region set, which can effectively achieve preliminary screening of suspected defects and reduce the workload of subsequent processing. For example, large, uniform, and anomaly-free areas will be excluded due to excessively low difference, while areas with minor cracks or incomplete welds will be retained.
[0223] Specifically, based on the defect enhancement feature map, texture features, brightness features, and edge features are extracted and combined to form enhancement feature data, including:
[0224] In the defect enhancement feature map, the image is first divided into multiple processing units, each unit corresponding to a local region;
[0225] Within each local area, the brightness and darkness variation patterns of statistical pixels are analyzed, and the fluctuations in grayscale values are extracted into texture features to reflect subtle anomalies on the surface of the area.
[0226] At the same time, the average brightness and brightness distribution range of the calculated area are used to form brightness characteristics to characterize the overall illumination performance and local deviations;
[0227] Next, the region boundaries are detected, and the directional distribution and continuity of the edges are recorded to form edge features;
[0228] Finally, texture features, brightness features, and edge features are combined in a fixed order to generate enhanced feature data in a uniform format, which serves as input for subsequent comparisons.
[0229] Specifically, based on the combined features of normal regions, corresponding texture features, brightness features, and edge features are extracted to form baseline feature data, including:
[0230] In the normal region combination features, local regions corresponding to the enhanced feature data are divided one by one;
[0231] Within these regions, the subtle fluctuations in pixel grayscale are statistically analyzed to obtain the texture features of the normal region, which are used to characterize the texture pattern under normal conditions.
[0232] At the same time, the average brightness value and brightness distribution uniformity of these areas are calculated to obtain brightness characteristics, which serve as a reference under normal lighting conditions.
[0233] The boundary of the region is detected, and the distribution and continuity of the edge direction are extracted to obtain edge features, which are used to reflect the geometric regularity of the normal structure;
[0234] Finally, the texture features, brightness features, and edge features of the normal region are integrated into baseline feature data, which is used for difference analysis with the enhanced feature data.
[0235] Specifically, based on the enhanced feature data and the baseline feature data, a difference calculation is performed to obtain the difference data, which includes:
[0236] The enhanced feature data and the baseline feature data are mapped one-to-one within the same region.
[0237] For texture features, compare the differences in grayscale fluctuation patterns between the two; the greater the difference, the more likely the texture is abnormal.
[0238] For brightness characteristics, compare the average value and distribution range of the two. If the deviation is significant, it indicates that the brightness characteristics of the region are abnormal.
[0239] For edge features, compare the direction distribution and edge continuity. If there is a gap or abrupt change in direction, it indicates that there is a defect in the geometric edge.
[0240] The difference results of the three types of features, namely texture, brightness and edge, are summarized to obtain difference data in a unified format, which is used for subsequent threshold filtering.
[0241] The preset second difference threshold specifically includes:
[0242] In the difference analysis between enhanced feature data and baseline feature data, a sample library is first established, which includes comparative data of normal areas and typical defective areas.
[0243] In each sample, three types of features are extracted: texture, brightness, and edge, and the difference index between them is calculated.
[0244] By comparing the results, the range of differences between the normal area and the defective area was determined;
[0245] Within this range, a value that balances the false negative rate and the false positive rate is selected as the second difference threshold. When the difference of a candidate region is higher than this threshold, it is marked as a suspected defect.
[0246] In a preferred embodiment of the present invention, based on the first candidate region set and the illumination conditions, brightness normalization correction is performed to correct the grayscale values of regions under different illumination intensities and incident angles to a uniform brightness range, thereby obtaining a second candidate region set, including:
[0247] Based on the first candidate region set, extract the mean gray level and gray level variance of each candidate region to generate illumination distribution data;
[0248] Based on the illumination distribution data and the standard illumination reference, the grayscale deviation is calculated to generate the brightness deviation data.
[0249] Based on the brightness deviation data, a correction coefficient is generated, and the gray values of the candidate regions are linearly stretched or compressed to generate a brightness-corrected image.
[0250] Based on the brightness-corrected image, the texture and edge features of the candidate regions are updated to form a second set of candidate regions.
[0251] In this embodiment of the invention, by extracting the mean and variance of grayscale for each candidate region from the first candidate region set and generating illumination distribution data, the brightness characteristics of each region under the current illumination conditions can be obtained, thus providing a quantitative basis for subsequent correction. For example, when the same solder joint appears bright under strong light and dark gray under weak light, its grayscale variance will increase significantly, indicating that there is an effect of uneven illumination in this region.
[0252] Furthermore, by calculating the grayscale deviation and generating brightness deviation data based on the illumination distribution data and the standard illumination reference, the difference between the candidate area and the standard illumination conditions can be accurately reflected. For example, under standard illumination, the average brightness of the trace should remain within a stable range. If a significant increase in the deviation value is detected, it indicates interference from ambient light and requires correction.
[0253] Furthermore, by generating correction coefficients based on brightness deviation data and performing linear stretching or compression on the grayscale values of candidate regions, the characteristics of candidate regions under different lighting conditions can be unified to a standard range. For example, if a region has generally low grayscale values under low light conditions, its brightness range can be adjusted to a standard level after stretching with correction coefficients, thus eliminating lighting differences.
[0254] Furthermore, updating the texture and edge features of the candidate regions based on the brightness-corrected image to form a second candidate region set ensures that defect identification is based on data with consistent illumination, avoiding misjudgments caused by illumination differences. For example, solder joint areas that were originally blurred due to strong light will have their edge features restored to clear after brightness correction, making it easier to identify cold solder joint defects.
[0255] Specifically, based on the first candidate region set, the mean gray level and gray level variance of each candidate region are extracted to generate illumination distribution data, including:
[0256] In the first candidate region set, candidate regions are selected one by one, and the gray values of all pixels in the region are extracted.
[0257] Calculate the average grayscale value of all pixels in the region to characterize the overall brightness level;
[0258] At the same time, the fluctuation range of pixel grayscale values is calculated, and the degree of fluctuation is used as the grayscale variance to measure the stability of brightness;
[0259] The grayscale mean and grayscale variance are combined to form the illumination distribution data of the candidate region, which is then used for subsequent illumination correction processing.
[0260] Specifically, based on the illumination distribution data and the standard illumination reference, grayscale deviation is calculated to generate brightness deviation data, including:
[0261] First, obtain a preset standard lighting reference, which includes the target grayscale range under normal lighting conditions;
[0262] The gray-scale mean of the candidate region is compared with the target value in the standard illumination reference to obtain the difference between the brightness level of the candidate region and the standard value.
[0263] Meanwhile, the gray-level variance of the candidate region is compared with the normal fluctuation range in the reference to obtain the difference between the brightness stability and the standard value;
[0264] Differences in brightness level and stability are recorded together as brightness deviation data, which is used to describe the degree of deviation of the candidate region under illumination conditions.
[0265] Specifically, based on the brightness deviation data, correction coefficients are generated, and linear stretching or compression is performed on the grayscale values of the candidate regions to generate a brightness-corrected image. This includes:
[0266] For each candidate region, the corresponding correction coefficient is determined based on its brightness deviation data;
[0267] If the brightness level of the candidate region is lower than the standard range, an enhancement factor is generated to improve the overall gray value of the region.
[0268] If the brightness level of the candidate region is higher than that of the standard range, a compression coefficient is generated to reduce the gray value of the region as a whole.
[0269] The correction coefficient is applied to all pixels in the candidate region to linearly adjust its grayscale distribution so that the adjusted grayscale values fall into the standard range.
[0270] After the correction is completed, the brightness-corrected image is output as input for subsequent feature updates.
[0271] Specifically, based on the brightness-corrected image, the texture and edge features of the candidate regions are updated to form a second set of candidate regions, which includes:
[0272] In the brightness-corrected image, the pixel information of each candidate region is extracted one by one;
[0273] Recalculate the texture features of each candidate region, including the local difference distribution of pixel gray values, to reflect the detail performance after illumination correction.
[0274] The edge features of each candidate region are recalculated, including edge orientation distribution and edge continuity, to reflect the corrected geometric structure.
[0275] The updated texture features and edge features are combined with the location information of the original region to form new candidate region data;
[0276] All updated candidate regions are recombined to form a second set of candidate regions, which serves as the input for subsequent spatial normalization correction.
[0277] In a preferred embodiment of the present invention, based on the difference degree, brightness stability, and spatial consistency of the third candidate region set, and based on a preset first difference degree threshold, brightness threshold, and position threshold, regions that do not meet any of the threshold conditions are eliminated, and regions that simultaneously meet the three threshold requirements are retained, forming a candidate defect region set, including:
[0278] Based on the third candidate region set, extract the difference index of each region and compare it with the first difference threshold. Regions below the threshold are removed to form a difference screening set.
[0279] Based on the difference screening set, the gray-level distribution of each region under multiple lighting conditions is extracted, the gray-level variance is calculated, the brightness stability index is obtained, and it is compared with the brightness threshold. Unstable regions are removed to form the brightness screening set.
[0280] Based on the brightness filtering set, the spatial coordinates of each region under different viewing angles are extracted, the ratio of position offset to region size is calculated, the position consistency index is obtained, and it is compared with the position threshold. Regions that do not meet the requirements are removed to form a position filtering set.
[0281] The set is filtered based on location, and the final set of candidate defect regions is output as input for multi-angle reproducibility analysis.
[0282] In this embodiment of the invention, by extracting the difference index of each region from the third candidate region set and comparing it with the first difference threshold, regions below the threshold are eliminated to form a difference screening set. This ensures that subsequent analysis only targets candidate regions that are significantly different from normal regions. For example, a uniform and normal circuit board region will be directly excluded due to its low difference, thereby reducing invalid calculations.
[0283] Furthermore, based on the difference-based screening set, the grayscale distribution of each region under multiple lighting conditions is extracted and the grayscale variance is calculated to obtain a brightness stability index. This index is then compared with a brightness threshold to eliminate regions with excessive fluctuations under different lighting conditions, forming a brightness screening set. This set can remove pseudo-defects caused by unstable lighting. For example, dust may produce high-brightness reflections under certain lighting conditions, but its brightness stability is poor; this step can eliminate such dust.
[0284] Furthermore, the spatial coordinates of each region under different viewing angles are extracted from the brightness screening set, and the ratio of position offset to region size is calculated to obtain a position consistency index. This index is then compared with a position threshold to eliminate regions with unstable positions under multiple viewing angles, forming a position screening set. This set can eliminate false defects caused by perspective aberrations or reflection angles. For example, a light spot may drift in position under imaging at different angles, while a real weld crack may remain in the same position under different angles. This step can distinguish between the two.
[0285] Furthermore, the final set of candidate defect regions is output based on the location selection set and used as input for multi-angle reproducibility analysis. This ensures that the regions that ultimately enter multi-angle verification are all high-confidence defect regions with significant differences, stable brightness, and consistent positions, thereby significantly improving the accuracy and reliability of the final detection results.
[0286] Specifically, based on the third candidate region set, a difference index for each region is extracted and compared with a first difference threshold. Regions below the threshold are eliminated to form a difference screening set, which includes:
[0287] In the third candidate region set, feature data of each candidate region is extracted one by one, including texture features, brightness features and edge features;
[0288] For each candidate region, its features are compared with the corresponding normal region features one by one to obtain the difference value of each feature, and these difference values are summarized to form the difference index.
[0289] The difference index is compared with the preset first difference threshold. If the difference index of a certain region is lower than the threshold, it means that the region is not significantly different from the normal region and is removed from the set.
[0290] Candidate regions with a difference index higher than the threshold are retained to form a difference screening set, which serves as input for the next step of brightness stability analysis.
[0291] Specifically, based on the difference screening set, the grayscale distribution of each region under multiple lighting conditions is extracted, the grayscale variance is calculated, a brightness stability index is obtained, and it is compared with a brightness threshold. Unstable regions are eliminated to form a brightness screening set, which specifically includes:
[0292] In the difference filtering set, images of each candidate region acquired under different lighting conditions are selected;
[0293] In multiple images of the same region, the grayscale value distribution of pixels in that region is statistically analyzed, and its variation with illumination is recorded.
[0294] Based on the degree of fluctuation in grayscale distribution, the grayscale variance of the region is calculated to characterize the brightness stability of the region under changing lighting conditions.
[0295] The grayscale variance is compared with a preset brightness threshold. If the grayscale variance is higher than the threshold, it indicates that the brightness performance of the area is unstable and should be removed.
[0296] Regions with grayscale variance below the threshold and stable performance are retained to form a brightness screening set, which serves as input for the next step of spatial location consistency analysis.
[0297] Specifically, based on the brightness filtering set, the spatial coordinates of each region under different viewing angles are extracted, the ratio of position offset to region size is calculated to obtain a position consistency index, which is then compared with a position threshold. Regions that do not meet the requirements are eliminated, forming a position filtering set, which specifically includes:
[0298] In the brightness filtering set, the spatial coordinate information of each candidate region in images at different angles is extracted, including the center coordinates and boundary range of the region.
[0299] By comparing the coordinate differences of the same candidate region at different angles, its position offset can be obtained;
[0300] The ratio of the position offset to the size range of the region is used to measure the relative positional stability of the region at multiple angles.
[0301] The obtained position consistency index is compared with the preset position threshold. If the offset ratio exceeds the threshold, it means that the position of the area changes too much at multiple angles and should be removed.
[0302] Regions with location consistency indicators within the threshold range are retained to form a location screening set, which serves as the basis for the final candidate defect region set.
[0303] Embodiments of the present invention also provide a computer vision defect detection system for an electronic control board production line. The system includes:
[0304] The image acquisition module is used to divide the entire area of the electronic control board into areas such as surface area, solder joint area, and wiring area based on multi-angle images acquired by the electronic control board at the production line station, combined with lighting conditions and viewing angle information.
[0305] The feature extraction module is used to perform image block processing based on the surface area image, solder joint area image and trace area image, generate multiple image sub-regions, and extract texture features, brightness distribution features and geometric edge features in each image sub-region to form sub-region combination features;
[0306] The feature enhancement module is used to perform rare defect feature enhancement processing based on the combined features of sub-regions, perform multi-scale repeated superposition of low-frequency abnormal textures, and perform directional extension of edge breaks to obtain a defect enhancement feature map.
[0307] The difference comparison module is used to perform difference comparison based on the combination features of the defect enhancement feature map and the corresponding normal region, and to perform normalization correction in combination with lighting conditions and viewing angle information to obtain a set of candidate defect regions.
[0308] The multi-angle analysis module is used to perform multi-angle reproducibility analysis based on the set of candidate defect areas. When the same suspected defect is detected at different angles, a reliable defect area is formed; otherwise, the interfering area is removed, and the electronic control board defect detection results are generated.
[0309] It should be noted that this system is a system corresponding to the above method. All implementation methods in the above method embodiments are applicable to this embodiment and can achieve the same technical effect.
[0310] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0311] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0312] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A computer vision defect detection method for electronic control board production lines, characterized in that, The method includes: Based on the multi-angle images of the electronic control board collected at the production line station, combined with lighting conditions and viewing angle information, the overall area of the electronic control board is divided into zones to form surface area images, solder joint area images, and wiring area images. Based on the surface area image, solder joint area image, and trace area image, image block processing is performed to generate multiple image sub-regions. Texture features, brightness distribution features, and geometric edge features are extracted within each image sub-region to form sub-region combination features. Based on the sub-region combination characteristics, rare defect feature enhancement processing is performed, low-frequency abnormal textures are repeatedly superimposed at multiple scales, and directional extension is performed at edge breaks to obtain a defect enhancement feature map. Based on the combination features of the defect enhancement feature map and the corresponding normal region, a difference comparison is performed, and normalization correction is performed in combination with lighting conditions and viewing angle information to obtain a set of candidate defect regions. Based on the set of candidate defect regions, perform multi-angle reproducibility analysis. If the same suspected defect is detected at different angles, a reliable defect region is formed; otherwise, the interfering region is removed, and the electronic control board defect detection result is generated. The process of obtaining the defect enhancement feature map includes: Based on the sub-region combination characteristics, low-frequency abnormal textures are decomposed to form texture candidate data; Based on the candidate texture data, texture maps are generated at multiple resolutions and then superimposed layer by layer to obtain magnified texture features; Based on the characteristics of sub-region combinations, edge break points are decomposed to form break candidate data; Based on the fracture candidate data, the edge gradient direction is extracted, and pixel interpolation is performed along the direction to obtain the extended edge features; Based on the magnified texture features and extended edge features, pixel-level alignment is performed and the features are superimposed point by point. Interpolation compensation is then applied to the difference regions to form a defect enhancement feature map.
2. The computer vision defect detection method on the electronic control board production line according to claim 1, characterized in that, Based on the surface area image, solder joint area image, and trace area image, image segmentation is performed to generate multiple image sub-regions. Texture features, brightness distribution features, and geometric edge features are extracted from each image sub-region to form a sub-region combined feature, including: Based on the surface region image, orientation-dependent adaptive block division is performed to obtain the first type of image sub-region; Based on the first type of image sub-region, calculate the local gray-level difference and generate texture features; Based on the solder joint area image, local focusing and segmentation are performed to obtain the second type of image sub-region; Based on the second type of image sub-region, the gray-level histogram distribution is statistically analyzed to generate brightness features; Based on the trace area image, regular block segmentation is performed to obtain the third type of image sub-region; Based on the third type of image sub-region, the gradient direction distribution is calculated to generate geometric edge features; Based on texture features, brightness features, and geometric edge features, a weighted combination is performed according to preset weights to form a unified feature vector. Then, through feature normalization processing, sub-region combination features are obtained.
3. The computer vision defect detection method on the electronic control board production line according to claim 1, characterized in that, Based on the combination features of the enhanced feature map of defects and the corresponding normal region, a difference comparison is performed, and normalization correction is carried out in conjunction with illumination conditions and viewing angle information to obtain a set of candidate defect regions, including: Based on the combination features of the defect enhancement feature map and the normal region, corresponding features are extracted, the difference index is calculated, and the first candidate region set is obtained. Based on the first candidate region set and the lighting conditions, brightness normalization correction is performed to correct the gray values of regions under different lighting intensities and incident angles to a uniform brightness range, thus obtaining the second candidate region set. Based on the second candidate region set and the viewpoint information, spatial normalization correction is performed to correct the regional position shift caused by different shooting angles to a unified coordinate system, thus obtaining the third candidate region set. Based on the difference, brightness stability, and spatial consistency of the third candidate region set, and based on the preset first difference threshold, brightness threshold, and position threshold, regions that do not meet any of the threshold conditions are eliminated, and regions that simultaneously meet the requirements of the three thresholds are retained to form a candidate defect region set.
4. The computer vision defect detection method on the electronic control board production line according to claim 1, characterized in that, Based on the candidate defect region set, a multi-angle reproducibility analysis is performed. If the same suspected defect is detected from different angles, a reliable defect region is formed; otherwise, interfering regions are removed, and the electronic control board defect detection results are generated, including: Based on the corresponding candidate defect regions of the same suspected defect in different angle images from the candidate defect region set, spatial mapping is performed to align the candidate defect regions at each angle to a unified coordinate system, resulting in an aligned region set. The overlapping area is calculated based on the overlapping portion between the corresponding candidate defect regions in the alignment region set, and the joint area is calculated based on the union of all corresponding candidate defect regions to obtain the overlap ratio. The overlap ratio is compared with a preset threshold. If it is higher than the threshold, the corresponding candidate defect area is marked as a reliable defect area. If it is lower than the threshold, it is removed as an interference area. Based on the reliable defect area, generate the electronic control board defect detection results, including the defect location coordinates, defect type label, and marking information in the original image.
5. The computer vision defect detection method on the electronic control board production line according to claim 1, characterized in that, Based on the magnified texture features and extended edge features, pixel-level alignment and point-by-point overlay are performed, and interpolation compensation is applied to the difference regions to form a defect enhancement feature map, including: Based on the magnified texture features and extended edge features, their respective coordinate ranges are extracted to generate sub-region index data; Based on the sub-region index data, coordinate mapping is performed to unify the magnified texture features and extended edge features into the same coordinate system, generating alignment reference data; Based on the alignment reference data, perform point-by-point overlay on the corresponding pixels. If two types of features exist simultaneously, calculate the weighted sum. If only a single feature exists, retain its feature value and generate the first enhanced image. Based on the first enhancement map, the uncovered fracture area is located, the gradient direction and intensity changes of adjacent pixels are extracted, directional interpolation is performed, the pixels at the fracture are filled, and the second enhancement map is generated. Based on the second enhancement map, local consistency correction is performed to smooth out areas with discontinuous edges, forming a defect enhancement feature map.
6. The computer vision defect detection method on the electronic control board production line according to claim 3, characterized in that, Based on the combined features of the defect enhancement feature map and the normal region, corresponding features are extracted, and the difference index is calculated to obtain the first candidate region set, including: Based on the defect enhancement feature map, texture features, brightness features, and edge features are extracted and combined to form enhancement feature data; Based on the normal region combination features, the corresponding texture features, brightness features and edge features are extracted to form the baseline feature data; Based on the enhanced feature data and the baseline feature data, the difference is calculated to obtain the difference data; Based on the difference data, it is compared with a preset second difference threshold, and regions that are higher than the threshold are selected to form a first candidate region set.
7. The computer vision defect detection method on the electronic control board production line according to claim 3, characterized in that, Based on the first candidate region set and the lighting conditions, brightness normalization correction is performed to correct the grayscale values of regions under different lighting intensities and incident angles to a uniform brightness range, resulting in the second candidate region set, including: Based on the first candidate region set, extract the mean gray level and gray level variance of each candidate region to generate illumination distribution data; Based on the illumination distribution data and the standard illumination reference, the grayscale deviation is calculated to generate the brightness deviation data. Based on the brightness deviation data, a correction coefficient is generated, and the gray values of the candidate regions are linearly stretched or compressed to generate a brightness-corrected image. Based on the brightness-corrected image, the texture and edge features of the candidate regions are updated to form a second set of candidate regions.
8. The computer vision defect detection method on the electronic control board production line according to claim 3, characterized in that, Based on the difference, brightness stability, and spatial consistency of the third candidate region set, and using preset first difference threshold, brightness threshold, and location threshold, regions that do not meet any of the threshold conditions are eliminated, and regions that simultaneously meet all three threshold requirements are retained, forming a candidate defect region set, including: Based on the third candidate region set, extract the difference index of each region and compare it with the first difference threshold. Regions below the threshold are removed to form a difference screening set. Based on the difference screening set, the gray-level distribution of each region under multiple lighting conditions is extracted, the gray-level variance is calculated, the brightness stability index is obtained, and it is compared with the brightness threshold. Unstable regions are removed to form the brightness screening set. Based on the brightness filtering set, the spatial coordinates of each region under different viewing angles are extracted, the ratio of position offset to region size is calculated, the position consistency index is obtained, and it is compared with the position threshold. Regions that do not meet the requirements are removed to form a position filtering set. The set is filtered based on location, and the final set of candidate defect regions is output as input for multi-angle reproducibility analysis.
9. A computer vision defect detection system for an electronic control board production line, characterized in that, The system, used in any one of claims 1 to 8, comprises: The image acquisition module is used to divide the entire area of the electronic control board into areas such as surface area, solder joint area, and wiring area based on multi-angle images acquired by the electronic control board at the production line station, combined with lighting conditions and viewing angle information. The feature extraction module is used to perform image block processing based on the surface area image, solder joint area image and trace area image, generate multiple image sub-regions, and extract texture features, brightness distribution features and geometric edge features in each image sub-region to form sub-region combination features; The feature enhancement module is used to perform rare defect feature enhancement processing based on the combined features of sub-regions, perform multi-scale repeated superposition of low-frequency abnormal textures, and perform directional extension of edge breaks to obtain a defect enhancement feature map. The difference comparison module is used to perform difference comparison based on the combination features of the defect enhancement feature map and the corresponding normal region, and to perform normalization correction in combination with lighting conditions and viewing angle information to obtain a set of candidate defect regions. The multi-angle analysis module is used to perform multi-angle reproducibility analysis based on the set of candidate defect areas. When the same suspected defect is detected at different angles, a reliable defect area is formed; otherwise, the interfering area is removed, and the electronic control board defect detection results are generated.