Circuit board production detection method and system based on machine vision and medium
By combining multi-angle image acquisition and polarization filter adjustment with global texture distribution and local structural contour analysis, a standard feature library is established, which solves the problems of low efficiency and high false detection and false negative rates in circuit board detection, and realizes accurate detection and intelligent management of high-density, high-precision circuit boards.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN CAREFUL ELECTRON CO LTD
- Filing Date
- 2026-01-08
- Publication Date
- 2026-05-12
AI Technical Summary
Existing circuit board testing methods are inefficient in high-density, high-precision and miniaturized production environments, are easily affected by the operator's experience and fatigue, and have high rates of false positives and false negatives, making them difficult to adapt to complex backgrounds and differences in solder joint morphology.
By employing multi-angle image acquisition, multi-channel color layering, global texture distribution and local structural contour extraction, combined with polarization filter adjustment, and through pixel distribution curve statistics and feature stability analysis, a standard feature library is established for comparison to identify pixel-level features of circuit board surface components, solder joints and lines.
It significantly improves the accuracy and reliability of circuit board testing, reduces false detections and missed detections, lowers labor costs, adapts to complex backgrounds and diverse solder joint morphologies, ensures product quality consistency and traceability, and enables intelligent monitoring and refined management of the production process.
Smart Images

Figure CN122016866A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision technology, and in particular to a method, system and medium for circuit board production inspection based on machine vision. Background Technology
[0002] As a core component of electronic products, the manufacturing process of printed circuit boards (PCBs) has gradually evolved towards higher density, higher precision, and miniaturization. Traditional PCB inspection methods mainly rely on manual visual inspection and optical microscope-assisted observation to check the quality of solder joints, circuit connectivity, and component placement one by one. While this type of inspection method could meet the quality control needs of low-volume, low-integration products in early production lines, in modern large-scale automated production environments, manual inspection methods have revealed their inefficiencies and susceptibility to the influence of operator experience and fatigue.
[0003] To improve inspection efficiency, existing technologies are gradually incorporating inspection methods based on Automatic Optical Inspection (AOI). This method typically acquires circuit board images using a high-resolution camera and identifies defects using image processing techniques such as template matching, grayscale comparison, or edge extraction. However, due to the rigidity of the rules, this type of inspection method is prone to false positives and false negatives when faced with complex backgrounds and differences in solder joint morphology. Summary of the Invention
[0004] Therefore, the present invention needs to provide a method, system and medium for circuit board production inspection based on machine vision to solve at least one of the above-mentioned technical problems.
[0005] To achieve the above objectives, a machine vision-based circuit board production inspection method includes the following steps: Step S1: Capture multi-angle images of the circuit board to be inspected using a preset camera lens; determine the reflective area of the board surface based on the grayscale gradient differences in the multi-angle images; Step S2: Based on the grayscale distribution of the reflective area on the board surface, identify the reflective interference area and the corresponding polarization direction; adjust the angle of the polarization filter at the front of the shooting lens according to the polarization direction to re-acquire the full-frame image of the circuit board; Step S3: Optimize the corresponding board surface reflection area in the multi-angle image using the full-frame image of the circuit board to obtain the multi-angle optimized image; Step S4: Perform color layering on the multi-angle optimized image, and determine the feature points on the circuit board surface based on the color layering results; Step S5: Compare the feature points on the surface of the circuit board using a preset standard circuit board feature library, and generate a circuit board inspection report based on the comparison results.
[0006] This application achieves pixel-level feature recognition of circuit board surface components, solder joints, and lines by multi-angle image acquisition, multi-channel color layering, global texture distribution and local structural contour extraction, and polarization filter adjustment to eliminate reflection interference. Furthermore, by statistical analysis of pixel distribution curves, feature stability analysis and hierarchical threshold setting, a standard feature library is established for feature information under various working conditions, and this library is used to accurately compare and determine defects in the circuit board to be inspected. By combining multi-angle image acquisition with polarizing filter adjustment, the system effectively suppresses interference from board surface reflections and highlight areas. Simultaneously, global texture distribution and local structural contour analysis enable precise capture of the overall layout and minute features of the circuit board. Stability analysis of pixel distribution curves and grayscale, area, and morphological parameters distinguishes between normal process fluctuations and genuine defects. Multi-channel information and multi-parameter comprehensive judgment further improve recognition accuracy under complex backgrounds and partial occlusion. Comparison with a standard feature library helps accurately differentiate between genuine defects and process fluctuations, significantly reducing false positives and false negatives, improving detection reliability and stability, adapting to the complex backgrounds and diverse solder joint morphologies of high-density, high-precision, and miniaturized circuit board production, ensuring product quality consistency and traceability, while reducing labor costs and operational dependence, achieving intelligent monitoring and refined management of the production process.
[0007] Optionally, this application also provides a machine vision-based circuit board production inspection system for performing the machine vision-based circuit board production inspection method described above. The machine vision-based circuit board production inspection system includes: The data acquisition module is used to capture multi-angle images of the circuit board under test using a preset camera lens; and to determine the reflective area of the board surface based on the grayscale gradient differences of the multi-angle images. The angle feature module is used to identify the reflection interference area and the corresponding polarization direction based on the grayscale distribution of the reflective area on the board surface; and adjust the angle of the polarization filter at the front of the shooting lens according to the polarization direction to re-acquire the full-frame image of the circuit board. The image optimization module is used to optimize the corresponding reflection area of the board surface in multi-angle images using the full-frame image of the circuit board, so as to obtain multi-angle optimized images; The feature point determination module is used to perform color layering on the multi-angle optimized image and determine the feature points on the circuit board surface based on the color layering results. The test report generation module is used to compare the surface feature points of the circuit board with the preset standard circuit board feature library, and generate a circuit board test report based on the comparison results.
[0008] The present application discloses a machine vision-based circuit board production inspection system. This system can implement any of the machine vision-based circuit board production inspection methods of the present application. It serves as a medium for the operation and signal transmission between various modules to complete the machine vision-based circuit board production inspection method. The internal modules of the system cooperate with each other, thereby significantly improving the inspection efficiency and automation level, and reducing the occurrence of false detections and missed detections.
[0009] Optionally, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the machine vision-based circuit board production inspection method described above. Attached Figure Description
[0010] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a schematic diagram of the steps in the machine vision-based circuit board production inspection method of the present invention. Figure 2 This is a disassembly diagram of the imaging lens in an embodiment of the present invention; Figure 3 This is a frontal view image of the circuit board to be tested captured in an embodiment of the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0011] The technical method of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0012] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor methods and / or microcontroller methods.
[0013] It should be understood that although the terms "first," "second," etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are used merely to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0014] To achieve the above objectives, please refer to Figures 1 to 3 This invention provides a machine vision-based circuit board production inspection method, the method comprising the following steps: Step S1: Capture multi-angle images of the circuit board to be inspected using a preset camera lens; determine the reflective area of the board surface based on the grayscale gradient differences in the multi-angle images; In this embodiment, if the circuit board to be inspected enters the inspection station, a 5-megapixel industrial camera fixed above the station is used to capture images from multiple angles, with the shooting angle range from −20° to +20°. Nine images can be acquired sequentially in 5° increments. During each image acquisition, the circuit board's orientation can be adjusted using a precision electric turntable to ensure the light source incident angle remains within 45°±2°. Alternatively, images can be captured using an industrial camera fixed in a fixed position. Subsequently, the grayscale difference between adjacent pixels in the multi-angle images is calculated, and a grayscale gradient matrix is generated. By setting a threshold of 30, regions with local gradients greater than this value are marked as strongly reflective regions. Then, noise points with an area less than 20 pixels are removed using region connectivity calculations, ultimately obtaining the precise distribution of the reflective areas on the board surface.
[0015] Step S2: Based on the grayscale distribution of the reflective area on the board surface, identify the reflective interference area and the corresponding polarization direction; adjust the angle of the polarization filter at the front of the shooting lens according to the polarization direction to re-acquire the full-frame image of the circuit board; In this embodiment, the local grayscale histogram distribution of pixels within the reflective area of the board surface is calculated, and pixels with peak values greater than 20% of the overall grayscale mean are selected as candidate points for reflection interference. Subsequently, the polarizing filter mounted at the front of the lens is rotated in 15° increments within a range of 0° to 180°, and 12 reflection interference images are acquired sequentially. At each angle, the brightness attenuation rate of the candidate reflection interference points is calculated. If the attenuation rate exceeds 40%, the polarization direction corresponding to that angle is determined as the reflection direction. The angle corresponding to the optimal polarization direction is selected, the polarizing filter is fixed at that angle, and a full-frame circuit board image is reacquired to ensure that the reflection area is effectively suppressed.
[0016] Step S3: Optimize the corresponding board surface reflection area in the multi-angle image using the full-frame image of the circuit board to obtain the multi-angle optimized image; In this embodiment, pixels in the original reflection interference area of the full-frame image of the circuit board are used as substitute pixel sources. Through inverse projection calculation based on an industrial camera viewpoint model, the substitute pixels are projected onto the corresponding positions in the previously acquired multi-angle images. The viewpoint model is composed of the camera intrinsic parameter matrix (focal length fx=2400, fy=2385, principal point coordinates cx=1280, cy=960) and extrinsic parameter matrix (rotation and translation parameters), ensuring a projection accuracy of less than 0.5 pixels. Subsequently, the grayscale gradient difference between the substitute pixel and its neighboring pixels is compared. If the difference exceeds 15, mean smoothing is performed on the substitute pixel to eliminate color difference boundaries. After processing, a multi-angle optimized image without significant reflection interference is obtained, providing stable input for subsequent feature extraction.
[0017] Step S4: Perform color layering on the multi-angle optimized image, and determine the feature points on the circuit board surface based on the color layering results; In this embodiment, the multi-angle optimized image is converted into HSV space, and the color histogram of the H channel and the grayscale distribution of the V channel are calculated separately. Adaptive threshold segmentation is used to divide areas with significant color changes into different levels. Subsequently, for clumped regions with a local grayscale mean higher than the overall mean by 20% and an area less than 50 pixels, their roundness parameter is calculated. If the roundness is greater than 0.7, they are identified as solder joint feature points. For strip-shaped regions with a grayscale mean lower than the overall mean by 15% and a connectivity length exceeding 30 pixels, their directional consistency is detected. If the consistency is within ±5°, they are identified as circuit feature points. Block-shaped regions with an area between 100 and 400 pixels and an aspect ratio between 1:2 and 1:4 are identified as component feature points if their edge grayscale gradients are continuous and smooth. Finally, a feature point set containing solder joints, circuits, and component locations is output.
[0018] Step S5: Compare the feature points on the surface of the circuit board using a preset standard circuit board feature library, and generate a circuit board inspection report based on the comparison results.
[0019] In this embodiment, a pre-built standard circuit board feature library is used for comparison. The standard feature library is established from images of 500 qualified circuit boards collected under different process conditions, storing the roundness distribution curves of solder joints, the continuity length and directional consistency range of circuits, and the aspect ratio and edge gradient features of components. During comparison, parameter matching is performed sequentially on the solder joints, circuits, and component feature points of the circuit board to be inspected. If the parameter deviation is within the stability range of the standard library, it is determined to be a qualified feature point; if it exceeds the range, it is marked as a suspected defect point. Finally, the comparison results generate an inspection report, which includes the coordinate position of each feature point, the parameter difference value, and the judgment result, for quality inspectors to review.
[0020] Of particular importance are the methods for constructing the standard circuit board feature library, including: Acquire image acquisition data of standard qualified circuit boards under different process conditions, and determine the global texture distribution and local structural contour of the circuit boards under each working condition based on the image acquisition data under different process conditions. In this embodiment, standard qualified circuit boards that have passed quality inspection are selected as sample objects from the produced circuit boards. An industrial camera with a resolution of 2448×2048 pixels is installed above and to the side of the inspection station, with an adjustable polarizing filter at the front of the lens. To ensure coverage of various process differences, images are acquired at temperatures of 20℃, 25℃, and 30℃ and humidity levels of 40%, 60%, and 80%. At least three viewing angles—frontal, oblique, and low—are captured for each standard qualified circuit board. Subsequently, an image gradient detection operator (such as the Sobel operator, with a 3×3 kernel and a threshold of 20) can be used to calculate the gradient magnitude of each pixel in the horizontal and vertical directions, thereby extracting the overall texture information of the circuit board. This global texture distribution reflects the circuit direction, layout patterns, and line thickness variations, providing basic data for identifying possible process differences. Subsequently, contour extraction operators (such as the Canny operator, with a low threshold of 50 and a high threshold of 150) are used to outline the boundary contours of local components, circuits, and solder joints to obtain local structural contours, which are used for pixel-level positioning of key features and accurate identification of morphological features.
[0021] Calculate the pixel distribution curves of components, circuits and solder joints under each working condition by combining the global texture distribution and local structural contours. In this embodiment, the local contour pixel coordinates of each type of structure are matched with the texture direction and density information in the global texture distribution. The pixel positions and grayscale values of each type of structure are accumulated and statistically analyzed using a two-dimensional image coordinate system. For components and solder joints, they can be grouped according to pixel area and average grayscale value. The distribution density of each group of pixels in the image coordinates is statistically analyzed, and the number of pixels and the change in average grayscale value per millimeter are calculated to form a pixel distribution curve. For circuit structures, the continuous length, grayscale change, and directional consistency of pixels are statistically analyzed along each line segment along the texture direction to generate a pixel curve reflecting the circuit direction and width distribution. During the statistical process, the grayscale threshold can be set to 10~240 (8-bit grayscale range), and the pixel grouping area threshold can be set to 5~500. This ensures that the curve is sensitive to minute structural changes but is not affected by noise.
[0022] It is worth noting that the two-dimensional image coordinate system is used to accurately correspond the global texture distribution with the local structural contours and to provide a unified reference framework for the statistics of pixel distribution curves. In specific implementations, the two-dimensional image coordinate system is established based on the pixel matrix of the original image captured by the industrial camera. Assuming the industrial camera resolution is 2448×2048 pixels, the horizontal pixel numbering is the X-axis, ranging from 0 to 2447, and the vertical pixel numbering is the Y-axis, ranging from 0 to 2047. The origin of the coordinate system is set at the upper left corner of the image. The X-axis increases to the right along the horizontal direction of the image, and the Y-axis increases downwards along the vertical direction of the image. This coordinate system not only records pixel positions but also adds grayscale value information as a third dimension to reflect the intensity of the board surface texture or local brightness differences.
[0023] In one embodiment, taking a surface-mount capacitor as an example, its local contour pixel coordinates are matched with the corresponding texture direction in the global texture distribution, and the gray-level distribution and pixel density of the capacitor in the image coordinate system are statistically analyzed. The number of pixels is accumulated within each millimeter length, and the change in the average gray-level is calculated to form the element pixel distribution curve. For example, an area of approximately 120×80... The capacitor's grayscale average value can fluctuate within the range of 180~220, and the brightness and positional shift under different working conditions can be quantified through the curve.
[0024] In one embodiment, taking the copper foil line connecting IC pins as an example, the length, grayscale variation, and directional consistency of continuous pixels along the line segment are statistically analyzed along the global texture direction. If a line is approximately 15 pixels wide and 500 pixels long, the pixel distribution curve along the texture direction can reflect the actual width variation and grayscale average fluctuation of the line, thereby analyzing whether the line maintains a stable direction and width under process conditions.
[0025] In one embodiment, taking QFN package pin solder joints as an example, local contour pixels are combined with global texture distribution to statistically analyze the circular pixel distribution and grayscale mean of each solder joint. Assuming the solder joint diameter is approximately 20 pixels and the roundness is >0.7, the pixel grayscale values are statistically analyzed along the diameter direction to generate a solder joint pixel distribution curve. This curve can be used to quantify the brightness uniformity and morphological changes of the solder joint, ensuring that the solder joint characteristics remain stable under different temperature and humidity conditions.
[0026] By comparing the changes in pixel distribution curves under various working conditions and calculating the stable range of grayscale, area, and morphological parameters, the feature stability interval under the corresponding working conditions is obtained. In this embodiment, the curve changes of each type of structure under different temperature (20℃, 25℃, 30℃) and humidity (40%, 60%, 80%) conditions are compared using a two-dimensional image coordinate system. Gray-scale mean difference calculation, area proportion statistics, and morphological parameter (such as roundness, aspect ratio, and connectivity) comparisons can be performed on the pixel curves of each type of structure. The gray-scale difference threshold can be set to ±10 gray-scale units, the area proportion change threshold to ±5%, the roundness change threshold to ±0.05, and the connectivity deviation threshold to ±2 pixels. The maximum and minimum value ranges of each parameter under multiple operating conditions are recorded as stable ranges to form characteristic stability ranges for components, circuits, and solder joints under different operating conditions.
[0027] The grading threshold and sustained performance range of the circuit board surface features are determined based on the characteristic stability range under the corresponding operating conditions. In this embodiment, the grayscale value range, area range, and morphological parameter range of the stable interval are divided into several levels. For example, grayscale is divided into three levels: high, medium, and low; area is divided into three levels: small, medium, and large; and morphological parameters are divided into three levels: stable, normal, and abnormal according to the deviation amplitude. Simultaneously, a sustained performance range is defined for each level, meaning that maintaining that level for 10 consecutive frames or 30 consecutive seconds of shooting time constitutes a sustained performance state. In this step, the grayscale level interval can be set to 10 grayscale value units, and the area level interval to 50. The interval between morphological parameter levels should refer to the aforementioned roundness or connectivity length thresholds. For example, if the grayscale stability range of a solder joint under different operating conditions is 180~220, it can be divided into three levels: high grayscale (210~220), medium grayscale (195~209), and low grayscale (180~194), with a grayscale level interval of 10 grayscale units; if the area of a component on the image is stable in the range of 120~300... It can then be divided into small areas (120~160). ), medium area (161~230) ), large area (231~300) Three tiers, with area tiers spaced 50 units apart. Regarding the roundness of solder joints, if the stable range is 0.70~0.95, it can be divided into three levels: stable (0.85~0.95), normal (0.75~0.84), and abnormal (0.70~0.74). Regarding the continuity length of the circuit, if the stable range is 48~52 pixels, it can be divided into three levels: stable (50~52), normal (48~49), and abnormal (<48).
[0028] It is worth noting that, to ensure feature reliability, each level defines a sustained performance range: if a feature remains at a certain level for 10 consecutive frames or 30 consecutive seconds of shooting, it is considered to be in a sustained performance state. For example, if a solder joint's grayscale value of 210-220 appears continuously for 12 frames, it is considered to be in a high grayscale sustained performance state; if the line connection length remains between 50 and 52 pixels for 30 consecutive seconds, it is considered to be in a stable level sustained performance state. In this way, feature stability under different operating conditions can be transformed into quantified grading thresholds and sustained performance standards, providing a precise basis for the construction of a standard circuit board feature library.
[0029] By combining pixel distribution curves under various operating conditions, feature stability intervals, and grading thresholds and sustained performance ranges of circuit board surface features, a standard circuit board feature library is constructed.
[0030] In this embodiment, the pixel distribution curves of each standard qualified circuit board under multiple operating conditions are stored in the form of a two-dimensional matrix. The rows of the matrix represent different combinations of operating conditions (such as temperature × humidity), and the columns represent the pixel coordinates. The corresponding grayscale, area, and morphological stability range are recorded as auxiliary parameters of the matrix. The grading threshold and continuous performance range are stored as a mapping table and associated with the matrix to form a complete feature library. This feature library can support the rapid comparison of the pixel distribution of the board under test with standard features during subsequent circuit board inspection, realizing feature calibration and anomaly determination under polarization, temperature, humidity, and process conditions.
[0031] Optionally, step S1, which involves capturing multi-angle images of the circuit board to be inspected, includes: In response to the detection that the circuit board to be tested has entered the preset testing station, the circuit board to be tested is imaged by an industrial camera fixed above and to the side of the testing station to obtain multi-angle images of the circuit board to be tested. The industrial camera is equipped with an imaging lens, and a polarizing filter is configured at the light outlet of the imaging lens.
[0032] In this embodiment, if the detection system detects that the circuit board to be inspected has entered the preset inspection station, it can responsively trigger the industrial cameras mounted above and to the side to simultaneously acquire images. The upper industrial camera is installed at a height of approximately 50-60 cm directly above the inspection station, with a shooting angle perpendicular to the circuit board surface (0° frontal view) and a resolution set to 2448×2048 pixels. The side industrial camera is installed at a position approximately 30 cm to the side of the circuit board, with a shooting angle forming a 30° to 60° oblique angle with the circuit board surface. It can be adjusted to a low-angle tilt angle of 10° to 20° when necessary to obtain image information under different reflection and shadow conditions on the board surface. Each industrial camera is equipped with an imaging lens, and the light outlet at the front of the lens is equipped with an adjustable polarizing filter. The initial rotation angle of the filter is set to 0°, and the step rotation accuracy is 5°, which is used to optimize the acquired image for areas with reflection interference. The industrial cameras acquire data synchronously through the trigger control system, with the acquisition frame rate set to 10 frames per second. The exposure time can be automatically adjusted to 5-10 milliseconds according to the lighting conditions to ensure moderate image brightness and clear texture details. After acquisition, the top frontal view image, the side oblique view image, and the low-angle image are stored in the image cache in sequence, and the acquisition conditions (temperature, humidity, shooting angle) are labeled to form a multi-angle image set, which provides a complete data foundation for subsequent reflection interference analysis, polarization filter rotation optimization, and multi-angle image combination.
[0033] Optionally, image acquisition of the circuit board to be inspected includes: The industrial camera fixed above the inspection station is controlled to capture a frontal view image of the circuit board under inspection at a 0° angle perpendicular to the surface of the circuit board. In this embodiment, an industrial camera fixed above the inspection station is controlled to capture images from a 0° angle perpendicular to the surface of the circuit board under inspection, obtaining a frontal view image. Specifically, the camera is installed at a height of approximately 55 cm, with a resolution of 2448×2048 pixels. The exposure time is set to 5-8 milliseconds, and the shutter speed and gain are automatically adjusted according to the ambient light intensity to ensure clear board texture and uniform grayscale distribution. During the shooting process, an adjustable polarizing filter is installed at the front of the imaging lens of the industrial camera, with an initial angle of 0° and a rotation step accuracy of 5°, ensuring precise control of the light polarization direction for subsequent optimization against reflection interference.
[0034] An industrial camera fixed to the side of the inspection station is controlled to capture oblique angle images of the circuit board under inspection at an angle of 30° to 60° with respect to the surface of the circuit board under inspection. Then, a low-angle tilted angle image of the circuit board under inspection is captured at an angle of 10° to 20° with respect to the surface of the circuit board under inspection. In this embodiment, an industrial camera fixed to the side of the inspection station is controlled to capture oblique-view images at an angle of 30° to 60° to the circuit board surface to obtain structural information of the circuit board from the tilted perspective. Subsequently, the side camera is adjusted to a low-angle tilt of 10° to 20° to capture local shadows and reflection features on the board surface. Each image undergoes real-time grayscale normalization and noise filtering (Gaussian filtering, 3×3 convolution kernel), and coordinate correction points are marked to provide an accurate basis for subsequent image combination.
[0035] The frontal view image, oblique view image, and low-angle tilted view image are combined, and the combined result is used as a multi-angle image of the circuit board to be inspected.
[0036] In this embodiment, the similarity of the direction of the lines in each image is calculated based on the vector information of the line direction in each image. Then, based on the similarity of the direction, the line texture, pixel density, and local structural boundary information of each image are vector-superimposed to establish a unified two-dimensional reference coordinate system. Subsequently, the images are registered and merged using this reference coordinate system to generate a multi-angle image. This multi-angle image integrates texture, brightness, and reflection information from different perspectives, providing a complete and accurate data foundation for subsequent identification of reflective areas on the board surface, optimization of polarization filter angles, and reacquisition of the full-frame image.
[0037] Optionally, performing image combination includes: Extract the path direction vectors from the frontal view image, oblique view image, and low-angle tilt view image respectively, and calculate the path direction similarity of the image pairs based on the path direction vectors of each image. In this embodiment, the route direction vectors are extracted from the front-view image, the oblique-view image, and the low-angle tilted-view image, respectively. The texture direction of each pixel can be calculated using the image gradient direction and local texture operators (such as the Sobel operator, convolution kernel 3×3, gradient threshold 20). Then, continuous line segments are identified through local direction consistency analysis, and the route direction vector information of each line is generated. Each vector includes the starting point coordinates, the ending point coordinates, the direction angle, and the length attribute to form a set of route direction vectors.
[0038] In a further embodiment, the similarity of the route paths between each image pair is calculated based on the extracted set of route direction vectors. Specifically, the similarity can be calculated by combining the vector angle difference and the proportion of overlapping pixels, as shown in the formula: ;in For the corresponding vector angle difference, To determine the number of overlapping pixels in the vector direction, The total number of pixels in the vector, weight and It can be set to 0.5 to balance the degree of directional and spatial overlap. Through this calculation, the degree of matching of each image pair in the line layout can be determined, providing a basis for vector overlay.
[0039] Based on the similarity of the route directions of image pairs, the route direction vectors of each image pair are superimposed, and a route direction reference coordinate system is established based on the combined route direction vector obtained by superposition. In this embodiment, based on the similarity of the route paths of image pairs, the route path vectors of each image are superimposed to obtain combined vector information. Specifically, a weighted average can be applied to the superimposed vectors, with weights allocated according to the similarity level; image pairs with higher similarity contribute more and therefore have larger weights. Simultaneously, the average coordinates of the vector's start and end points are used to determine the position of the combined vector, generating a unified set of route path combined vectors. Subsequently, a route path reference coordinate system is established based on the combined vector set. This system is a two-dimensional planar coordinate system, where each pixel contains: X and Y coordinates, grayscale value, texture direction information, and superposition weights, used to represent the cumulative contribution of different image route vectors. This reference coordinate system serves as a unified benchmark, enabling precise correspondence between multi-view images on the same plane.
[0040] The frontal view image, oblique view image and low-angle tilt view image are registered and merged using the route reference coordinate system, and the merged result is used as a multi-angle image of the circuit board to be inspected.
[0041] In this embodiment, the established route reference coordinate system is used to register and merge images from the frontal, oblique, and low-angle tilted perspectives. First, the extracted route contours from each image are mapped to a combined vector, and the corresponding pixels are subjected to coordinate mapping and grayscale normalization. Then, multiple images are fused according to their superposition weights to generate a comprehensive grayscale image and a texture direction map. The merged result forms a multi-angle image containing complete circuit board texture information, local structural contours, and reflection features, providing a unified and accurate data foundation for subsequent optimization of the board surface reflection area, adjustment of polarization filter angles, and feature point recognition.
[0042] Optionally, determining the reflective area of the plate surface based on the grayscale gradient differences of the multi-angle images in step S1 includes: Calculate the gray-level gradient values of each pixel in the horizontal and vertical directions in the multi-angle image, and calculate the average gradient value of the pixel based on the gray-level gradient values in the horizontal and vertical directions. In this embodiment, the grayscale gradient values of each pixel in the image are calculated in the horizontal and vertical directions. Specifically, the Sobel operator can be used for gradient calculation, with a convolution kernel size of 3×3 and a threshold range of 20~240 (8-bit grayscale value range). The horizontal gradient is obtained by weighted summation of the pixel's neighborhood. with vertical gradient Then, based on the horizontal gradient of each pixel... with vertical gradient Calculate the average gradient value This gradient value is used to reflect the intensity of local brightness changes and potential high reflectivity of the pixel. It is also stored in a two-dimensional image coordinate system, where each pixel contains X and Y coordinates, grayscale value, and other parameters. , and This information is used for subsequent region division and reflection recognition.
[0043] The multi-angle image is divided into several image regions based on the average gradient value of each pixel; In this embodiment, the multi-angle image is divided into several image regions according to the average gradient value of each pixel. Specifically, the image can be divided into small 8×8 or 16×16 pixel blocks, and the average gradient value of each region can be calculated. The purpose of segmentation is to group pixels with similar local textures into the same region, reducing noise interference and improving the accuracy of reflective region recognition. Each region's data structure includes its top-left corner coordinates, width and height, the set of pixels within the region, and the average gradient value of that region. It is used for comparison with pixels in adjacent regions.
[0044] By comparing the grayscale gradient values of each image region, if the grayscale gradient values of adjacent pixels in both the horizontal and vertical directions are higher than the average gradient value of the corresponding image region, then the adjacent pixels are taken as the reflective area of the board surface.
[0045] In this embodiment, pixels within each image region are compared. If the gradient values of adjacent pixels in the horizontal and vertical directions are similar... , All are higher than the average gradient value of the corresponding region. If a pixel is found to be a reflective pixel on the plate surface, it is determined to be a reflective pixel. In specific implementations, a threshold for the number of consecutive pixels can be set. If two consecutive pixels meet the condition, they are marked as reflective points to reduce false positives due to single-point noise. All marked pixels generate a plate surface reflection area mask in a two-dimensional image coordinate system. Each pixel in the mask contains X and Y coordinates, original grayscale values, and gradient value information, providing a precise positioning basis for subsequent polarization filter angle optimization and full-frame image reacquisition.
[0046] Optionally, step S2 includes: Perform local grayscale mean calculation on the pixels within the reflective area of the board surface, and identify the pixels whose local grayscale mean is greater than the overall grayscale mean of the reflective area as reflective interference areas. In this embodiment, local grayscale mean value calculation is performed on the pixels within the region. Specifically, a 3×3 or 5×5 pixel neighborhood can be used to calculate the local mean value to smooth local noise and enhance brightness features, thus obtaining the local grayscale mean value for each pixel. Subsequently, the local grayscale mean was set to be greater than the overall grayscale mean of the reflective area on the panel. The pixels marked as reflective interference pixels, the overall grayscale average This is the arithmetic mean of the gray levels of all pixels within the region. This processing allows for the differentiation between high-reflectivity interference areas and ordinary texture areas on the board surface, providing a precise positioning basis for adjusting the polarization filter.
[0047] The polarizing filter at the front of the imaging lens of the industrial camera corresponding to the image captured containing the reflective area of the board surface is controlled to perform angular rotation according to a preset step angle, and the image of the reflective interference area is re-acquired at different rotation angles. In this embodiment, an industrial camera capturing images of the reflective area of the panel and a polarizing filter at the front of its imaging lens are controlled to rotate at preset step angles. Specifically, the rotation step angle can be set to 5°~10°, covering a range of 0°~180°, to gradually acquire images of the reflection interference area at different angles. At each rotation angle, the image is acquired by the camera, generating a grayscale matrix and reflection mask data for the corresponding angle. Each pixel contains X and Y coordinates and grayscale value information for subsequent brightness analysis.
[0048] Of particular importance is the acquisition of images of the reflection interference area, including: The circuit board images were re-acquired at different rotation angles, and the reflection interference area images were extracted from the re-acquired circuit board images based on the position of the corresponding pixels in the reflection area of the board surface.
[0049] The brightness attenuation rate of the image in the reflection interference area is calculated at each rotation angle. If the brightness attenuation rate at any rotation angle exceeds the preset brightness attenuation rate threshold, then the rotation angle is taken as the corresponding polarization direction of the reflection interference area. In this embodiment, the brightness attenuation rate of the image in the reflection interference area is statistically analyzed at each rotation angle. Specifically, the brightness attenuation rate can be calculated. : This is used to reflect the effect of polarization angle on suppressing highly reflective pixels. If the brightness attenuation rate exceeds a preset threshold (e.g., 50%) at any rotation angle, then that angle is determined to be the polarization direction corresponding to the reflection interference area. Through this determination, the polarization direction can be accurately identified, achieving light suppression for highly reflective areas.
[0050] Based on the polarization direction, the polarizing filter at the front of the imaging lens is rotated to an angle position orthogonal to the polarization direction in order to re-acquire a full-frame image of the circuit board.
[0051] In this embodiment, based on the determined polarization direction, the polarizing filter at the front of the imaging lens is rotated to an angle orthogonal to that polarization direction (e.g., if the polarization direction is 30°, it is rotated to 120°), and a full-frame image of the circuit board is re-acquired. At this time, the brightness of the reflection interference area is effectively suppressed, and the texture and local structural contours in the image are clearer. The re-acquired full-frame image records the X and Y coordinates, grayscale value, local gradient value, and texture direction information of each pixel in a two-dimensional image coordinate system, providing high-precision basic data for subsequent multi-angle optimization, pixel replacement, and feature point recognition.
[0052] Optionally, step S3 includes: The pixels in the original reflection interference area in the full-frame image of the circuit board are used as replacement pixels. Based on the perspective information of the industrial camera that re-acquired the full-frame image of the circuit board, the replacement pixels are reverse-projected to the corresponding reflection interference area in the multi-angle image. In this embodiment, pixels from the original reflection interference area in the full-frame image are used as replacement pixels. Each replacement pixel contains X and Y coordinates, grayscale value, local gradient value, and texture direction information, stored in a two-dimensional image coordinate system. This coordinate system is the camera acquisition plane coordinate system, with the X-axis parallel to the horizontal direction of the circuit board and the Y-axis parallel to the vertical direction of the circuit board, ensuring that the pixel correspondence remains consistent with multi-angle images for accurate projection.
[0053] In one specific embodiment, based on the industrial camera's viewpoint information from the re-acquired full-frame image, the replacement pixels are inversely projected onto the corresponding reflection interference areas in the multi-angle image. Specifically, a pinhole camera model can be used to calculate the projection for each pixel, using the following formula: ,in For the camera intrinsic parameter matrix, and It is an extrinsic parameter matrix. These are the three-dimensional spatial coordinates corresponding to the pixels of the full-frame image. These are the mapped coordinates on the multi-angle image. After projection, each replacement pixel occupies a precise position in the multi-angle image, achieving high-precision pixel replacement.
[0054] Based on the difference in grayscale gradient between the substitute pixel and its neighboring pixels in the inverse projection result, local interpolation smoothing is performed on the substitute pixel to obtain a multi-angle optimized image.
[0055] In this embodiment, grayscale gradient difference analysis is performed on the substitute pixels after inverse projection and adjacent pixels, followed by local interpolation smoothing. Specifically, bilinear interpolation or cubic spline interpolation methods can be used to calculate and smooth the grayscale mean of the substitute pixels and their neighborhood (e.g., a 5×5 pixel block) to eliminate projection errors and pixel discontinuities. During interpolation, a gradient difference threshold of 10-20 grayscale units can be set, and boundary pixels exceeding the threshold are weighted and smoothed to maintain local texture coherence and line direction consistency. After local interpolation smoothing, a multi-angle optimized image is obtained. The multi-angle optimized image records the X and Y coordinates, grayscale value, gradient value, and texture direction information of each pixel in a two-dimensional image coordinate system, replacing the original reflection interference area pixels while maintaining the original texture and structural features. This image can be directly used for subsequent color layering, feature point recognition, and standard feature library comparison, ensuring the analysis accuracy and consistency of the multi-angle image under different working conditions and reflection conditions.
[0056] Optionally, determining the circuit board surface feature points based on the color layering results in step S4 includes: Calculate the peak grayscale distribution of pixels in each channel based on the color layering results; In this embodiment, HSV color space layering or RGB channel layering can be used to divide each pixel in the multi-angle optimized image into different channel layers according to its grayscale value and color distribution. Subsequently, the peak grayscale distribution of pixels in each channel is calculated, and a grayscale histogram is plotted to obtain the peak grayscale value and overall grayscale mean for each channel, providing a reference benchmark for pixel selection of solder joints, circuits, and components. The grayscale histogram can be plotted using 256 grayscale levels, with each pixel recording its X and Y coordinates, grayscale value, and channel information.
[0057] Based on the grayscale distribution peak, extract clustered pixels with local grayscale average values higher than the overall grayscale average value [20%, 40%] and areas smaller than [5 pixels, 50 pixels], and calculate the roundness of the clustered pixels; if the roundness of the clustered pixels is higher than 0.7 and overlaps with the reflection interference area, then the clustered pixels are determined to be solder joint feature points. In this embodiment, clusters of pixels with a local grayscale mean value 20% to 40% higher than the overall grayscale mean, and an area limited to 5 to 50 pixels, are extracted from each channel. The roundness of each cluster of pixels is calculated. And combined with local gradient continuity analysis: if roundness If the intensity of the pixel cluster is greater than 0.7 and the local gradient change is less than 10 grayscale units below the threshold, and the cluster of pixels overlaps with the original reflection interference area by at least 10%, then it is identified as a solder joint feature point. During the identification process, the local light spot intensity distribution of the solder joint is also recorded for subsequent solder joint quality analysis, such as determining whether there are protrusions or insufficient solder.
[0058] The grayscale distribution peak value is used to identify strip-shaped pixels whose local grayscale mean is lower than the overall grayscale mean [10%, 20%] and whose continuous length is greater than [20 pixels, 50 pixels]. The connectivity length and local orientation consistency of the strip-shaped pixels are calculated. If the connectivity length of the strip-shaped pixels exceeds the preset connectivity length threshold and the local orientation consistency is within the preset stable direction range, then the strip-shaped pixel is determined to be a line feature point. In this embodiment, strip-shaped pixels with a grayscale mean lower than the overall grayscale mean by 10% to 20% and a continuous length greater than 20 to 50 pixels are extracted. Orientation consistency analysis is performed on each strip-shaped pixel: the strip-shaped pixel is divided into 5 to 10 pixel segments along its main direction, and the deviation of the local direction of each segment from the main direction of the strip is calculated. If the average deviation is ≤5°, the strip-shaped pixel is considered to have a stable orientation. Simultaneously, the grayscale gradient change and linewidth fluctuation of the strip-shaped pixels are statistically analyzed. The grayscale gradient is allowed to fluctuate by ±15 grayscale units, and the linewidth is allowed to change by ±1 pixel. Strip-shaped pixels that only meet the conditions of orientation consistency, stable grayscale, and stable linewidth are identified as line feature points. This process can generate structured data containing the length, average grayscale, linewidth, and orientation of each line, which can be used for complex line comparison and defect detection.
[0059] The grayscale distribution peak value is used to identify block pixels with local grayscale average values higher than the overall grayscale average value [10%, 30%] and areas larger than [100 pixels, 500 pixels]. The aspect ratio and edge grayscale gradient distribution of the block pixels are calculated. If the aspect ratio of the block pixels is within the preset element aspect ratio range and the edge grayscale gradient distribution is continuous and smooth, then the block pixels are determined to be element feature points. In this embodiment, blocks of pixels with a local grayscale mean 10% to 30% higher than the overall grayscale mean and an area ranging from 100 to 500 pixels are extracted. The aspect ratio is calculated for each block of pixels. Simultaneously, edge grayscale gradient continuity analysis is performed: the Sobel operator is used to calculate the gradient map of the block edges, and gradient continuity requires that at least 90% of the edge pixel gradient changes are less than 10 grayscale units. If the aspect ratio is in the range of 0.8 to 1.2 and the edge gradient is continuous, it is determined to be a component feature point. Further, the grayscale centroid coordinates, edge gradient direction distribution, and local texture direction of the block pixels can be recorded to distinguish between patch components, plug-in components, and irregular components.
[0060] Solder joint feature points, circuit feature points, and component feature points are used as feature points on the circuit board surface.
[0061] In this embodiment, after identifying solder joints, circuits, and component feature points, the three types of feature points are uniformly recorded in a two-dimensional image coordinate system. Each feature point structure includes: X and Y coordinates, grayscale value, area or length information, roundness or aspect ratio, local gradient distribution, texture direction, overlap information with reflective areas, and channel grayscale peak references. This structured data can be directly used for standard feature library comparison, feature stability analysis, and defect detection. It also supports statistical analysis of pixel distribution curves under different operating conditions and multi-dimensional feature analysis, providing a repeatable and verifiable technical foundation for high-precision, multi-condition circuit board inspection.
[0062] Optionally, this application also provides a machine vision-based circuit board production inspection system for performing the machine vision-based circuit board production inspection method described above. The machine vision-based circuit board production inspection system includes: The data acquisition module is used to capture multi-angle images of the circuit board under test using a preset camera lens; and to determine the reflective area of the board surface based on the grayscale gradient differences of the multi-angle images. The angle feature module is used to identify the reflection interference area and the corresponding polarization direction based on the grayscale distribution of the reflective area on the board surface; and adjust the angle of the polarization filter at the front of the shooting lens according to the polarization direction to re-acquire the full-frame image of the circuit board. The image optimization module is used to optimize the corresponding reflection area of the board surface in multi-angle images using the full-frame image of the circuit board, so as to obtain multi-angle optimized images; The feature point determination module is used to perform color layering on the multi-angle optimized image and determine the feature points on the circuit board surface based on the color layering results. The test report generation module is used to compare the surface feature points of the circuit board with the preset standard circuit board feature library, and generate a circuit board test report based on the comparison results.
[0063] Optionally, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the machine vision-based circuit board production inspection method described above.
[0064] Figure 2 This is a disassembly diagram of the imaging lens in an embodiment of the present invention; as shown. Figure 2 As shown, the imaging lens is composed of several functional components installed sequentially, including: The filter clip 101 provides a convenient interface for the installation and removal of filters, allowing filter replacement without unscrewing the entire lens. Front-end filter 102, which can be a polarizing filter, a neutral density filter or a protective lens, is used to control the intensity and direction of light entering the lens or to prevent foreign objects from damaging the lens during shooting. The auxiliary pressure ring 103 is typically used to provide a secure support between the filter and the lens interface, ensuring the stability and tightness of the filter after installation, while preventing the filter from loosening or falling off due to vibration. The rotating locking buckle 104 is designed to cooperate with the lens front end connecting groove. It achieves the positioning and locking of the filter assembly through elastic engagement, preventing the filter from rotating or falling off due to external force when no adjustment is made. At the same time, after the filter is installed, the buckle can be rotated and adjusted within a preset angle range, so that polarizing filters or special effect filters can be precisely rotated according to shooting needs, thereby controlling the polarization direction of light or the filter effect. The front lens retaining ring 105 is a ring-shaped component that connects and supports the front optical lens group, ensuring the stability of the relative position of the optical elements and reserving installation space for the upper filter assembly. The lens body 106, which contains multiple optical elements, an aperture mechanism, and a focusing drive system, is the core component for image formation. Through its cooperation with the front retaining ring and filter assembly, this body ensures the overall optical system maintains optical performance while also accommodating the expansion capabilities of external add-on components.
[0065] exist Figure 2 In this embodiment, the filter components (101 and 102 in conjunction with 103 and 104) can be quickly changed according to shooting needs, while the combination of the retaining ring 105 and the lens body 106 ensures the overall stability of the optical structure. This application does not limit this aspect; different types of filters or adjustments to the clip structure can be made depending on the specific application scenario.
[0066] It is worth noting that, Figure 3 This is a schematic diagram for capturing a frontal view image of the circuit board to be inspected. It only shows the effect of frontal view shooting. The image can be adaptively adjusted according to the distance and size of the circuit board and the industrial camera. This application does not limit this.
[0067] Therefore, the embodiments should be considered as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of the equivalents of the application are intended to be included within the invention.
[0068] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features of the invention herein.
Claims
1. A machine vision-based circuit board production inspection method, characterized in that, Includes the following steps: Step S1: Capture multi-angle images of the circuit board to be inspected using a preset camera lens; determine the reflective area of the board surface based on the grayscale gradient differences in the multi-angle images; Step S2: Based on the grayscale distribution of the reflective area on the board surface, identify the reflective interference area and the corresponding polarization direction; adjust the angle of the polarization filter at the front of the shooting lens according to the polarization direction to re-acquire the full-frame image of the circuit board; Step S3: Optimize the corresponding board surface reflection area in the multi-angle image using the full-frame image of the circuit board to obtain the multi-angle optimized image; Step S4: Perform color layering on the multi-angle optimized image, and determine the feature points on the circuit board surface based on the color layering results; Step S5: Compare the feature points on the surface of the circuit board using a preset standard circuit board feature library, and generate a circuit board inspection report based on the comparison results.
2. The circuit board production inspection method based on machine vision according to claim 1, characterized in that, Step S1 involves capturing multi-angle images of the circuit board under test, including: In response to the detection that the circuit board to be tested has entered the preset testing station, the circuit board to be tested is imaged by an industrial camera fixed above and to the side of the testing station to obtain multi-angle images of the circuit board to be tested. The industrial camera is equipped with an imaging lens, and a polarizing filter is configured at the light outlet of the imaging lens.
3. The circuit board production inspection method based on machine vision according to claim 2, characterized in that, Image acquisition of the circuit board to be tested includes: The industrial camera fixed above the inspection station is controlled to capture a frontal view image of the circuit board under inspection at a 0° angle perpendicular to the surface of the circuit board. An industrial camera fixed to the side of the inspection station is controlled to capture oblique angle images of the circuit board under inspection at an angle of 30° to 60° with respect to the surface of the circuit board under inspection. Then, a low-angle tilted angle image of the circuit board under inspection is captured at an angle of 10° to 20° with respect to the surface of the circuit board under inspection. The frontal view image, oblique view image, and low-angle tilted view image are combined, and the combined result is used as a multi-angle image of the circuit board to be inspected.
4. The circuit board production inspection method based on machine vision according to claim 3, characterized in that, Performing image combination includes: Extract the path direction vectors from the frontal view image, oblique view image, and low-angle tilt view image respectively, and calculate the path direction similarity of the image pairs based on the path direction vectors of each image. Based on the similarity of the route directions of image pairs, the route direction vectors of each image pair are superimposed, and a route direction reference coordinate system is established based on the combined route direction vector obtained by superposition. The frontal view image, oblique view image and low-angle tilt view image are registered and merged using the route reference coordinate system, and the merged result is used as a multi-angle image of the circuit board to be inspected.
5. The circuit board production inspection method based on machine vision according to claim 1, characterized in that, Step S1, determining the reflective area of the plate surface based on the grayscale gradient differences of the multi-angle images, includes: Calculate the gray-level gradient values of each pixel in the horizontal and vertical directions in the multi-angle image, and calculate the average gradient value of the pixel based on the gray-level gradient values in the horizontal and vertical directions. The multi-angle image is divided into several image regions based on the average gradient value of each pixel; By comparing the grayscale gradient values of each image region, if the grayscale gradient values of adjacent pixels in both the horizontal and vertical directions are higher than the average gradient value of the corresponding image region, then the adjacent pixels are taken as the reflective area of the board surface.
6. The circuit board production inspection method based on machine vision according to claim 1, characterized in that, Step S2 includes: Perform local grayscale mean calculation on the pixels within the reflective area of the board surface, and identify the pixels whose local grayscale mean is greater than the overall grayscale mean of the reflective area as reflective interference areas. The polarizing filter at the front of the imaging lens of the industrial camera corresponding to the image captured containing the reflective area of the board surface is controlled to perform angular rotation according to a preset step angle, and the image of the reflective interference area is re-acquired at different rotation angles. The brightness attenuation rate of the image in the reflection interference area is calculated at each rotation angle. If the brightness attenuation rate at any rotation angle exceeds the preset brightness attenuation rate threshold, then the rotation angle is taken as the corresponding polarization direction of the reflection interference area. Based on the polarization direction, the polarizing filter at the front of the imaging lens is rotated to an angle position orthogonal to the polarization direction in order to re-acquire a full-frame image of the circuit board.
7. The circuit board production inspection method based on machine vision according to claim 1, characterized in that, Step S3 includes: The pixels in the original reflection interference area in the full-frame image of the circuit board are used as replacement pixels. Based on the perspective information of the industrial camera that re-acquired the full-frame image of the circuit board, the replacement pixels are reverse-projected to the corresponding reflection interference area in the multi-angle image. Based on the difference in grayscale gradient between the substitute pixel and its neighboring pixels in the inverse projection result, local interpolation smoothing is performed on the substitute pixel to obtain a multi-angle optimized image.
8. The circuit board production inspection method based on machine vision according to claim 1, characterized in that, Step S4, which determines the feature points on the circuit board surface based on the color layering results, includes: Calculate the peak grayscale distribution of pixels in each channel based on the color layering results; Based on the grayscale distribution peak, extract clustered pixels with local grayscale average values higher than the overall grayscale average value [20%, 40%] and areas smaller than [5 pixels, 50 pixels], and calculate the roundness of the clustered pixels; if the roundness of the clustered pixels is higher than 0.7 and overlaps with the reflection interference area, then the clustered pixels are determined to be solder joint feature points. The grayscale distribution peak value is used to identify strip-shaped pixels whose local grayscale mean is lower than the overall grayscale mean [10%, 20%] and whose continuous length is greater than [20 pixels, 50 pixels]. The connectivity length and local orientation consistency of the strip-shaped pixels are calculated. If the connectivity length of the strip-shaped pixels exceeds the preset connectivity length threshold and the local orientation consistency is within the preset stable direction range, then the strip-shaped pixel is determined to be a line feature point. The grayscale distribution peak value is used to identify block pixels with local grayscale average values higher than the overall grayscale average value [10%, 30%] and areas larger than [100 pixels, 500 pixels]. The aspect ratio and edge grayscale gradient distribution of the block pixels are calculated. If the aspect ratio of the block pixels is within the preset element aspect ratio range and the edge grayscale gradient distribution is continuous and smooth, then the block pixels are determined to be element feature points. Solder joint feature points, circuit feature points, and component feature points are used as feature points on the circuit board surface.
9. A circuit board production inspection system based on machine vision, characterized in that, For performing the machine vision-based circuit board production inspection method as described in claim 1, the machine vision-based circuit board production inspection system includes: The data acquisition module is used to capture multi-angle images of the circuit board under test using a preset camera lens; and to determine the reflective area of the board surface based on the grayscale gradient differences of the multi-angle images. The angle feature module is used to identify the reflection interference area and the corresponding polarization direction based on the grayscale distribution of the reflective area on the board surface; and adjust the angle of the polarization filter at the front of the shooting lens according to the polarization direction to re-acquire the full-frame image of the circuit board. The image optimization module is used to optimize the corresponding reflection area of the board surface in multi-angle images using the full-frame image of the circuit board, so as to obtain multi-angle optimized images; The feature point determination module is used to perform color layering on the multi-angle optimized image and determine the feature points on the circuit board surface based on the color layering results. The test report generation module is used to compare the surface feature points of the circuit board with the preset standard circuit board feature library, and generate a circuit board test report based on the comparison results.
10. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed, implements the machine vision-based circuit board production inspection method as described in any one of claims 1-8.