Online adjustment method for camera parameters in binocular vision measurement system

By adjusting the camera spacing and parameters in the binocular vision measurement system, detecting image distortion and faults, and dynamically adjusting the exposure time and aperture, the image quality fluctuation caused by the fixed camera parameters in traditional systems is solved, and efficient and intelligent three-dimensional reconstruction and closed-loop control are achieved.

CN120472016AInactive Publication Date: 2025-08-12SHENZHEN ZHONGRUIWEISHI PHOTOELECTRONICS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510978256.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-08-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In traditional binocular vision measurement systems, the camera parameters are fixed and cannot be dynamically adjusted according to environmental changes, resulting in large fluctuations in image quality, affecting the accuracy of three-dimensional reconstruction, and lacking real-time and intelligent capabilities.

Method used

By acquiring camera position data, adjusting the camera spacing and setting a three-dimensional baseline, performing dual-target determination, detecting image distortion and identifying circuit board failures, adjusting exposure time and aperture according to the degree of signal attenuation, building a depth map and performing three-dimensional reconstruction, realizing online adjustment of camera parameters and closed-loop control.

Benefits of technology

It improves the stability of image acquisition and three-dimensional reconstruction accuracy, enhances the system's adaptability in complex environments, and realizes intelligent, efficient and closed-loop control of camera parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120472016A_ABST
    Figure CN120472016A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of industrial vision, in particular to an online adjustment method for camera parameters in a binocular vision measurement system. The method comprises the following steps: acquiring camera position data, and adjusting a camera distance to set a three-dimensional base line to obtain three-dimensional base line data; acquiring a calibration image based on the camera position data, and executing binocular calibration based on the calibration image and the stereo baseline data to generate a binocular calibration parameter; collecting a binocular image according to the binocular calibration parameter; performing image distortion detection based on the binocular image to obtain image distortion data; performing circuit board fault detection based on the image distortion data to obtain circuit board fault data; determining a signal attenuation degree based on the circuit board fault data; and performing exposure time adjustment based on the signal attenuation degree to obtain exposure time adjustment data. According to the invention, adaptive linkage and closed-loop optimization control of camera parameters are realized based on an industrial vision technology, so that the precision of three-dimensional measurement and the stability of image acquisition are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of industrial vision technology, and in particular to an online adjustment method for camera parameters in a binocular vision measurement system. Background Art

[0002] Traditional binocular vision measurement systems typically use fixed camera parameter settings, making it impossible to dynamically adjust camera parameters based on environmental factors such as light intensity, target motion, or circuit board status. This results in significant image quality fluctuations, impacting 3D reconstruction accuracy. Adjusting camera pose and exposure settings often relies on manual intervention or periodic offline calibration, which is inefficient and lacks real-time performance, failing to meet the rapid response requirements of highly dynamic industrial sites. The system lacks in-depth diagnostic and feedback mechanisms for image quality degradation. For example, it cannot pinpoint optical issues based on image distortion or track hardware failures through signal attenuation, resulting in untargeted parameter adjustments. Parameter linkages are often overlooked, such as the coordinated adjustments of exposure time, gain, and aperture, which are often handled in isolation, failing to globally optimize image acquisition quality. The lack of a closed-loop feedback mechanism between depth maps and 3D models prevents optimization of acquisition frame rates or reconstruction strategies based on 3D structure detection results. This results in a lack of closed-loop control between parameter adjustments and the final 3D measurement task, limiting the system's intelligence, adaptability, and stability. Summary of the Invention

[0003] Based on this, it is necessary for the present invention to provide a method for online adjustment of camera parameters in a binocular vision measurement system to solve at least one of the above technical problems.

[0004] To achieve the above object, a method for online adjustment of camera parameters in a binocular vision measurement system comprises the following steps: Step S1: Acquire camera position data and adjust the camera spacing to set a stereo baseline to obtain stereo baseline data; collect a calibration image based on the camera position data, and perform binocular positioning based on the calibration image and the stereo baseline data to generate binocular positioning parameters; Step S2: collecting binocular images according to binocular positioning parameters; performing image distortion detection based on the binocular images to obtain image distortion data; performing circuit board fault detection based on the image distortion data to obtain circuit board fault data; and determining the degree of signal attenuation based on the circuit board fault data. Step S3: adjusting the exposure time based on the degree of signal attenuation to obtain exposure time adjustment data; performing motion blur simulation based on the exposure time adjustment data to obtain motion blur data; evaluating the blur degree based on the motion blur data, and adjusting the aperture size based on the blur degree to obtain aperture adjustment data; Step S4: Acquire a binocular optimized image based on the aperture adjustment data; draw a depth map based on the binocular optimized image; convert the depth map into point cloud data, and perform three-dimensional reconstruction of the target object based on the point cloud data to obtain a three-dimensional target object model; perform three-dimensional structure deviation detection based on the three-dimensional target object model to obtain three-dimensional structure deviation data; adjust the acquisition frame rate based on the three-dimensional structure deviation data, and transmit the adjusted acquisition frame rate to the camera management platform to perform the camera parameter online adjustment task.

[0005] This invention ensures the accuracy of the inter-camera geometry and improves stereo matching accuracy by introducing camera spacing adjustment and stereo baseline parameter setting. By dynamically acquiring calibration images and performing dual-target calibration operations in conjunction with the stereo baseline, a high-precision intrinsic and extrinsic parameter matrix is obtained, laying the foundation for high-quality image processing and 3D reconstruction. The system can perform real-time distortion detection for each image acquisition process, identifying the degree and distribution of image distortion, effectively determining optical deviations caused by lens aging, camera module displacement, and other factors, thereby accurately locating optical path distortion issues. Image distortion characteristics are further transmitted to the circuit board fault analysis process. Signal integrity and image consistency change data can be used to determine sensor hardware connection status and circuit performance anomalies, accurately identifying the degree of signal attenuation in the transmission channel. The exposure time parameter is actively adjusted based on the degree of signal attenuation to ensure a stable image grayscale distribution. Based on this, a motion blur simulation mechanism is established to achieve controllable estimation of the degree of blur in fast-motion scenes. The aperture parameter is adjusted inversely based on the degree of blur, achieving coordinated optimization between image dynamic range and depth of field control, enhancing the adaptive ability to image optical quality in complex dynamic environments. After optimizing image acquisition, a high-density depth map is directly constructed based on the binocular optimized image and a point cloud model is generated, effectively improving the spatial resolution and geometric accuracy of the 3D reconstruction process. The 3D reconstructed model is then input into the structural tolerance detection process, where processing errors or assembly deviations are identified by comparison with CAD design standards. The image acquisition frame rate is adjusted using error feedback, achieving a closed-loop response mechanism for image acquisition parameters to 3D reconstruction requirements. The system breaks through the traditional manual adjustment mode through an automated parameter flow adjustment strategy, and has the ability to adjust exposure time, aperture, frame rate, and posture in a coordinated manner. It also combines real-time image quality with 3D reconstruction feedback to build a closed-loop control chain, improving the system's overall adaptability to high-dynamic industrial environments and online response performance, and achieving intelligent, efficient, and closed-loop control capabilities for online adjustment of camera parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments thereof made with reference to the following drawings: Figure 1 A schematic flow chart of the steps of a method for online adjustment of camera parameters in a binocular vision measurement system according to the present invention; Figure 2 Detailed step flow diagram of step S1 in the present invention; The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0007] The following is a clear and complete description of the technical method of the present invention in conjunction with the accompanying drawings. Obviously, the embodiments described are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making any creative work are within the scope of protection of the present invention.

[0008] In addition, the accompanying drawings are merely schematic illustrations of the present invention and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor and / or microcontroller approaches.

[0009] It should be understood that although the terms "first," "second," and the like may be used herein to describe various elements, these elements should not be limited by these terms. These terms are used solely to distinguish one element from another. For example, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element, without departing from the scope of the exemplary embodiments. The term "and / or" as used herein includes any and all combinations of one or more of the listed associated items.

[0010] To achieve this, please refer to Figures 1 to 2 The present invention provides a method for online adjustment of camera parameters in a binocular vision measurement system, the method comprising the following steps: Step S1: Acquire camera position data and adjust the camera spacing to set a stereo baseline to obtain stereo baseline data; collect a calibration image based on the camera position data, and perform binocular positioning based on the calibration image and the stereo baseline data to generate binocular positioning parameters; In this example, two industrial-grade CCD cameras (Basler acA1920-40gc) were first deployed using a fixed mounting bracket. Relative movement between the two cameras was achieved by adjusting a slide rail on the bracket. The slide rail has a minimum adjustment accuracy of 0.5 mm and can be freely adjusted between 30 mm and 200 mm, ultimately setting the two cameras at a fixed baseline distance of 90 mm. A laser rangefinder (such as the Keyence LR-TB5000) was used to measure the camera separation to obtain stereo baseline data. Subsequently, a standard checkerboard pattern calibration plate (9×6 black and white checkerboard grids, each 10 mm × 10 mm square) was placed in the center of the common field of view of the two cameras to ensure uniform illumination and no shadows. The two cameras were controlled to sequentially capture at least ten checkerboard images, with an image resolution of 1920 × 1200, a frame rate of 30 fps, a shutter time of 10 ms, and a fixed aperture of f / 5.6. The image data was saved as 16-bit grayscale images. The captured images were processed using the findChessboardCorners() and stereoCalibrate() functions in OpenCV 4.5.5 to calculate the two-object calibration parameters, including the intrinsic matrix, distortion coefficients, rotation matrix, and translation vectors for the two cameras. The distortion coefficients, including k1, k2, p1, p2, and k3, were calculated using an iterative optimization algorithm using the calibration board image as input. An optimization error of less than 0.3 pixels was considered acceptable for calibration.

[0011] Step S2: collecting binocular images according to binocular positioning parameters; performing image distortion detection based on the binocular images to obtain image distortion data; performing circuit board fault detection based on the image distortion data to obtain circuit board fault data; and determining the degree of signal attenuation based on the circuit board fault data. In this embodiment, the camera is fixed in position and controlled to simultaneously capture binocular image data from the same scene. The image size is maintained at 1920×1200 and the format is uncompressed grayscale. The undistort() function in OpenCV is used to perform distortion correction on the binocular image based on the distortion parameters obtained in step S1. Differential analysis is performed on the pre- and post-correction images to detect the degree of image distortion. A threshold is set such that significant distortion is considered present when the percentage of pixels with a grayscale difference of greater than 20 between the pre- and post-correction pixels exceeds 5%. Based on this, the YOLOv5 image object detection algorithm is used to detect various regions in the circuit board image and compare the connection status, solder joint morphology, and wire arrangement preset in the original image template. If the average brightness of the solder joint within a 10×10 pixel window is lower than the set threshold (80 / 255), or if the detected solder joint size deviation exceeds ±15 pixels, it is recorded as a localized fault area on the circuit board. Image brightness curves were collected for each inspection area. Decreases in brightness due to occlusion, dirt, or connection breakages were recorded and converted into signal attenuation, quantified on a scale of 0 to 100, with 0 indicating no attenuation and 100 indicating complete interruption. A local mean filter was used to process the pixel values in each area, using the original template brightness as the reference baseline.

[0012] Step S3: adjusting the exposure time based on the degree of signal attenuation to obtain exposure time adjustment data; performing motion blur simulation based on the exposure time adjustment data to obtain motion blur data; evaluating the blur degree based on the motion blur data, and adjusting the aperture size based on the blur degree to obtain aperture adjustment data; In this embodiment, after completing the signal attenuation analysis in step S2, the camera exposure time is graded and adjusted according to a predefined interval rule based on the signal attenuation data for each region of the circuit board image obtained from this analysis. When the signal attenuation value for a region is between 30 and 60, the system multiplies the original exposure time of 10ms by 1.5, resulting in an adjusted exposure time of 15ms. When the signal attenuation value is between 60 and 90, the system doubles the exposure time to 20ms. To prevent image saturation caused by excessive exposure time in extreme cases, the system sets a maximum exposure time limit of 25ms, which is not allowed to be exceeded under any circumstances. The exposure time adjustment values corresponding to each region are organized into an exposure configuration table, which contains the coordinate information of each image region, the corresponding attenuation level, and the adjusted exposure time parameters. This parameter is then written into the camera control system. The camera communicates with the main control system using the GigE Vision interface standard. Exposure time parameters are sent to the camera one by one by calling the SetExposureTime() method in the manufacturer's driver library (such as the Basler Pylon SDK), enabling adjustment instructions to be loaded into the image acquisition process in real time. Next, the camera is driven along a track by a stepper motor control module, simulating relative motion in an actual production line environment. The track speed is set to 0.5 meters per second, ensuring stable and jitter-free movement. The camera continuously captures image sequences at 30 frames per second for 10 seconds, totaling 300 frames. After acquisition, these images are processed by the image quality analysis module, focusing on changes in edge definition. The image analysis module first performs Sobel edge detection on the image, extracting gradient direction information from each image region. The image is then divided into 20×20 pixel regions and the gradient direction histogram within each region is calculated. If the gradient value of a certain area changes by less than 3 pixel grayscale units and accounts for more than 70% of the total number of pixels in the area, the area is judged to have obvious motion blur. For the blurred area detected above, the system activates the mechanical aperture control device to adjust the aperture parameters of the current camera. The initial aperture is set to f / 5.6. In order to increase the amount of light entering and improve image clarity, the system first adjusts the aperture to f / 4.0. This operation is achieved by controlling the stepper motor in the electric aperture device. During execution, the exposure gain curve set in the exposure compensation module is referenced to ensure that the change in light entering is proportional to the change in image brightness.After adjusting the aperture, the system captures new image segments of the blurred area and performs a contrast assessment. This assessment is based on grayscale histogram analysis, calculating the difference between the image's contrast distribution (i.e., the difference between the maximum and minimum grayscale values) and the standard image's contrast. If the contrast of the new image decreases by more than 20%, the aperture adjustment is considered insufficient. The system then further opens the aperture to f / 2.8 and re-acquires and assesses the image quality until both image clarity and contrast return to within the preset standard range. Throughout these operations, image acquisition, parameter adjustment, and image quality analysis are centrally managed by the image processing control platform. Built on the Qt development environment, this platform handles acquisition commands, parameter updates, and image processing workflows through a multi-threaded task queue, ensuring that the image adjustment process does not conflict with real-time acquisition. Historical data from all parameter adjustments is recorded for subsequent analysis and maintenance. This approach ensures that the binocular vision system can automatically adjust camera exposure and aperture settings based on actual image quality feedback when faced with conditions such as localized image blur, insufficient lighting, and unclear objects, thereby continuously obtaining stable, high-quality image data input.

[0013] Step S4: Acquire a binocular optimized image based on the aperture adjustment data; draw a depth map based on the binocular optimized image; convert the depth map into point cloud data, and perform three-dimensional reconstruction of the target object based on the point cloud data to obtain a three-dimensional target object model; perform three-dimensional structure deviation detection based on the three-dimensional target object model to obtain three-dimensional structure deviation data; adjust the acquisition frame rate based on the three-dimensional structure deviation data, and transmit the adjusted acquisition frame rate to the camera management platform to perform the camera parameter online adjustment task.

[0014] In this example, the adjusted camera parameters (exposure time, aperture) are fixed as the shooting configuration, and the binocular system is used to capture images of the target area again. Each acquisition consists of 10 image pairs. Each pair undergoes disparity processing using a binocular stereo correction function. The disparity map is extracted using the SGBM (Semi-Global Block Matching) algorithm, with a window size of 11×11, a minimum disparity value of 0, and a maximum disparity value of 128. After generating the disparity map, the reprojectImageTo3D() function in OpenCV is called to convert it into point cloud data, preserving millimeter-level 3D coordinate accuracy. The point cloud data is then imported into the PCL (Point Cloud Library) for filtering, using a Voxel Grid filter for spatial downsampling, with a voxel size of 1mm×1mm×1mm. The point cloud is clustered using the PCL region growing algorithm. After identifying the target object's boundaries, the GreedyProjectionTriangulation method is used to perform 3D surface reconstruction, generating a complete 3D model. A custom geometric rule library is then used to perform 3D structural analysis on the reconstructed model. For example, if the circuit board thickness in a certain area is less than 1.4mm (the standard is 1.6±0.1mm), or if the aperture offset is greater than 0.2mm, it is marked as a structural out-of-tolerance area. The out-of-tolerance data is organized into a structure list containing location coordinates, deviations, area labels, and other information, and converted into frame rate adjustment instructions. If the out-of-tolerance area is detected more than three times in a row, the acquisition frame rate is reduced from 30fps to 15fps to improve image clarity, and a frame rate control parameter is added to the acquisition instruction. The acquisition frame rate parameter is transmitted to the camera management platform via the RESTful API interface using the HTTP protocol. The camera's embedded control system executes the adjustment instruction, completing the online parameter adjustment task.

[0015] Preferably, step S1 is specifically as follows: Step S11: Obtain camera position data and extract camera space coordinates; In this embodiment, a six-degree-of-freedom robotic arm equipped with two industrial cameras (model FLIR BFS-U3-13Y3C) is used for positioning. Each camera is fixed to a bracket equipped with a laser ranging module. The system uses an encoder to read the position coordinates of the robotic arm's end effector and, in combination with a laser ranging sensor (with a resolution of 0.1mm), measures the distance between the camera and the calibration plane. The robotic arm's end position data is converted to the world coordinate system, using a right-handed rectangular coordinate system with the origin set at the lower left corner of the calibration plane. The precise position of the camera's optical center in three-dimensional space is calculated based on the robotic arm's TCP coordinates and the installation offset value. The spatial coordinates of the two cameras are ultimately output in the form of (X, Y, Z) in millimeters, with an accuracy of ±0.5mm. This position data serves as input parameters for subsequent posture calculation and stereo baseline setting.

[0016] Step S12: adjusting the camera posture based on the camera space coordinates to obtain camera posture data; In this embodiment, the system obtains initial attitude angle information by reading real-time attitude data (Yaw, Pitch, and Roll) output by the gyroscope module and three-axis accelerometer (MPU-9250) on the camera mounting platform. This information is then converted into a quaternion representation, which describes the camera's rotational state. To ensure consistent camera attitude, a high-precision rotation stage (with a resolution of 0.01°) adjusts the camera's rotation angle around the Z axis to within ±0.5°, ensuring that the optical axes of both cameras are aligned in the same plane. An attitude compensation algorithm is used to adjust the pitch and roll angles of each camera, keeping both within ±0.2°. The final attitude angle information is output and recorded as a quaternion, forming the camera attitude data, in radians and accurate to four decimal places.

[0017] Step S13: reconstructing the viewing angle according to the camera posture data to obtain camera viewing angle configuration data; In this embodiment, the posture data output from step S12 is input into the OpenGL graphics rendering engine. By setting the direction vector of the virtual camera's view cone to be consistent with the world coordinate system, the current camera's perspective in space is reconstructed. By constructing a view matrix and applying translation and rotation transformations, the camera's perspective configuration data is generated, including the view cone's position vector (Camera Position Vector), forward vector (Forward Vector), right vector (Right Vector), and up vector (Up Vector). In the rendering engine, the system simulates the perspective with a 60° FOV (field of view) and a 4:3 image aspect ratio. The system measures the three-dimensional boundary information of each camera's coverage field of view and outputs it as a set of three-dimensional vector coordinates. This information is used for perspective reconstruction and spatial intersection determination to ensure that the intersection of the two cameras' fields of view meets binocular imaging requirements.

[0018] Step S14: measuring the camera distance according to the camera view configuration data; In this embodiment, the camera spacing is calculated using the three-dimensional Euclidean distance using the spatial coordinates of the two cameras obtained in step S11. Assuming the left camera coordinates are (X1, Y1, Z1) and the right camera coordinates are (X2, Y2, Z2), the camera spacing D is calculated as D = sqrt[(X2-X1)² + (Y2-Y1)² + (Z2-Z1)²], in millimeters. The calculated spacing accuracy is controlled within 0.1mm, and the results are further verified using high-precision laser ranging equipment (such as the Keyence LK-G5000 series) to ensure that the measurement error does not exceed ±0.2mm. This camera spacing is used for stereo baseline setting, and the actual measured value range is controlled between 90mm and 120mm to meet industrial measurement accuracy and stereo parallax range requirements.

[0019] Step S15: setting a stereo baseline based on the camera spacing and ensuring that the visual axes are parallel to obtain stereo baseline data; In this embodiment, the camera spacing calculated in step S14 is used as the core parameter for setting the stereo baseline to determine the installation distance between the two cameras. The X-axis direction of the right-handed coordinate system is set as the baseline direction to ensure that the displacement of the optical centers of the two cameras in the X-axis direction is equal to the camera spacing. The two cameras are translated and tilted using a laser alignment device and a guide rail level so that the Z-axis directions of the two cameras are parallel (i.e., the optical axes are parallel). The system uses a three-dimensional alignment assistance system to detect the offset of feature points in the image of the same calibration plate taken by the two cameras in real time through image acquisition at 30 frames per second. If the offset exceeds 0.5 pixels, adjustments are continued until the maximum offset of the calibration grid points in the two images is less than 0.2 pixels. The final baseline data, including parameters such as baseline length, baseline direction vector, and optical axis angle, is recorded and output in a unified vector format.

[0020] Step S16: collecting a calibration image based on the camera position data, and performing binocular positioning based on the calibration image and the stereo baseline data to generate binocular positioning parameters.

[0021] In this embodiment, after completing camera position and baseline settings, a standard Zhang Zhengyou calibration plate (each square measures 25mm x 25mm, for a total size of 9 x 6) is placed within the common field of view of the dual cameras. Ten sets of calibration images are collected from each camera at different angles and distances, ranging from 300mm to 800mm in 100mm increments. The calibration plate's posture is adjusted to produce a ±20° tilt angle to improve calibration accuracy. After image acquisition, a sub-pixel corner detection algorithm is used to extract the coordinates of the calibration plate's corner points. The pixel coordinates are then mapped to the plate's real-world coordinates. The Zhang Zhengyou binocular camera calibration algorithm is then executed to determine the camera intrinsic parameter matrix (focal length, principal point position), distortion parameters (radial and tangential distortion coefficients), rotation matrix, and translation vector, among other binocular calibration parameters. Finally, key parameters, including cameraMatrix, distCoeffs, R, and T, are output in YAML format and stored in the main control system for subsequent stereo matching and depth calculation.

[0022] Preferably, step S16 is specifically as follows: Step S161: Capturing a calibration image based on camera position data; In this example, a Zhang Zhengyou calibration plate (9×6 checkerboard grid, 25mm per square) was placed within the common field of view of the binocular vision system. The center of the plate was positioned in the middle of the images from both cameras, with a buffer of at least 50 pixels around the edges to prevent visual distortion from affecting corner detection. Given the known camera positions (spatial coordinates were obtained using a combination of a robotic arm encoder and a laser ranging module, with an error control of ±0.5mm), calibration images were acquired at various distances and angles. Specifically, 10 sets of images were acquired, each at distances of 300mm, 400mm, 500mm, 600mm, and 700mm. Two attitude angles (±15° pitch angle) were acquired at each point. Fixed exposure parameters (10ms exposure time, 0dB gain) were used to minimize brightness fluctuations caused by automatic adjustment. The images had a resolution of 1280×1024 and were formatted as uncompressed BMP. After acquisition, they were stored in the main control system's RAM cache for subsequent corner extraction and internal parameter analysis.

[0023] Step S162: extracting the corner points of the calibration plate according to the calibration image; performing camera intrinsic parameter analysis based on the corner points of the calibration plate to obtain camera intrinsic parameter data; In this embodiment, a calibration corner extraction method based on Harris corner detection and sub-pixel iterative optimization is used to extract precise corner coordinates from each set of calibration images collected in step S161. The Harris detection threshold is set to 10,000, and image grayscale equalization uses a fixed window mean filter with a 5×5 filter kernel to ensure clear corner boundaries. The pixel coordinates of the 54 checkerboard intersections in each image are extracted, and through 10 rounds of sub-pixel optimization iterations, the corner position accuracy is improved to 0.1 pixel. Each corner point in the image corresponds to a world coordinate point (calculated using the actual dimensions of the calibration plate), establishing a one-to-one correspondence between image pixel coordinates and world coordinates. Based on the Zhang Zhengyou camera calibration algorithm, the camera's intrinsic parameter matrix is fitted using the least squares method to calculate the focal lengths fx and fy, the principal point positions cx and cy, as well as the radial distortion coefficients k1 and k2 and the tangential distortion coefficients p1 and p2. Each parameter is output as a floating-point value, in pixels or dimensionless units. The output format is a 3×3 intrinsic parameter matrix and a 1×5 distortion vector. The focal length and principal point values are controlled to an accuracy of 0.001 pixel. The resulting monocular intrinsic parameter data includes an independent intrinsic parameter matrix and distortion vector for each camera.

[0024] It is particularly important that step S161 includes the following steps: Extract the corner points of the calibration plate according to the calibration image; Identify the structural information of the calibration plate according to the calibration image; Perform corner point space mapping processing on the calibration plate structure information according to the calibration plate corner points, so as to obtain the corner point space corresponding data; Perform camera model parameter fitting calculation based on the corner point space corresponding data to obtain the initial camera intrinsic parameter data; Reproject the corner points of the calibration plate based on the initial camera intrinsic parameter data to obtain the corner reprojection data; Calculate reprojection deviation based on corner reprojection data; The initial camera intrinsic parameter data is adjusted according to the reprojection deviation to obtain the camera intrinsic parameter data.

[0025] Step S163: performing camera extrinsic parameter analysis based on the stereo baseline data to obtain camera extrinsic parameter data; In this embodiment, camera extrinsic parameters are calculated based on stereo baseline data (the distance B between the optical centers of the two cameras and the angle between the optical axes are known to be 0°). First, the left camera is determined as the reference coordinate system, and the extrinsic parameters of the right camera coordinate system are calculated relative to the left camera. Using the corner point correspondences of the left and right images obtained in step S162, a feature matching algorithm (SURF feature matching, with a threshold set to 0.8 and ensuring at least 30 matching point pairs) is used to establish point pair relationships. Based on the matching points, the rotation matrix R (3×3) and translation vector T (3×1) of the right camera relative to the left camera are calculated using fundamental matrix and essential matrix calculation methods. The modulus of the translation vector must be consistent with the camera separation measured in step S14 (with an error of no more than ±0.2 mm); otherwise, the calculation is rejected and the process returns to the re-image acquisition step. The matrix is decomposed using the SVD singular value decomposition method, and epipolar constraints are used to verify that the matching point error is within 1.0 pixel. Matching pairs exceeding this error are rejected. The final output is the external parameter data of the right camera relative to the left camera, including the rotation matrix R and translation vector T, in millimeters or dimensionless units, saved in YAML structure format, and the accuracy is controlled to 0.0001 units.

[0026] It is particularly important that step S163 includes the following steps: Modeling the spatial geometric relationship of binocular cameras based on stereo baseline data to obtain spatial geometric relationship data of binocular cameras; In this embodiment, when arranging the binocular vision system, a fixed stereo baseline length is first set, and the physical distance L_b between the left and right cameras is recorded with millimeter-level accuracy. This distance can be measured using a three-dimensional laser ranging tool or a standard slide displacement ruler with an error of no more than ±0.1mm. Using the optical center of the camera as the reference point, the installation coordinate origins of the left and right cameras are determined. A three-dimensional Cartesian coordinate system is then established with the left camera as the reference viewpoint. The optical center coordinates of the right camera are expressed as (L_b, 0, 0), and the horizontal tilt, pitch, and roll angles of the cameras during installation are recorded. This angle information must be read using a robotic arm angle sensor or gimbal potentiometer, with an accuracy requirement of better than 0.01°. After data acquisition is completed, an extrinsic relative pose description is constructed between the camera pair, including a relative translation vector and a plane rotation matrix, which are output as the spatial geometric relationship data of the binocular cameras.

[0027] Perform imaging simulation based on the spatial geometric relationship data of the binocular camera to obtain imaging simulation data; In this embodiment, the spatial geometric relationship data of the binocular cameras is input into the image simulation control module, and imaging simulation is performed using known camera parameters such as the field of view (e.g., a typical value of 70°), imaging resolution (e.g., 1920×1080 pixels), and focal length (e.g., 8mm). During the simulation, a fixed set of spatial points, such as the edges of a checkerboard grid or the coordinates of key facial points, is used for projection mapping. These points are then sequentially projected into the fields of view of the left and right cameras to generate simulated image frames. Using a frame-by-frame processing approach, 30 frames of imaging results are generated, and the pixel position differences of the projected image points are calculated to simulate the disparity map characteristics of the binoculars under the current geometric layout. This simulated image data is composed of the frame sequence number, the left image matrix, the right image matrix, and the pixel matching relationship to form the imaging simulation data.

[0028] Perform frame-level alignment based on the imaging simulation data to obtain imaging frame-level alignment data; In this embodiment, after extracting the image content of the left and right image frames in the imaging simulation data, a frame synchronization mechanism is executed. A timestamp device with a clock pulse accurate to 25 nanoseconds is used to sample and mark the image frames to ensure that the frame images captured by the left and right cameras at the same time are matched. Frame images captured at different times are eliminated according to the image frame timestamps, and image pairs with a time difference within ±1 microsecond are retained as alignment samples. The edge features of the symmetrical areas are extracted in each group of image pairs, the boundary contours are extracted by the Canny edge detection operator, and normalized optical flow matching is performed. If the pixel difference in the matching area of the two frames is within the grayscale difference threshold of ±5, it is considered to be frame-level alignment. The frame number, alignment status mark and corresponding pixel matching matrix are output to form imaging frame-level alignment data.

[0029] Extracting camera three-axis gyroscope operating data based on imaging simulation data; In this embodiment, the camera's motion state in the X-axis (roll), Y-axis (pitch), and Z-axis (yaw) is extracted by combining the imaging timeline and image stability data recorded in the imaging simulation data with real-time angular velocity data (unit: ° / s) collected by the MEMS three-axis gyroscope sensor embedded in each camera body. The gyroscope output data stream is collected at a 50Hz frequency, and the angular velocity data is denoised using a sliding window averaging method with a window width set to 10 frames. The angular velocity data is matched and synchronized according to the imaging time series and calibrated to the angle information of the attitude change. Each frame of data output format contains the accumulated values of the three axial angular velocities and the attitude angle, which constitute the camera's three-axis gyroscope operation data.

[0030] Perform instability analysis based on the camera's three-axis gyroscope operating data to obtain the camera's three-axis gyroscope instability data; In this embodiment, three-axis angular velocity data is input into the stability analysis module, where it is analyzed frame by frame according to the set gyroscope stability threshold. The stability threshold is set to ±0.3° / s. If the angular velocity exceeds this threshold for more than 10 consecutive frames, a trend of dynamic instability in that direction is determined. If any two of the three axes become unstable simultaneously, it is considered a complete device instability event. Furthermore, the sensor motion trend and image quality are combined to determine the instability time interval, instability direction, and frame number based on the image blur between imaging frames (determined by the Sobel operator gradient average; blur below a set threshold of 50 is marked as blurred). This information is then aggregated to form the camera's three-axis gyroscope instability data.

[0031] Perform stability correction based on the camera's three-axis gyroscope instability data to obtain three-axis gyroscope correction data; In this embodiment, the angular deviation in each direction is calculated based on the instability data. A Kalman filter algorithm is used to correct and smooth the angular velocity data within the instability interval, with a filter window length of 15 frames and a filter gain parameter of 0.85. The corrected angular velocity is determined by regressing and comparing the gyroscope's historical stable data with the current instability data, and then re-integrated to obtain attitude angle compensation data. After correction is complete, the three-axis angular velocity vectors and compensation angle changes are output in frame order, forming the three-axis gyroscope correction data.

[0032] Calculate the camera attitude compensation angle based on the three-axis gyroscope correction data; In this embodiment, the angular velocity integration results in the three-axis correction data are used as a basis to calculate the cumulative posture deviation in the X, Y, and Z directions, with the unit being angle (°). Using the posture integration formula, the angle change within every 10ms is calculated, and the continuous posture offset is obtained by accumulation. For example, in the X-axis direction, if the corrected average angular velocity is 0.15° / s and the sampling period is 20ms, the posture angle change per frame is 0.003°, and the cumulative offset over 30 frames is 0.09°. The angles in the three directions are calculated separately to generate the posture compensation angle vector for the current imaging frame, which is output as three-dimensional angle data for subsequent coordinate transformation.

[0033] The spatial transformation matrix is constructed based on the camera posture compensation angle to obtain the spatial posture transformation matrix; In this embodiment, the Euler angle rotation relationship is used to construct a rotation matrix in three-dimensional space based on the posture compensation angle. The X-axis, Y-axis, and Z-axis are used as the rotation axes, and the posture angles are converted into rotation matrices R_x, R_y, and R_z. The rotation matrices in the three directions are then multiplied and combined in sequence to form the total rotation matrix R_total. Combined with the displacement vector T=[L_b,0,0]^T corresponding to the stereo baseline, the posture conversion matrix T_matrix is constructed. The matrix format is a 4×4 homogeneous matrix, which is used to describe the spatial position and orientation of the right camera relative to the left camera. Output T_matrix as the spatial posture conversion matrix.

[0034] The camera extrinsic coordinates are uniformly processed according to the spatial pose transformation matrix to obtain the camera extrinsic data.

[0035] In this embodiment, the spatial pose transformation matrix is input into the camera extrinsic parameter solution module, aligned with the left camera's world coordinate system, and the coordinate position and orientation of the right camera are unified. Through extrinsic parameter unification processing, the right camera coordinate system is transformed to the left camera coordinate system, forming a unified dual-target calibration framework. The output results include the rotation matrix R and translation vector T of the right camera relative to the left camera, forming the final camera extrinsic parameter data. The output format is: extrinsic rotation matrix 3×3, extrinsic translation vector 3×1, extrinsic coordinate system label, and calibration accuracy parameters.

[0036] Step S164: Integrate the camera intrinsic parameter data and the camera extrinsic parameter data to obtain the binocular positioning parameters.

[0037] In this embodiment, the intrinsic parameter matrices (cameraMatrix1 and cameraMatrix2, respectively) and distortion coefficient vectors (distCoeffs1 and distCoeffs2) of the left and right cameras obtained in step S162 are integrated with the inter-camera rotation matrix R and translation vector T calculated in step S163 to form a binocular positioning parameter set. The combination process is organized as follows: the binocular positioning parameters are structured and stored in YAML format. The intrinsic parameters consist of the cameraMatrix (3×3 matrix) and distCoeffs (1×5 vector) of the two cameras, while the extrinsic parameters include the rotation matrix (3×3) and translation vector (3×1). Furthermore, the binocular rectification matrix (R1, R2), projection matrices P1 and P2, and binocular reprojection matrix Q are simultaneously generated for subsequent disparity calculation and depth reconstruction. The rectification matrix is constructed by decomposing and remapping R and T, ensuring that the left camera image remains unchanged while the right camera image undergoes distortion correction and realignment while maintaining parallel epipolar lines. The binocular calibration parameter file is stored in the system configuration directory in a fixed path. The file name format is "stereo_calibration_YYYYMMDD_HHMM.yaml". The accuracy is controlled within 0.2 of the image pixel error. It serves as the basic configuration parameter set for the binocular vision measurement system to perform real-time ranging and stereo matching.

[0038] Preferably, the image distortion detection in step S2 is specifically as follows: Perform corner detection based on binocular images to obtain corner data; In this embodiment, when performing corner detection based on binocular images, a checkerboard pattern is selected as a standard calibration template. The checkerboard pattern is fixed on a flat, non-reflective background and multiple sets of binocular image data are collected under good uniform lighting conditions. The three-dimensional space shooting angle of each set is controlled to vary between 0 degrees and 60 degrees, the image resolution is set to 1920×1080 pixels, and a single set of images is not less than 20 pairs. Corner detection is performed on each pair of images using the cv::findChessboardCorners function in the OpenCV library. The number of corner points is set to 9×6 inner corner points, and the number of corner points is set to 9×6 inner corner points. The point search mode uses the three joint flag parameters of ADAPTIVE_THRESH, NORMALIZE_IMAGE and FAST_CHECK, and performs sub-pixel accuracy optimization through the cv::cornerSubPix function. The window size is set to 5×5 pixels, the search area is 11×11 pixels, the maximum number of iterations is 30, and the accuracy termination condition is set to 0.01 pixels. The above operations obtain the two-dimensional pixel plane corner point coordinate data in each image and store them in the corner point coordinate matrices corresponding to the left and right cameras for subsequent calibration calculations.

[0039] Perform camera calibration based on binocular images to obtain camera calibration data; In this embodiment, the Zhang Zhengyou calibration method is used to complete the calculation of the internal and external parameters of the left and right cameras. When constructing the chessboard world coordinate system, the grid size is set to 20mm, the origin is placed at the upper left corner, and the Z axis is perpendicular to the chessboard plane and points outward. The cv::calibrateCamera function is called to map the left and right image corners to the chessboard world coordinates, and the intrinsic parameter matrix of each left and right camera is calculated, including the focal length fx, fy, the principal point coordinates cx, cy and the distortion coefficients k1, k2, p1, p2, k3, and combined with cv::stereoCal The ibrate function jointly solves the rotation matrix R and translation vector T between the left and right cameras. The initial iteration error is set to 1e-6, the maximum number of iterations is set to 100, and the flag parameters CALIB_FIX_K3 and CALIB_ZERO_TANGENT_DIST are used to fix the high-order distortion terms. At the same time, the tangential distortion assumption is turned off to obtain complete calibration data for the left and right cameras. The calibration data is saved in a structure including the intrinsic parameter matrix, distortion coefficient, rotation vector, translation vector, basic matrix F, reprojection error e, and other contents.

[0040] Extract image distortion coefficients based on camera calibration data; In this embodiment, the cv::getOptimalNewCameraMatrix function is called to extract the distortion parameters of the left and right cameras and output the distortion coefficient vector D = [k1, k2, p1, p2, k3], where the radial distortion coefficients include k1, k2, and k3, and the tangential distortion coefficients include p1 and p2. At this time, k1, k2, and k3 are used to characterize the radial stretching or compression phenomenon from the center of the image to the outside, and p1 and p2 are used to characterize the tangential offset of the image caused by the non-parallelism between the lens and the image sensor. Each parameter is a floating-point value obtained by solving the objective function of minimizing the reprojection error for all images. k1 is usually a negative value indicating barrel distortion, and k2 is a positive value indicating a pincushion distortion trend. p1 and p2 are often decimal offsets reflecting image symmetry deviation. No image correction is performed at this stage, and only parameter extraction and storage are completed.

[0041] The binocular image is classified into distortion types according to the image distortion coefficient to obtain radial distortion data and tangential distortion data; In this embodiment, when binocular images are classified according to their distortion type based on the image distortion coefficients, the extracted distortion coefficients D = [k1, k2, p1, p2, k3] are classified based on their values. When the absolute value of either k1 or k2 is greater than 0.1, significant radial distortion is determined to be present, and a threshold of ±0.1 is set. If k3 exists and its absolute value is greater than 0.05, the image is classified as having a third-order radial distortion effect. For p1 or p2, if either value is greater than 0.01, tangential distortion is determined to be present. The classification logic uses the threshold as a boundary to label all images as "radial-dominated distortion," "tangential-dominated distortion," or "double distortion." All image classification labels are recorded in a structure as image distortion type metadata for subsequent analysis modules to access.

[0042] Perform image edge deformation analysis based on radial distortion data to obtain radial distortion intensity data; In this embodiment, the geometric difference between the ideal grid image model and the projection model of the corner points in the actual image is constructed to calculate the actual offset length of each edge corner point in the radial direction. The edge is defined as an area with a radius exceeding 40% of the image width from the center of the image. For example, when the image width is 1920 pixels, the center point is 960, and the edge area is an area more than 768 pixels from the center. The distortion displacement of these corner points in the radial direction (i.e., the direction of the radial line starting from the center point) is counted. The calculation method is to project the difference vector length in the radial direction between the actual coordinates of the corner point and the ideal checkerboard mapping coordinates to obtain the radial distortion intensity of each edge corner point. Then, the radial offset distances of all edge corner points are averaged to obtain the radial distortion intensity data of the image in pixels, and the average radial offset value, maximum offset value and corresponding coordinate point index of each image are recorded as subsequent analysis data.

[0043] Perform principal point drift evaluation based on tangential distortion data to obtain tangential distortion offset data; In this embodiment, the xy coordinate cross-offset effect caused by the p1 and p2 parameters in the distortion model formula is used to focus on evaluating the offset of the image principal points cx and cy in the tangential direction due to lens assembly errors. The method adopted is to extract at least 25 neighboring corner points in the central area of the image to construct a local plane coordinate fitting model, and perform fitting analysis on the tangential component offset of these points between the undistorted coordinates and the coordinates after distortion correction. The fitting difference center point is established, and the deviation is compared with the theoretical principal point position to obtain the image tangential distortion offset data. The offset represents the maximum tangential drift between the theoretical principal point and the actual central optical axis mapping position in pixels. The offset data includes the x-direction drift value Δx and the y-direction drift value Δy, and is recorded as the structural principal point offset information.

[0044] The radial distortion intensity data and the tangential distortion offset data are integrated to obtain the image distortion data.

[0045] In this embodiment, when integrating radial distortion intensity data and tangential distortion offset data, the radial distortion intensity (average offset value per pixel) and tangential distortion offset values Δx and Δy of each image are jointly encoded to form an image distortion feature vector D_vec = [R_distortion, Tx_offset, Ty_offset]. The image file name is used as the key value to construct a distortion dictionary for use in the subsequent image correction parameter adaptive adjustment module. This distortion data is exported in JSON format, including distortion vectors for all images. This facilitates rapid call of distortion values for correction model updates in dual-target positioning or reconstruction tasks, forming a complete and traceable image distortion database.

[0046] Preferably, the circuit board fault detection in step S2 is specifically as follows: Performing grayscale distortion detection based on the image distortion data to obtain image grayscale distortion data; In this embodiment, grayscale distortion detection based on image distortion data uses calibrated and corrected binocular image data as the primary data source. Grayscale difference comparisons are performed between the pre- and post-distortion images. The pre- and post-distortion images are first converted to grayscale. The OpenCV function cv::cvtColor is used in the COLOR_BGR2GRAY mode to perform the color space conversion. Each grayscale image is fixed at 1920×1080 pixels, with a grayscale value range of 0–255 and an 8-bit unsigned integer data type. The grayscale distortion intensity image is then calculated using a pixel-by-pixel grayscale difference method, using the expression G_diff(x,y=|G_d(x,y)-G_u(x,y)|), where G_d represents the grayscale value of the distorted image and G_u represents the grayscale value of the corrected image. Each pixel of the difference image G_diff reflects the degree of grayscale fluctuation caused by distortion at that location. For each image, the mean, maximum, and standard deviation of the grayscale distortion intensity are extracted as grayscale distortion data to characterize the brightness consistency offset of the entire image before and after distortion correction. The grayscale distortion data is uniformly stored in a JSON structure, with one entry per image, including the mean (mean_diff), maximum grayscale offset (max_diff), and grayscale standard deviation (std_diff).

[0047] Extracting the usage time period according to the image grayscale distortion data to obtain the image grayscale distortion time period; In this embodiment, a time-series grayscale distortion curve is constructed using the correspondence between each image's timestamp and the mean grayscale distortion intensity. The image timestamp is derived from the capture time field in the image file's metadata (EXIF). The timestamp is parsed by reading the "DateTimeOriginal" field in the image file header, in the format of YYYY:MM:DD HH:MM:SS. The mean grayscale distortion intensity values and their corresponding times are combined into a sequence structure. Trends are extracted using a sliding time window with a 10-minute window length and a 1-minute step size. The rate of change of the mean grayscale distortion intensity within each time window, i.e., d(mean_diff) / dt, is calculated. When the rate of change exceeds a threshold of 0.5 grayscale values / minute, it is marked as a distortion surge interval. Finally, all surge intervals are extracted, their start and end times recorded, and a list of image grayscale distortion time periods is constructed and stored in a structure format with fields including start_time, end_time, and peak gradient.

[0048] Calculating the reflectivity of the metal surface of the circuit board based on the image grayscale distortion time period; calculating the grayscale value based on the image grayscale distortion data; determining the oxidation of the circuit board based on the reflectivity of the metal surface of the circuit board and the grayscale value, and obtaining the circuit board oxidation data; In this embodiment, the image sequence within each grayscale distortion period is first processed frame by frame. The location of the metal area of interest in the circuit board image has been calibrated through preprocessing. This area is the ROI (Region of Interest) in the image. Its coordinate range in the two-dimensional image pixel space is clearly set to x = 300 to 800 horizontally and y = 400 to 900 vertically. The cv::Rect(x, y, width, height) interface function in the OpenCV library is used to define a rectangular region and perform image cropping on it, where width = 500 and height = 500. After extracting the ROI region from each image frame, a grayscale image brightness estimation method is used to calculate the arithmetic mean of the grayscale values of all pixels within the region. This mean grayscale value, denoted as G_avg, ranges from 0 to 255 and represents the brightness level of the metal area in that frame. This calculation is performed by traversing all pixels within the ROI, summing the grayscale values, and dividing by the total number of pixels (i.e., width × height). To quantitatively calculate metal reflectivity, illumination intensity data must also be simultaneously incorporated. This illumination intensity data is recorded by an illumination sensor positioned near the camera system's acquisition point, sampling the illumination value once per second in Lux. All time points below 1000 Lux are filtered out, and only image frames captured with illumination greater than or equal to 1000 Lux enter the reflectivity calculation process. This threshold is determined through system testing and calibration to ensure light source stability in brightness measurements. In the aforementioned valid image frames, the reflectivity estimation formula R = G_avg / G_max is used, where G_max is the theoretical upper limit of specular reflectance grayscale, fixed at 255. This formula, based on unit normalization logic, maps brightness intensity to a reflectivity index. Ultimately, each image frame yields a metal area reflectivity value, R, ranging from 0.0 to 1.0. These reflectance values are averaged chronologically within the corresponding grayscale distortion period to generate the average reflectance data for the metal surface for that period. The image number, timestamp index, and R value data for each frame are recorded to form a complete reflectance sequence dataset, providing input parameters for subsequent metal oxidation degree calculations. To calculate grayscale values from image grayscale distortion data, the grayscale value data for the metal region (within a calibrated ROI) is resampled for all images recorded within the grayscale distortion period. The ROI image is first denoised using a median filter using the OpenCV cv::medianBlur function with a kernel size of 5×5 pixels to reduce the interference of local noise on grayscale statistics.A histogram analysis method is then used to extract the main peak of the grayscale distribution within the region. This peak corresponds to the representative grayscale value of the metal region. The grayscale histogram is statistically analyzed using the cv::calcHist function, with the grayscale bins set to 0-255, for a total of 256 bins. The index of the bin with the highest frequency is then extracted as the representative grayscale value for the image. Finally, the representative grayscale values for all time periods are recorded as an array and associated with the reflectivity values for use in the next oxidation determination step. Based on the reflectivity and grayscale values of the circuit board's metal surface, an outlier detection model is constructed in the reflectivity-grayscale two-dimensional image space during the oxidation process. The metal reflectivity R and the representative grayscale value G_rep for each image are combined into a point pair (R, G_rep) and plotted in a two-dimensional coordinate system. The standard reflectivity interval for unoxidized metal materials is [0.65, 0.9]. Representative grayscale values should fall within the range [180, 240]. Values outside this range are considered abnormal. The oxidation identification criteria were set as follows: when R < 0.6 and G_rep < 170, an oxidation region was identified; when R < 0.5 and G_rep < 150, severe oxidation was identified. This logic was used to identify each image and record the image numbers that met the oxidation criteria. Pixels in the oxidized regions were extracted and binary segmented with a grayscale threshold of 145 to extract the area of the oxidized spots. Morphological erosion with a kernel size of 3×3 was used to remove isolated points. The percentage of the oxidized region in the total area was calculated and stored as a data structure consisting of three parameters: the image file name, the percentage of the oxidized region, and the oxidation level (mild, moderate, or severe).

[0049] Evaluate the severity of metal obstruction based on circuit board oxidation data; In this embodiment, the known metal pin contact region is first extracted from each image frame and designated as a ROI. Its coordinate range in pixel space is x = 450 to 550 horizontally and y = 600 to 750 vertically. A rectangular region is defined using the OpenCV function cv::Rect(x, y, width, height) with width = 100 and height = 150. Spatial overlap analysis of oxidation regions is then performed within this region. The oxidation region is represented by a binary oxidation image obtained in a previous step. A pixel value of 1 in this image indicates detected oxidation, while a pixel value of 0 indicates no oxidation. Within the defined contact ROI, a bitwise AND logic operation is used to overlap the binary oxidation image with the ROI region to obtain the distribution of oxidation locations within the ROI. The resulting image after the AND operation is then subjected to pixel-by-pixel statistics. The total number of points with a pixel value of 1 is denoted as N_ox, representing the pixel coverage of the oxidation region within the contact region. The total number of pixels in the ROI area is N_total, calculated as width × height, meaning N_total = 100 × 150 = 15,000. The oxidation coverage, C_ox, is calculated as C_ox = N_ox / N_total, reflecting the percentage of the oxidized area within the metal pin contact surface. The degree of conduction obstruction is graded based on the specific value of the coverage, C_ox: when C_ox < 0.1, it is labeled "low impact," indicating a small oxidation coverage area and minimal impact on conduction; when C_ox is between 0.1 and 0.4, it is labeled "moderate obstruction," indicating a relatively large oxidation area; and when C_ox > 0.4, it is labeled "high obstruction," indicating that oxidation has significantly impacted conduction. Ultimately, the calculation results of each frame of image are used to generate a unified set of structured record data. This data structure includes an image number field (image ID), an obstruction level label field (including three levels: "low", "medium", and "high"), an oxidation area percentage field, and a corresponding coverage rate C_ox value field, which is used for subsequent solder joint contact performance judgment and circuit board fault reasoning.

[0050] Determine the poor contact of the solder joint according to the severity of the conduction obstruction and obtain the poor contact data of the solder joint; In this embodiment, images with obstruction levels of "moderate obstruction" and "high obstruction" are marked as suspected poor solder joint contact images. Edge detection is further used to analyze the integrity of the solder joint contour. The Canny edge detection method is used with a lower threshold of 100 and an upper threshold of 200 to extract the contour of the solder joint area. Contour closure and connectivity are calculated. If there is a discontinuity in the contour or the number of broken pixels exceeds 15% of the total number of contour pixels, it is marked as "solder joint contact fracture." The oxidation coverage is also used to determine the final degree of poor solder joint contact, and the fracture location, oxidation interference distribution, and solder joint closure characteristic parameters are recorded. The final output is a poor solder joint contact data record structure, which includes the image index, contact fracture level, fracture point coordinate set, and fracture pixel count statistics.

[0051] Based on the poor solder joint contact data, intermittent conduction detection of the circuit board is performed to obtain circuit board fault data.

[0052] In this embodiment, during intermittent continuity detection of a circuit board based on poor solder joint contact data, a multi-frame image sequence is captured, and time-series connectivity tracking analysis is performed on the same solder joint region. An inter-frame comparison method is used to perform grayscale differentiation on 30 frames of images. Mask analysis is then performed on the poor solder joint contact region. The number of connection breakpoint changes within each solder joint region is counted. If the same region is disconnected once, then restored twice, and then disconnected again three or more times in three consecutive frames, an intermittent continuity risk is determined. This detection strategy constructs an inter-frame contact connectivity change vector to generate a characteristic sequence of intermittent continuity behavior for each solder joint region. The intermittent continuity frequency, periodicity intensity, and affected pixel range are combined to generate a circuit board fault data structure, which records the image sequence ID, continuity change vector, intermittent frequency value, and fault level score (0-100). All fault data is archived to provide feedback for the system's subsequent adaptive parameter correction module.

[0053] Preferably, the intermittent conduction detection of the circuit board in step S2 is specifically as follows: Identify the degree of solder joint cracking based on poor solder joint contact data; In this embodiment, the poor contact data of solder joints obtained in the previous step is first used as the initial input. The data should include the location index of each solder joint, a binary image of the poor contact area, and information on contact area changes. For each solder joint area, a morphological analysis is performed on the contact boundary changes in the image sequence based on the changing contours of the contact area in image space. Specifically, the cv::morphologyEx function in OpenCV is combined with erosion and dilation operations, and a 3×3 structuring element is used to detect the shrinkage or fracture trends of the solder joint area contour over time. The cv::findContours function is then used to extract the boundary contour coordinates. The crack type is determined based on the contour continuity and degree of closure. Discontinuous areas with obvious brightness gradient changes within the boundary are identified as cracked areas. To quantify the cracking degree of the weld, the longest continuous unclosed contour segment among all the extracted boundaries is selected as the main crack segment. The starting and ending coordinates of the segment are recorded, and the crack length L_crack is calculated by the Euclidean distance between the two points. The unit is pixel. Finally, the cracking degree of each weld is represented by the crack length L_crack and recorded in the structured data, including fields such as weld ID, crack start and end coordinates, and crack length value.

[0054] Calculate the crack length according to the cracking degree of the weld; In this embodiment, the crack length calculation step first locates all open contour segments from the crack contour extracted in the previous stage based on pixel coordinates. After using the contour extraction function to obtain the pixel point sequence for each segment, a line segment fitting method is used to determine the direction of the crack's main axis. For each contour segment, the cv::fitLine function is called to fit the linear direction vector using the least squares method to obtain the projected axis of the crack segment. The pixel distance between the two largest points in the contour in this direction is obtained as the crack length value. Ultimately, the longest of all crack segments is defined as the main crack length L_crack of the current weld. This length is stored in the weld structure information for subsequent physical response simulation input.

[0055] Conduct circuit board vibration and impact simulation according to the crack length to obtain circuit board vibration and impact data; In this embodiment, the crack length is input as one of the input parameters into the finite element analysis environment, and the ANSYS Workbench platform is specifically used for three-dimensional modeling and transient dynamic solution. First, the geometric structure of the circuit board is reconstructed. According to the actual circuit board size, a rectangular substrate structure with a length, width and thickness of 100mm×80mm×1.6mm is modeled. The solder joint area is represented by a nested spherical crown, and the crack is embedded in the solder joint structure as a linear discontinuity area. In terms of material parameters, the circuit board substrate is set to FR-4 material with a density of 1850kg / m³, a Young's modulus of 2.1×10^10Pa, and a Poisson's ratio of 0.13. The solder joint material is set to Sn63Pb37 alloy with a density of 8400kg / m³ and a Young's modulus of 5×10^10Pa. The applied load is set using the impact acceleration boundary condition, with the impact amplitude set to 3000m / s², the impact duration set to 1ms, and the application direction set to the vertical direction of the z-axis. During the simulation process, nonlinear contact elements were used to process the fracture response of the solder crack area. After solving the problem, a data set including strain distribution, crack propagation velocity, and displacement response was obtained. The maximum response displacement, displacement amplitude variation range, and frequency response curve of each solder joint structure under the vibration impact of the circuit board were derived.

[0056] Evaluate intermittent continuity of circuit boards based on circuit board vibration and shock data; In this example, the maximum displacement amplitude of a solder joint is first used as an indicator, with an assessment threshold of 20μm. If the displacement amplitude of a solder joint exceeds this threshold, it is determined to be at risk of intermittent conduction; otherwise, it is considered to be stable. Furthermore, a time series analysis of the conduction state of the same solder joint over multiple excitation cycles is performed. The frequency of conduction interruptions is calculated based on the on / off changes in the contact state of the electrical signal path in the simulation results. If the frequency exceeds 10Hz and each interruption lasts longer than 0.5ms, the solder joint is recorded as being in a "high-frequency intermittent conduction state." Numerical fields such as the solder joint number, maximum displacement value, conduction interruption frequency, and cumulative number of interruptions are also recorded.

[0057] The circuit board structural connectivity fault is determined based on the intermittent conductivity of the circuit board, and the circuit board fault data is obtained.

[0058] In this embodiment, in the operation of determining the structural connectivity fault of the circuit board, the intermittent conduction information of the solder joints obtained in the previous step is summarized, and a structural judgment is made by judging whether the intermittent conduction state of the solder joints appears on multiple key signal paths and combining its timing characteristics. If a "high-frequency intermittent conduction state" appears on three or more consecutive solder joints on a certain signal path, or if any key control signal channel has more than 5 conduction interruptions within a unit time (set to 1 second), the path is marked as a structural connectivity abnormal path. Finally, all signal paths marked as abnormal are mapped to the spatial structure of the circuit board, and their start and end solder joint indexes are extracted. The abnormality type is marked as a control-level fault or a communication-level fault according to its role in the circuit logic diagram, and a circuit board fault data structure is uniformly generated. The fields include data such as path ID, abnormality type, number of affected solder joints, interruption frequency and duration index.

[0059] Preferably, the signal attenuation degree is determined in step S2 as follows: Identify fault signal paths based on circuit board fault data; In this embodiment, circuit board structural connectivity fault data is first input. This data must include the location of each faulty solder joint, signal channel number, conduction status (disconnected / intermittent / normal), and corresponding time series data. A logical topology diagram of the circuit board is constructed. Based on the schematic structure, all solder joints are mapped into a directed graph structure through network connections, where nodes represent solder joints and edges represent wire connections. A graph traversal algorithm (depth-first traversal) is used to trace all downstream paths from each solder joint experiencing a conduction anomaly. If there are two or more consecutive faulty nodes in a path, the path is considered a "faulty signal path." The starting and ending nodes, node indices, and path number of the faulty path are recorded. To avoid interference from non-critical paths, branches that only pass through a single faulty node are filtered out. The final output is a structured path set, including parameters such as path number, path length (in nodes), number of faulty nodes, and time series consistency index (consistency is considered when the temporal overlap rate exceeds 80%).

[0060] Constructing a fault electrical signal path model according to the fault signal path; In this embodiment, the fault path data generated in the previous stage is imported into a 3D PCB wiring structure modeling tool (using Mentor Graphics Xpedition Layout as the modeling platform). The location and shape parameters of all metal trace segments, vias, pads, and connector pins within the path are extracted one by one, comparing them to the PCB design file (.brd or .GBR format). The path model is divided into multiple structural segments, each containing physical parameters such as wire segment length, line width, inter-layer jump information, dielectric constant, copper thickness, and path context load. For example, a line width of 0.15 mm, a copper thickness of 35 μm, a path length of 22 mm, and a dielectric material of FR4 (εr = 4.2) are used. For each structural segment, an equivalent transmission line model is generated, and a segmented distributed parameter circuit model is constructed. This includes the inductance per unit length (L), capacitance per unit length (C), resistance per unit length (R), and admittance (G). The calculation formulas for these parameters are: L = (μ / 2π)·ln(2h / w), and C = (2πε) / (ln(2h / w)), where h is the dielectric thickness, w is the trace width, μ is the magnetic permeability, and ε is the dielectric constant. Finally, each segment is connected in series to construct a complete fault electrical signal path model, which is then exported as an electrical simulation structure file (.snp or .sp format).

[0061] Perform critical path fault detection based on the fault electrical signal path model to obtain critical path fault data; In this example, the Cadence Sigrity PowerSI simulation tool was used to perform time domain reflectometry (TDR) simulation of the transmission path. The input signal was set to a unit step signal with a pulse width of 1ns and a rising edge of 100ps. After applying excitation to the path model, the reflected signal waveform was recorded. The reflection amplitude and position in the waveform were analyzed. The location of the reflection in the path was located based on the return delay of the time domain signal and the waveform reflection intensity. The distance to the reflection point was calculated and compared with the model structure to determine whether it was a critical reflection point. If the location was located on a trunk signal path supporting important logic (such as a clock line or address bus), it was defined as a critical path fault. Critical path fault data was output, including metrics such as the critical path ID, reflection point location (mm), reflection signal amplitude (V), and path transmission delay (ps).

[0062] Perform impedance mismatch analysis based on critical path fault data to obtain impedance mismatch data; In this embodiment, during impedance mismatch analysis based on signal path fault data, critical path reflection waveform data is read and the impedance mismatch is calculated based on the reflection coefficient Γ = (ZL - Z0) / (ZL + Z0), where Z0 is the path reference impedance, set to 50Ω, and ZL is the load-end impedance. Γ is calculated by the ratio of the reflected voltage Vr to the incident voltage Vi, and the ZL value is inferred. The Γ value at each transition point in the TDR curve is used to determine whether there is an impedance mutation segment in the transmission path. If any Γ value exceeds ±0.2, a severe impedance mismatch is considered to exist. The corresponding path physical segment number for each mutation point is extracted, and its structural parameters and Γ value are recorded to generate an impedance mismatch data file, including fields such as the path number, mutation location coordinates, Γ value, and equivalent ZL impedance value.

[0063] Perform signal transmission simulation based on impedance mismatch data to obtain signal transmission data; In this example, during signal transmission simulation based on impedance mismatch data, the equivalent segmented path model was imported into the Keysight ADS simulation platform. In the simulation module, the excitation source was configured as a 2.5 Gbps NRZ bitstream, the simulation time was set to 50 ns, and the L, C, R, and G parameters of each path segment were configured using a microstrip line structure model. S-parameter model superposition was enabled, and a full-wave electromagnetic field solver was used to solve the transmission response of the entire path. The output signal transmission data, including transmitter and receiver waveforms, voltage jitter, eye diagram shape, rise time, and bit error rate, was exported in graphical and tabular form. Key signal characteristics such as signal amplitude attenuation (V) and maximum transmission delay (ps) were also recorded.

[0064] Counting signal reflectivity based on signal transmission data; performing signal crosstalk analysis based on signal transmission data to obtain signal crosstalk data; In this embodiment, when calculating signal reflectivity based on signal transmission data, a ratio analysis method is used to extract the transmitting end incident voltage Vi and the return reflected voltage Vr from the simulation data. The reflectivity R = Vr / Vi is calculated at time t = 0.5 ns. Sliding statistics are performed over a unit time window of 0.5 ns, and the average reflectivity R_mean is calculated. If R_mean exceeds 0.15, the reflection is considered severe. The reflectivity values for each time window are recorded and a time series reflectivity curve is plotted. Statistics such as the maximum reflectivity, average reflectivity, and number of reflections for each signal path are output. In the signal crosstalk analysis step based on the signal transmission data, the main signal path and its adjacent paths (less than 0.25 mm apart) are grouped together. The main path is simultaneously excited in the simulation, and the changes in the signal voltages of the adjacent paths are observed. The crosstalk coefficient K_crosstalk = V_coupled / V_signal is defined as the ratio of the maximum induced voltage of the adjacent path to the signal amplitude of the main path. If K_crosstalk exceeds 0.1, significant crosstalk is detected. The interference section is displayed using a three-dimensional structural view in conjunction with a field strength distribution diagram. Data fields such as the crosstalk path number, interference section length, and maximum induced voltage are recorded to ultimately generate a signal crosstalk dataset.

[0065] The signal attenuation degree is evaluated based on the signal reflectivity and signal crosstalk data.

[0066] In this embodiment, in the step of evaluating the degree of signal attenuation based on the signal reflectivity and signal crosstalk data, the comprehensive signal attenuation index A_total is calculated by combining the reflectivity statistical results with the crosstalk coefficient K_crosstalk. The formula A_total=A_0-(α·R_mean+β·K_crosstalk) is used, where A_0 is the original signal amplitude, and α and β are weight coefficients, set to 2.0 and 1.5 respectively. The signal attenuation value on each path is calculated according to the formula. If the final signal amplitude A_total is lower than 0.7×A_0, it is marked as a severely attenuated path. Detailed indicators such as the signal path number, reflectivity, crosstalk coefficient, and final attenuation value are output and summarized as signal attenuation evaluation structured data.

[0067] Preferably, step S3 is specifically as follows: Step S31: Evaluate the image acquisition brightness requirement according to the signal attenuation degree; In this embodiment, the image signal processing module first receives raw image frame data captured by the binocular vision measurement system. A target window of 640×480 pixels in the central area of the image is extracted. The grayscale mean of this windowed area is then obtained for five consecutive frames. The extracted grayscale values are pixel values in an 8-bit grayscale image, ranging from 0 to 255. The mean value is calculated using a linear weighted summation method, and a fixed window is used to ensure consistency within the target area. The grayscale differences between adjacent frames within these five frames are then calculated, and the ratio of the maximum to minimum grayscale differences is used to measure the amplitude of signal attenuation fluctuations. When this ratio is greater than 2.0 and the maximum grayscale difference is less than 20, the current image sequence is considered to have high signal attenuation. Based on this result, the image acquisition brightness requirement level is calculated, and the attenuation fluctuation value is normalized and converted into a brightness compensation level B, set between 0 and 100 and graded into three levels: 0 to 33 for low brightness requirement, 34 to 66 for medium brightness requirement, and 67 to 100 for high brightness requirement. This brightness level is then transmitted as a parameter to the next module for gain control settings.

[0068] Step S32: adjusting the camera gain setting according to the image acquisition brightness requirement to obtain gain adjustment data; In this embodiment, according to the brightness level B obtained in step S31, the corresponding analog gain setting value is obtained from the preset gain configuration lookup table. The lookup table is configured during the system initialization phase, and the specific setting rules are as follows: a B value between 0 and 33 corresponds to a gain of 12dB, a B value between 34 and 66 corresponds to a gain of 6dB, and a B value between 67 and 100 corresponds to a gain of 3dB. The image acquisition system calls the SDK underlying interface provided by its camera manufacturer and configures and writes the analog gain value through a specific register address. For example, in a Basler camera, the corresponding dB value is written through register address 0x8001, and the transmission data format is a 16-bit hexadecimal value. After the setting is completed, the gain adjustment data is synchronously saved in the cache register of the image enhancement control module as input data for subsequent exposure control. All write operations are implemented through the controller I2C bus communication to ensure that the registers are synchronously refreshed and take effect immediately.

[0069] Step S33: adjusting the exposure time based on the gain adjustment data to obtain exposure time adjustment data; In this embodiment, the control algorithm adjusts the exposure time of the current frame based on the camera analog gain value set in step S32. The system uses an exposure time adjustment function, using a preset baseline exposure time value of 5000 microseconds as a base value. The system then calculates the target exposure time by comparing the ratio between the currently set gain value and the baseline gain value through a table lookup. When the gain value is 3dB, the target exposure time is 10000 microseconds; when the gain is 6dB, the target exposure time is 5000 microseconds; and when the gain is 12dB, the target exposure time is 2500 microseconds. To prevent abnormal exposure time settings from affecting image stability, the system sets an upper limit of 20000 microseconds and a lower limit of 500 microseconds. Exposure time setting is performed by calling the timing module of the image acquisition control chip, with the specific write command being issued via register address 0x8104. After writing, the image acquisition controller transfers the exposure time value as a decimal integer and stores it in the exposure control register. This value is also marked as exposure time adjustment data and transmitted to the next module for motion blur simulation.

[0070] Step S34: performing motion blur simulation according to the exposure time adjustment data to obtain motion blur data; In this embodiment, exposure time adjustment data is read and combined with the target object's motion speed information to simulate the resulting image motion blur. The target speed is provided by the binocular system's depth extraction module and is calculated by measuring the target object's spatial displacement in two consecutive frames and the inter-frame interval. The frame rate is fixed at 30 frames per second, corresponding to an inter-frame interval of 33 milliseconds. The speed value is multiplied by the current exposure time value to obtain the image blur distance. Image blur simulation utilizes a linear motion convolution operation in the image processing module. The blur kernel length is consistent with the blur distance, and the convolution direction is determined by the vector direction of the object's movement. The direction parameters are output by the previous stereo matching module. After the blur simulation, edge detection is performed on the image. The Sobel operator is used to extract edges from the original image and the blurred image, respectively. The gradient value changes are compared, and the ratio of edge clarity reduction is calculated. This ratio is defined as the blur intensity M, which ranges from 0 to 1. This value is output as motion blur data and transmitted to the aperture adjustment module in the next step.

[0071] Step S35: Evaluate the blur degree based on the motion blur data, and adjust the aperture size based on the blur degree to obtain aperture adjustment data.

[0072] In this embodiment, the lens aperture value is set based on the blur intensity M obtained in step S34. According to the aperture control setting rules, if M is greater than 0.75, the aperture value is set to f / 2.8; if 0.5 is less than or equal to M or less than or equal to 0.75, the aperture value is set to f / 4.0; if 0.25 is less than or equal to M or less than or equal to 0.5, the aperture value is set to f / 5.6; and if M is less than or equal to 0.25, the aperture value is set to f / 8.0. The aperture adjustment operation is performed by the electric aperture structure equipped with the lens, which is driven by a stepper motor. According to the lens specification sheet, each aperture adjustment requires a certain number of steps of the stepper motor. Taking a standard stepper motor with a step of 1.8 degrees as an example, 100 pulses are required for each aperture adjustment. The system uses the PWM module in the FPGA controller to output a control pulse signal with a frequency of 500Hz and a duty cycle of 50%, accurately controlling the number of stepper motor pulses to drive the mechanical aperture blades in the lens to open and close to achieve the set aperture value. After the adjustment is completed, the actual aperture position code value is read through the feedback sensor for verification and comparison, and the final aperture value is written into the image capture configuration module and marked as aperture adjustment data for use in the image acquisition process.

[0073] Preferably, step S35 is specifically as follows: Step S351: Calculating the edge gradient change rate based on the motion blur data; In this embodiment, after acquiring motion-blurred data, the image processing module uses the Sobel edge operator to perform gradient edge extraction on the current image. The Sobel operator calculates the grayscale gradient in the horizontal (Gx) and vertical (Gy) directions. The gradient strength is obtained using the formula √(Gx² + Gy²). However, in actual processing, only the gradient modulus is retained for subsequent statistical analysis. The calculation of the edge gradient change rate relies on the difference in the edge gradient strength distribution between the original and simulated blurred frames. The original image frame and the simulated blurred frame affected by motion blur are used for comparison. A central target window region of 640×480 pixels is uniformly extracted. The mean edge gradient values of all pixels within this region are calculated, denoted as G1 and G2, respectively, where G1 is the mean gradient value of the original image and G2 is the mean gradient value of the blurred image. The edge gradient change rate is defined as (G1-G2) / G1. The change rate threshold is set to 0.25. A value greater than 0.25 indicates severe edge blur attenuation; a value less than 0.10 indicates good edge preservation. Finally, the edge gradient change rate is output as the basic parameter for image frequency domain analysis and transmitted to the next frequency domain energy calculation module in a numerical format.

[0074] Step S352: Evaluate the image frequency domain energy attenuation rate according to the edge gradient change rate; In this embodiment, after receiving the edge gradient change rate data, the frequency-domain energy analysis module performs frequency-domain feature extraction processing on the image based on the two-dimensional fast Fourier transform (FFT). The FFT calculations with a window size of 512×512 are performed on the original image and the blurred image, which are then converted into spectrograms. Next, the total energy of the high-frequency region of the spectrogram (i.e., the frequency radius r>150, corresponding to the image detail information) is extracted as the frequency-domain high-frequency energy value. The energy calculation adopts the method of the sum of the squared spectral magnitudes, that is, the sum of the squares of the real and imaginary parts of each frequency point is calculated, and the total energy is accumulated within the high-frequency region. Denote the high-frequency energy of the original image as E1 and the high-frequency energy of the blurred image as E2 respectively. Calculate the frequency-domain energy attenuation rate R = (E1 - E2) / E1. The system sets the reference attenuation standard as: R>0.4 indicates severe blur, 0.2<R≤0.4 indicates moderate blur, and R≤0.2 indicates mild blur. This frequency-domain energy attenuation rate is an important indicator for judging the image blur degree and is output to the blur recognition module.

[0075] Step S353: Determine the blur degree based on the image frequency-domain energy attenuation rate; In this embodiment, the image blur recognition module receives the frequency-domain energy attenuation rate R calculated in step S352 and classifies the image blur degree into three levels according to the fixed blur degree classification standard. If R is greater than 0.4, the blur level is marked as "high"; if R is between 0.2 and 0.4, the blur level is marked as "medium"; if R is less than or equal to 0.2, the blur level is marked as "low". The system represents the blur degree as integer data, which are 2 (high), 1 (medium), and 0 (low) respectively, and transmits them to the image sharpness adjustment requirement module in a unified format. This mapping relationship is part of the system's built-in parameter table, configured in the initialization stage, and written into the FPGA control register before the algorithm execution, serving as an important input basis for the image quality adjustment process. All blur degree judgments do not require manual intervention by the user, and the entire process processes the image frames in a batch processing manner by the image processing hardware module.

[0076] Step S354: Determine the image sharpness adjustment requirement according to the blur degree, and control the aperture state of the lens module based on the image sharpness adjustment requirement; In this embodiment, the image clarity adjustment module calculates the required image clarity compensation adjustment target based on the blur level value output in step S353 and the system's current lens operating state. This target is achieved by controlling the motorized aperture in the lens module. When the blur level is set to 2 (high), the system needs to reduce the aperture by one stop, from the current aperture value of f / 2.8 to f / 4.0; when the blur level is 1 (medium), the current aperture is maintained; when the blur level is 0 (low), the aperture can be increased by one stop, from f / 4.0 to f / 2.8, to increase brightness. The image clarity adjustment request is output as an adjustment to the target aperture value and marked as the aperture target state. This state is transmitted to the aperture control unit, which drives the subsequent specific adjustment process. The clarity adjustment logic is implemented within the FPGA using a finite state machine, and state transitions are driven by the blur level data.

[0077] Step S355: adjusting the aperture control value of the lens module aperture state according to the blur level to obtain the aperture control value; In this embodiment, the aperture control unit compares the target aperture value with the current aperture state based on the aperture target state transmitted in step S354, calculates the difference, and determines the aperture control value. The aperture control value is defined as the number of stepper motor pulses required, with the control unit assuming 100 pulses per aperture change. For example, if the current aperture value is f / 2.8 and the target value is f / 4.0, 100 forward pulses are required; if the target value is f / 2.0, 100 reverse pulses are required. This control value is encoded as an unsigned integer, packaged as binary data, and transmitted to the camera lens control register. Each aperture change is limited to ±2 stops. Requests exceeding two stops are broken down into multiple control value sequences and executed sequentially to prevent sudden aperture jumps that could cause image distortion. Once generated, the aperture control value is placed in the task scheduling buffer by the controller and immediately issued upon request by the lens driver component.

[0078] Step S356: Send the aperture control value to the camera lens drive component, and adjust the mechanical aperture size to obtain aperture adjustment data.

[0079] In this embodiment, the aperture control value generated in step S355 is sent to the motor driver chip in the lens drive assembly via the SPI communication interface. This driver chip is a customized stepper motor control unit that supports a 500Hz pulse frequency, a 12V drive voltage, and a step size of 1.8 degrees per step. After receiving the control value, the driver generates a corresponding drive waveform signal based on the control value direction and pulse number, controlling the synchronous movement of the motorized aperture blades within the lens. The mechanical aperture structure adopts a dual-propeller closed-loop structure. Real-time feedback angle is read by an encoder and transmitted back to the system control end via the I2C bus to ensure precise aperture movement. After execution, the aperture angle value returned by the encoder is compared with the target aperture value. If the error is less than 1 degree, the aperture adjustment is marked as successful and the final aperture adjustment data is recorded in the image acquisition configuration module in the format of aperture value (f-number) + execution timestamp. This data serves as the parameter recording basis for subsequent image annotation and image analysis tasks.

[0080] Preferably, step S4 is specifically as follows: Step S41: collecting binocular optimized images according to the aperture adjustment data; In this embodiment, the industrial binocular camera system controls the left and right cameras separately for synchronized exposure. Based on the aperture control data adjusted in the previous stage, the physical aperture values of the left and right cameras are adjusted to the target value (e.g., F / 4.5) by the stepper motor. Subsequently, the control module issues acquisition instructions to the left and right image acquisition controllers, triggering the shutters simultaneously. The image acquisition controllers use hardware-level time synchronization circuits to ensure that the image acquisition time difference between the two cameras does not exceed 10 microseconds. During the acquisition process, the camera exposure time is set to 15ms and the ISO value is set to 400 to ensure images with balanced brightness and good edge contrast under typical factory lighting conditions. After being captured by the CMOS image sensor, the image is converted to an 8-bit grayscale image by the FPGA module and transmitted to the image processing unit via the CameraLink interface. The left and right images are named Left_OptImg.tif and Right_OptImg.tif, respectively.

[0081] Step S42: performing disparity calculation based on the binocular optimized image to obtain disparity data, and generating a disparity map based on the disparity data; In this embodiment, after the left and right images are input into the image processing unit, image correction is first completed by the distortion correction module (calling the camera calibration parameters, including the coordinates of the principal point, radial distortion coefficient, etc.). Subsequently, the disparity matching operation is performed using the semi-global matching algorithm (SGM). This algorithm searches for matching blocks in the Right_OptImg.tif image within a set disparity search range (e.g., 0-64 pixels) for each pixel of the reference image Left_OptImg.tif. The matching cost is constructed based on a combination of pixel grayscale difference and gradient difference. The costs are aggregated in 128 different path directions, and the disparity with the lowest cost is selected as the final value. The generated disparity map is output in 16-bit image format, named DispMap.tiff, with pixel values in pixels.

[0082] Step S43: performing pixel depth conversion according to the disparity map to obtain an initial depth map; In this embodiment, back projection is performed using the correspondence between the disparity values in DispMap.tiff and the binocular camera parameters. The camera focal length obtained by prior calibration is 7.2 mm, the baseline length is 60 mm, and the pixel pitch is 4.5 microns. The system loads the depth mapping table (prefabricated dZ lookup table, disparity from 1 to 64, step size 1, unit is pixel, corresponding to a depth range of 100 mm to 4500 mm) in the embedded processing unit. Each pixel directly looks up the table according to its disparity value to obtain the corresponding depth value. All pixel depth values are written to the depth map Depth_Init.tiff, and the image is stored as a 32-bit floating point type in millimeters. The corresponding positions of all invalid disparity values (for example, 0 or boundary values) in the depth map are marked as NaN for subsequent hole filling.

[0083] Step S44: performing hole filling processing based on the initial depth map to obtain filling depth data; and drawing a depth map based on the filling depth data; In this embodiment, the NaN marked area in Depth_Init.tiff is processed and the weighted neighborhood mean filling method is adopted. Specifically: for each NaN pixel, search for valid depth points in its 5×5 neighborhood. If no less than 10 valid points are found, interpolation filling is performed according to the weighted average of the inverse of the Euclidean distance. For areas that do not meet the conditions, the iterative expansion filling method is performed, and it is iterated for up to 10 rounds to gradually reduce the range of the hole. Finally, the complete filled depth map Depth_Fill.tiff is output. Depth_Fill.tiff is then drawn as a pseudo-color image through the OpenCV visualization module, using the Jet color mapping scheme, with close distances corresponding to cold tones (blue to cyan) and long distances corresponding to warm tones (orange to red).

[0084] Step S45: converting the depth map into point cloud data, and performing three-dimensional reconstruction of the target object based on the point cloud data to obtain a three-dimensional target object model; In this example, the camera intrinsic parameters (focal length, principal point position, pixel size) and the depth map Depth_Fill.tiff loaded into the system are called to perform a 3D coordinate restoration operation. The corresponding X, Y, and Z spatial coordinates are calculated for each valid pixel, and the output is standard point cloud data, saved in XYZ format as ObjectCloud.pcd. Voxel grid filtering is then performed, setting the voxel unit side length to 1.5mm and reducing the number of points to 60% of the original to reduce computing resource usage. The Poisson reconstruction algorithm is then used to fit the 3D model surface, with the octree depth set to 8, to reconstruct the 3D mesh model ObjectModel.obj.

[0085] Step S46: Identifying surface points of the object structure based on the three-dimensional target object model; performing three-dimensional point cloud registration on the surface points of the object structure according to preset three-dimensional point cloud standard coordinates to obtain point cloud registration data; performing error calculation based on the point cloud registration data to obtain three-dimensional structure deviation data; In this embodiment, the key structural surfaces are identified in ObjectModel.obj, and the edge surfaces (local curvature change rate is greater than 0.03) and the concave-convex transition surfaces are extracted by the curvature extraction method. The key point coordinates in the standard template StandardPoints.csv are compared, and the RANSAC algorithm is used to extract the point set in the model that conforms to the template structure as the proposed registration point set. During the initial registration, the center point normalization + PCA direction alignment operation is performed, and then fine registration is performed, and the ICP iterative algorithm is executed. The maximum number of iterations is 50, and the convergence threshold is 0.05mm. After the registration is completed, the Euclidean distance between each pair of corresponding points is calculated, and the points that exceed the deviation range of ±0.2mm are counted to form a data table of out-of-difference points, which is output as Deviations.csv, including the point number, actual offset and offset direction information.

[0086] Step S47: adjusting the acquisition frame rate according to the three-dimensional structure deviation data, and transmitting the adjusted acquisition frame rate to the camera management platform to perform the camera parameter online adjustment task.

[0087] In this embodiment, the Deviations.csv file is read to determine the percentage of deviation points corresponding to each frame. If the deviation percentage exceeds 15% for three consecutive frames, the frame rate adjustment mechanism is activated. The acquisition frequency is lowered from the original set value of 15fps to 12fps, with the frame rate reduction step size being 3fps and the adjustment limit set to 8fps. The adjustment strategy is executed by the image scheduling manager, which encapsulates the target frame rate value as a control message and sends it to the camera controller via the TCP communication protocol. Upon receiving the message, the controller immediately resets the camera acquisition clock cycle through the synchronization clock module and performs dynamic frame rate adjustment through hardware interrupts, keeping the entire binocular acquisition system synchronized.

[0088] The present invention is therefore intended to be illustrative and non-restrictive in all respects, with the scope of the invention being defined by the appended claims rather than the foregoing description, and all changes that come within the meaning and range of equivalents of the application documents are intended to be embraced therein.

[0089] The foregoing description is intended only to provide specific embodiments of the present invention, which will enable those skilled in the art to understand and implement the present 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 present invention. Therefore, the present invention is not intended to be limited to the embodiments shown herein, but is to be construed in the widest possible manner consistent with the principles and novel features disclosed herein.

Claims

1. A method for online adjustment of camera parameters in a binocular vision measurement system, characterized in that: The following steps are involved: Step S1: Obtain camera position data and adjust the camera spacing to set a stereo baseline to obtain stereo baseline data; Collecting calibration images based on camera position data, and performing binocular positioning based on the calibration images and stereo baseline data to generate binocular positioning parameters; Step S2: collecting binocular images according to binocular positioning parameters; performing image distortion detection based on the binocular images to obtain image distortion data; performing circuit board fault detection based on the image distortion data to obtain circuit board fault data; and determining the degree of signal attenuation based on the circuit board fault data. Step S3: adjusting the exposure time based on the degree of signal attenuation to obtain exposure time adjustment data; performing motion blur simulation based on the exposure time adjustment data to obtain motion blur data; evaluating the blur degree based on the motion blur data, and adjusting the aperture size based on the blur degree to obtain aperture adjustment data; Step S4: collecting binocular optimized images according to the aperture adjustment data; Draw a depth map based on the binocular optimized image; convert the depth map into point cloud data, and perform 3D reconstruction of the target object based on the point cloud data to obtain a 3D target object model; perform 3D structure deviation detection based on the 3D target object model to obtain 3D structure deviation data; The acquisition frame rate is adjusted according to the 3D structure deviation data, and the adjusted acquisition frame rate is transmitted to the camera management platform to perform the online adjustment task of the camera parameters.

2. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 1, characterized in that: Step S1 is specifically as follows: Step S11: Obtain camera position data and extract camera space coordinates; Step S12: adjusting the camera posture based on the camera space coordinates to obtain camera posture data; Step S13: reconstructing the viewing angle according to the camera posture data to obtain camera viewing angle configuration data; Step S14: measuring the camera distance according to the camera view configuration data; Step S15: setting a stereo baseline based on the camera spacing and ensuring that the visual axes are parallel to obtain stereo baseline data; Step S16: collecting a calibration image based on the camera position data, and performing binocular positioning based on the calibration image and the stereo baseline data to generate binocular positioning parameters.

3. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 2, characterized in that: Step S16 is specifically as follows: Step S161: Capturing a calibration image based on camera position data; Step S162: extracting the corner points of the calibration plate according to the calibration image; performing camera intrinsic parameter analysis based on the corner points of the calibration plate to obtain camera intrinsic parameter data; Step S163: performing camera extrinsic parameter analysis based on the stereo baseline data to obtain camera extrinsic parameter data; Step S164: Integrate the camera intrinsic parameter data and the camera extrinsic parameter data to obtain the binocular positioning parameters.

4. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 1, characterized in that: The image distortion detection in step S2 is specifically as follows: Perform corner detection based on binocular images to obtain corner data; Perform camera calibration based on binocular images to obtain camera calibration data; Extract image distortion coefficients based on camera calibration data; The binocular image is classified into distortion types according to the image distortion coefficient to obtain radial distortion data and tangential distortion data; Perform image edge deformation analysis based on radial distortion data to obtain radial distortion intensity data; Perform principal point drift evaluation based on tangential distortion data to obtain tangential distortion offset data; The radial distortion intensity data and the tangential distortion offset data are integrated to obtain the image distortion data.

5. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 1, characterized in that: The circuit board fault detection in step S2 is specifically as follows: Performing grayscale distortion detection based on the image distortion data to obtain image grayscale distortion data; Extracting the usage time period according to the image grayscale distortion data to obtain the image grayscale distortion time period; Calculating the reflectivity of the metal surface of the circuit board based on the image grayscale distortion time period; calculating the grayscale value based on the image grayscale distortion data; determining the oxidation of the circuit board based on the reflectivity of the metal surface of the circuit board and the grayscale value, and obtaining the circuit board oxidation data; Evaluate the severity of metal obstruction based on circuit board oxidation data; Determine the poor contact of the solder joint according to the severity of the conduction obstruction and obtain the poor contact data of the solder joint; Based on the poor solder joint contact data, intermittent conduction detection of the circuit board is performed to obtain circuit board fault data.

6. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 5, characterized in that: The intermittent conduction detection of the circuit board in step S2 is specifically as follows: Identify the degree of solder joint cracking based on poor solder joint contact data; Calculate the crack length according to the cracking degree of the weld; Conduct circuit board vibration and impact simulation according to the crack length to obtain circuit board vibration and impact data; Evaluate intermittent continuity of circuit boards based on circuit board vibration and shock data; The circuit board structural connectivity fault is determined based on the intermittent conductivity of the circuit board, and the circuit board fault data is obtained.

7. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 1, characterized in that: The signal attenuation degree is determined in step S2 specifically as follows: Identify fault signal paths based on circuit board fault data; Constructing a fault electrical signal path model according to the fault signal path; Perform critical path fault detection based on the fault electrical signal path model to obtain critical path fault data; Perform impedance mismatch analysis based on critical path fault data to obtain impedance mismatch data; Perform signal transmission simulation based on impedance mismatch data to obtain signal transmission data; Statistical signal reflectivity based on signal transmission data; Perform signal crosstalk analysis based on signal transmission data to obtain signal crosstalk data; The signal attenuation degree is evaluated based on the signal reflectivity and signal crosstalk data.

8. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 1, characterized in that: Step S3 is specifically as follows: Step S31: Evaluate the image acquisition brightness requirement according to the signal attenuation degree; Step S32: adjusting the camera gain setting according to the image acquisition brightness requirement to obtain gain adjustment data; Step S33: adjusting the exposure time based on the gain adjustment data to obtain exposure time adjustment data; Step S34: performing motion blur simulation according to the exposure time adjustment data to obtain motion blur data; Step S35: Evaluate the blur degree based on the motion blur data, and adjust the aperture size based on the blur degree to obtain aperture adjustment data.

9. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 8, characterized in that: Step S35 is specifically as follows: Step S351: Calculating the edge gradient change rate based on the motion blur data; Step S352: Evaluate the image frequency domain energy attenuation rate according to the edge gradient change rate; Step S353: determining the blur degree based on the image frequency domain energy attenuation rate; Step S354: determining the image clarity adjustment requirement according to the blur level, and controlling the aperture state of the lens module based on the image clarity adjustment requirement; Step S355: adjusting the aperture control value of the lens module aperture state according to the blur level to obtain the aperture control value; Step S356: Send the aperture control value to the camera lens drive component, and adjust the mechanical aperture size to obtain aperture adjustment data.

10. The method for online adjustment of camera parameters in a binocular vision measurement system according to claim 1, characterized in that: Step S4 is specifically as follows: Step S41: collecting binocular optimized images according to the aperture adjustment data; Step S42: performing disparity calculation based on the binocular optimized image to obtain disparity data, and generating a disparity map based on the disparity data; Step S43: performing pixel depth conversion according to the disparity map to obtain an initial depth map; Step S44: performing hole filling processing based on the initial depth map to obtain filling depth data; and drawing a depth map based on the filling depth data; Step S45: converting the depth map into point cloud data, and performing three-dimensional reconstruction of the target object based on the point cloud data to obtain a three-dimensional target object model; Step S46: identifying surface points of the object structure based on the three-dimensional target object model; Perform 3D point cloud registration on the surface points of the object structure according to the preset 3D point cloud standard coordinates to obtain point cloud registration data; perform error calculation based on the point cloud registration data to obtain 3D structure deviation data; Step S47: adjusting the acquisition frame rate according to the three-dimensional structure deviation data, and transmitting the adjusted acquisition frame rate to the camera management platform to perform the camera parameter online adjustment task.

Citation Information

Cited By

  • Unsteady image-based ranging system and operating method thereof

    TWI931257B