2d area array camera array splicing and position degree detection method and system
By establishing a unified world coordinate system through FPGA synchronous triggering and a high-precision calibration board, the problems of asynchronous acquisition by multiple cameras and inconsistent coordinate systems were solved, realizing high-precision and high-speed 2D area array camera array stitching and position detection.
Patent Information
- Application Number
- CN202611223425.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-11-06
AI Technical Summary
Existing technologies suffer from problems such as asynchronous acquisition by multiple cameras, inconsistent coordinate systems, splicing distortion of weakly textured workpieces, lack of global constraints in positional calculations, and low detection efficiency that makes it difficult to match the cycle time of high-speed production lines.
Multiple 2D area array cameras are synchronously exposed by FPGA, single-image distortion correction and grayscale preprocessing are performed, camera parameters are solved based on high-precision calibration board, a unified world coordinate system is established, mixed features are extracted for coarse matching and alignment and fine deformation correction, a global stitched image is constructed, and the position degree is solved in the global coordinate system. High-speed batch detection is achieved by using cache templates.
It achieves synchronous acquisition of multi-camera images and a unified coordinate system, reduces stitching and measurement errors, improves detection speed and reliability, and meets the detection requirements of high-speed production lines.
Smart Images

Figure CN123051674A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of visual inspection technology, specifically to a method and system for stitching and positional detection of a 2D area array camera. Background Technology
[0002] In large-scale component manufacturing 2D vision inspection scenarios, the workpiece's length and width dimensions often far exceed the effective imaging field of view of a single 2D area array camera, making it impossible to fully capture all measured features such as reference holes, positioning bosses, and contour edges in a single shot. The industry commonly employs multiple 2D area array cameras to capture images at different locations along the workpiece, then stitches these images together to form a global large image for unified inspection. However, this multi-camera stitching solution has consistently faced numerous challenging technical bottlenecks in actual production line implementation. In particular, the stitched area often becomes a blind spot due to inconsistent brightness, feature misalignment, and abrupt texture changes; this is figuratively referred to in the industry as the "stitching problem" of multi-camera stitching.
[0003] Existing technologies are primarily limited by the synchronization accuracy of camera acquisition timing. Traditional solutions often employ software delays to trigger multiple cameras, resulting in exposure time differences of 3 to 15 milliseconds between each camera. Under continuous conveyor belt movement, even minute time differences in the capture times of different cameras can cause spatial displacements of the same workpiece in different local images. Furthermore, since each camera is independently calibrated and maintains its own independent pixel coordinate system, there is a lack of a globally unified measurement benchmark. The pixel coordinates of local images cannot be directly converted into unified physical dimension coordinates, amplifying the feature position deviations after stitching.
[0004] Secondly, the stitching algorithm lacks adaptability to workpiece surface texture. Conventional stitching relies solely on corner features for matching, such as SIFT and SURF. When encountering workpieces with weak textures, such as low contrast, matte surfaces, or small holes, the number of effective matching points decreases drastically, leading to lateral or vertical misalignment and local stretching distortion in the stitching result. Existing methods do not perform systematic deformation correction on the global image after coarse stitching, resulting in obvious seams in overlapping areas of adjacent images, directly introducing systematic errors into subsequent positional calculations.
[0005] A more critical issue lies in the fragmented reference for positional tolerance calculation. Currently, most solutions calculate positional tolerance independently within local images of each camera, with each segment using its own detection reference, lacking a globally unified constraint. Positional deviations of the measured holes, bosses, and contours across images cannot be corrected globally, and the transmission error between local references accumulates step by step. Ultimately, the positional tolerance measurement error is often amplified to more than 0.1 mm, which completely fails to meet the form and position tolerance inspection standards for precision parts.
[0006] Furthermore, detection speed and anti-interference capabilities also have shortcomings. Multiple images need to undergo a series of sequential operations, including distortion correction, feature matching, stitching and fusion, contour extraction, and positional calculation. When there are more than three cameras, the overall time exceeds 60 milliseconds, which is difficult to match the production line cycle of more than 40 pieces per minute. Each inspection of batches of workpieces of the same specification involves repeating the entire process, lacking a template caching and reuse mechanism, resulting in serious redundant calculations. On the other hand, the stitched images often contain noise such as dust, burrs, and reflections. Traditional algorithms directly use a single contour center to calculate the positional degree without introducing global constraints. Discrete noise points significantly reduce the stability of repeated measurements, and there is a lack of abnormal feature filtering and over-limit warning mechanisms, making it difficult to guarantee the reliability of the detection data. It is evident that most existing technologies can only achieve local stitching or single-view detection, and cannot simultaneously meet the multiple requirements of seamless global stitching, unified benchmark high-precision positional calculation, and high-speed online detection. Summary of the Invention
[0007] In view of this, this application provides a 2D area array camera stitching and position detection method and system to solve the technical problems in the prior art, such as asynchronous acquisition of multiple cameras, inconsistent coordinate systems, stitching distortion of weak textured workpieces, lack of global constraints in position calculation which is susceptible to noise interference, and low detection efficiency which is difficult to match the pace of high-speed production lines.
[0008] In a first aspect, this application provides a method for stitching and positional detection of a 2D area array camera, including: The FPGA synchronous triggering unit controls N 2D area array cameras arranged in different detection areas of the workpiece to expose synchronously, acquire local images of the workpiece corresponding to the field of view of each camera in parallel, and perform single-image distortion correction and grayscale preprocessing on each local image to output the corrected local image, N≥2. Based on a high-precision calibration board, calibration images are acquired in the overlapping area of each camera. The intrinsic parameters, distortion coefficients and extrinsic parameter transformation matrices between adjacent cameras are solved simultaneously. Global parameter optimization is performed by bundle adjustment method, a unified world coordinate system is established, and a mapping matrix from the pixel coordinates of each local image to the global world coordinates is generated. The pixel equivalent is uniformly converted to the physical size of millimeters. Based on the mapping matrix, a mixed feature set containing corner and edge features is extracted in parallel from the local image after multi-path correction. Coarse matching and alignment of the mixed features in the overlapping area are performed, fine deformation correction is performed on the residual distortion of the coarse stitching, and pixel fusion is performed in the overlapping area to output a global stitched image. In the globally stitched image, the reference features and the sub-pixel contours of all measured features are extracted. A theoretical reference model is constructed using the reference features in the global coordinate system. The least squares constraint algorithm is used to solve the two-dimensional positional offset of each measured feature relative to the theoretical reference. The qualified status of each measured feature is determined according to the preset tolerance threshold. The obtained global calibration parameters, the obtained standard workpiece reference, and the theoretical coordinates of the measured feature are stored in the cache. When batch testing workpieces of the same specification, the cached data is directly called to calculate the deviation fine-tuning amount between the current image and the cache template. Output global stitched image and positional accuracy detection data of each feature, monitor stitching error and process time in real time, and trigger audible and visual alarms and save abnormal images when stitching error, positional accuracy exceeds the tolerance or process time exceeds the preset threshold.
[0009] Preferably, the N 2D area array cameras are arranged along the length and / or width of the workpiece, with a 10% to 20% image overlap area reserved between the fields of view of adjacent cameras, and N is 2 to 6 cameras; The FPGA synchronous triggering unit controls the timing deviation of all cameras' synchronous exposure to not exceed 500ns; The local images are uploaded in parallel to the GPU processing unit via a gigabit network interface and / or a USB 3.0 high-speed channel; The single-image distortion correction and grayscale preprocessing includes performing lens distortion correction, grayscale equalization, and noise filtering on each local image frame by frame.
[0010] Preferably, the bundle adjustment method simultaneously solves for the intrinsic parameter matrix, radial distortion coefficient and tangential distortion coefficient of each camera, as well as the rotation matrix and translation vector between adjacent cameras in the global parameter optimization. During production line operation, the features of the fixed reference hole of the workpiece are continuously extracted. When the global splicing offset reaches 0.01mm, the external parameter matrix is automatically corrected to compensate for the calibration drift caused by the vibration and / or temperature deformation of the support.
[0011] Preferably, the hybrid feature set includes SIFT corner features and sub-pixel contour edge features, and the extraction time for a single image feature does not exceed 2ms; The coarse matching alignment uses the FLANN fast nearest neighbor search algorithm to complete the feature matching of overlapping areas and remove mismatched outliers. The deformation fine correction uses a thin plate spline interpolation algorithm to perform nonlinear mapping on the pixel coordinates of the overlapping area; The pixel fusion adopts a confidence-weighted fusion strategy; The stitching error of the global stitched image does not exceed 0.015mm, and the processing time for a single stitching operation does not exceed 8ms.
[0012] Preferably, the reference feature includes a reference hole and / or a reference edge line, the measured feature includes a mounting hole and / or a positioning boss, and the sub-pixel contour extraction is implemented based on a sub-pixel edge positioning algorithm; The least squares constraint algorithm constructs global constraint conditions based on the reference features, solves the two-dimensional offset of the actual center coordinates of each measured feature relative to the theoretical center coordinates, and calculates the position degree value according to the form and position tolerance standard. A global noise filtering threshold is introduced to eliminate false contour features caused by burrs and / or dust.
[0013] Preferably, the positional repeatability measurement accuracy is ±0.02mm, and the calculation time for multiple feature positional degrees in a single batch does not exceed 9ms.
[0014] Preferably, the global calibration parameters include the intrinsic parameters, distortion coefficients, and global coordinate mapping matrix of all cameras; the standard workpiece cache template contains the global stitched image of the standard qualified workpiece, the theoretical coordinates of the reference feature and the theoretical coordinates of the measured feature; and the high-speed memory cache is GPU memory and / or system memory. The calculation of the deviation between the current image and the cache template takes no more than 1ms, and the total time for a single complete image stitching plus positional calculation does not exceed 18ms.
[0015] Preferably, when the workpiece shape changes, the global splicing error exceeds 0.015mm, or the change in lighting conditions exceeds the set range, the global calibration is automatically re-executed and / or the standard workpiece template is re-acquired and the cache is updated. The preset thresholds include a total time threshold of 18ms for single splicing and positional calculation, a global splicing error threshold of 0.015mm, and upper and lower limits of positional tolerance for each measured feature.
[0016] Secondly, this application provides a 2D area array camera array stitching and position detection system for performing the 2D area array camera array stitching and position detection method described in the first aspect, the system comprising: The multi-area array synchronous acquisition module is used to control multiple 2D area array cameras to synchronously acquire local images of the workpiece from multiple positions through the FPGA hardware synchronous triggering unit, and to complete single-image distortion correction and grayscale preprocessing. The global joint calibration module is connected to the multi-faceted array synchronous acquisition module. It is used to receive the corrected local image, and to globally optimize and solve all camera intrinsic and extrinsic parameters, distortion coefficients and global coordinate mapping matrix through the bundle adjustment method, establish a unified world coordinate system and perform online self-calibration. The GPU parallel hierarchical image stitching module is connected to the global joint calibration module. It is used to extract mixed features from multiple images in parallel based on the mapping matrix, perform coarse matching alignment and fine deformation correction, and pixel fusion to output a global stitched image. The global position degree unified calculation module is connected to the GPU parallel layered image stitching module. It is used to extract the reference features and the sub-pixel contours of the measured features in the global stitched image, solve the two-dimensional position degree of each feature in batches based on the least squares constraint, and determine the tolerance qualified status. The template pre-caching and reuse module is connected to the global joint calibration module and the global position degree unified calculation module, respectively, and is used to cache calibration parameters and standard workpiece templates, and reuse cached data in batch detection. The data output and status monitoring module is connected to the global position degree unified calculation module. It is used to output the global stitched image, the two-dimensional coordinates of each feature, the position degree value and the qualification judgment result, monitor the stitching accuracy and calculation time in real time, and trigger alarms and data archiving in abnormal conditions.
[0017] Preferably, the multi-faceted array synchronous acquisition module includes an FPGA hardware synchronization triggering unit and a high-speed parallel image transmission channel. The FPGA hardware synchronization triggering unit controls the exposure timing deviation of the multiple cameras to not exceed 500ns, and the high-speed parallel image transmission channel is a gigabit network interface and / or a USB 3.0 interface. The GPU parallel layered image stitching module is equipped with a CUDA computing core, and the global image stitching error does not exceed 0.015mm, and the stitching processing time does not exceed 8ms. The global position degree unified calculation module outputs a position degree repeatability measurement accuracy of ±0.02mm, and the calculation time does not exceed 9ms; The template pre-caching and reuse module achieves fine-tuning of the deviation between the current image and the cached template in batch detection in no more than 1ms, and the total time for a single complete stitching and positional calculation of the entire system is no more than 18ms.
[0018] The 2D area array camera array stitching and position detection method and system provided in this application have at least the following beneficial effects: Synchronous exposure of multiple cameras is controlled by FPGA hardware triggering, with timing deviations kept within 500ns. This ensures that each camera captures images of the workpiece at the same spatial location, avoiding feature misalignment caused by different acquisition times. Global joint calibration uses the BA bundle adjustment method to synchronously solve for all camera parameters, unifying all local images to the same world coordinate system and ensuring consistent coordinate references for subsequent stitching and measurement. This process forms a complete data consistency guarantee chain from image acquisition to coordinate mapping.
[0019] N cameras (N≥2) are arranged in multiple locations, with overlapping areas reserved between adjacent cameras. This allows for the complete imaging of large workpieces by segmenting coverage by multiple cameras when the field of view of a single camera is insufficient, thus overcoming the physical limitations of the field of view of a single camera.
[0020] The layered stitching strategy, which combines GPU parallel extraction of hybrid features, coarse matching alignment, and fine deformation correction, significantly improves stitching speed (stitching time ≤ 8ms) while ensuring stitching accuracy (stitching error ≤ 0.015mm), thus meeting the real-time requirements of online detection.
[0021] Reference features and measured features are uniformly extracted from the globally stitched image. A constraint model is constructed using the global reference to solve for the position degree. All measured features are measured under the same reference, eliminating the error accumulation caused by the inconsistency of the reference in regional measurement.
[0022] By caching calibration parameters and standard templates, batch detection only calculates the minute deviations between the current image and the template, significantly reducing repetitive computations and achieving high-speed batch detection. Real-time monitoring of stitching errors, process time, and positional deviations triggers alarms and saves abnormal images when anomalies occur, ensuring the controllability of the detection process and the traceability of the detection data. Attached Figure Description
[0023] Figure 1 A schematic diagram of a 2D area array camera stitching and position detection method is shown. Figure 2 A schematic diagram of a 2D area array camera stitching and position detection system is shown. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] See Figure 1 As shown, this application provides a method for stitching and positional detection of a 2D area array camera, including the following steps.
[0026] S1. N 2D area array cameras arranged in different detection areas of the workpiece are controlled by the FPGA synchronous trigger unit to expose synchronously, acquire local images of the workpiece corresponding to the field of view of each camera in parallel, and perform single-image distortion correction and grayscale preprocessing on each local image to output the corrected local image, N≥2. S2. Based on the high-precision calibration board, calibration images are acquired in the overlapping area of each camera. The intrinsic parameters, distortion coefficients and extrinsic parameter transformation matrices between adjacent cameras are solved simultaneously. Global parameter optimization is performed by the bundle adjustment method to establish a unified world coordinate system and generate a mapping matrix from the pixel coordinates of each local image to the global world coordinates. The pixel equivalent is uniformly converted to the physical size of millimeters. S3. Based on the mapping matrix, a mixed feature set containing corner and edge features is extracted in parallel from the local image after multi-path correction. Coarse matching and alignment of the mixed features in the overlapping area are performed, fine deformation correction is performed on the residual distortion of the coarse stitching, and pixel fusion is performed in the overlapping area to output the global stitched image. S4. Extract the reference features and sub-pixel contours of all measured features in the global stitched image. Construct a theoretical reference model with the reference features in the global coordinate system. Use the least squares constraint algorithm to solve the two-dimensional positional offset of each measured feature relative to the theoretical reference. Determine the qualified status of each measured feature according to the preset tolerance threshold. S5. Store the obtained global calibration parameters, the obtained standard workpiece reference, and the theoretical coordinates of the measured feature into the cache. When batch testing workpieces of the same specification, directly call the cached data and calculate the deviation fine-tuning amount between the current image and the cache template. S6. Output global stitched image and positional accuracy detection data of each feature, monitor stitching error and process time in real time, and trigger audible and visual alarms and save abnormal images when stitching error, positional accuracy exceeds the preset threshold or process time exceeds the preset threshold.
[0027] In this embodiment, in step S1, the FPGA synchronization trigger unit is a hardware synchronization signal generator built using a Field-Programmable Gate Array (FPGA) chip, which integrates a high-precision crystal oscillator and multiple independent output channels. This unit is connected to the external trigger interface of each camera via hardware trigger lines (such as LVDS differential signal lines), and simultaneously outputs synchronization exposure pulse signals to all cameras, enabling each camera to begin exposure and complete image acquisition at the same time. This hardware synchronization method does not rely on operating system scheduling or software command transmission, avoiding exposure time differences caused by uncertainties such as task scheduling delays and network transmission jitter in software triggering methods.
[0028] N 2D area array cameras are arranged along the length and / or width of the workpiece, with each camera corresponding to a different detection area of the workpiece. For workpieces whose length dimension is much larger than their width dimension (such as battery trays or large PCB boards), the cameras are arranged in a single row along the length direction; for workpieces whose length and width dimensions both exceed the field of view of a single camera, the cameras can be arranged in an array along both the length and width directions. An overlapping area is reserved between the fields of view of adjacent cameras to ensure sufficient feature matching range during stitching.
[0029] After simultaneous exposure by each camera, the output local images are uploaded in parallel through high-speed transmission channels. Parallel uploading means that the image data from each camera is transmitted simultaneously in independent transmission channels to their respective destinations, rather than being transmitted sequentially in a queue, in order to avoid the accumulation of time delays caused by serial transmission.
[0030] Single-image distortion correction remaps image pixel coordinates based on pre-calibrated intrinsic parameters and distortion coefficients for each camera, eliminating pixel position deviations caused by lens radial and tangential distortion. Gray-level equalization adjusts the overall gray-level distribution of the image, eliminating contrast differences in different areas due to uneven illumination. Noise filtering employs spatial or frequency domain filtering algorithms to suppress electronic and environmental noise introduced during image acquisition and transmission. The corrected local image after the above preprocessing is used as input for subsequent steps.
[0031] In step S2, the high-precision calibration plate refers to a calibration reference object with known precise geometric dimensions, typically a checkerboard calibration plate or a dot array calibration plate, whose grid spacing or circle center spacing has been calibrated with high precision. The calibration plate is placed at the testing station, ensuring that the feature points on the calibration plate are simultaneously located within the overlapping fields of view of adjacent cameras, and each camera synchronously acquires images of the calibration plate. The calibration plate is moved to multiple different positions and the acquisition is repeated until the feature points of the calibration plate cover the entire testing area.
[0032] Intrinsic parameters describe the internal imaging geometry of a camera, including principal distance (fx, fy) and principal point coordinates (cx, cy). Distortion coefficients describe the optical distortion of the lens, including radial distortion coefficients (k1, k2, k3) and tangential distortion coefficients (p1, p2). The extrinsic transformation matrix describes the rotation matrix R and translation vector T between adjacent cameras, where R is a 3×3 orthogonal matrix and T is a 3×1 vector.
[0033] Bundle adjustment is a global optimization algorithm that simultaneously optimizes 3D point coordinates and camera parameters. This algorithm projects the 3D world coordinates of all calibration board corner points onto the image planes of each camera, calculates the reprojection error between the projected points and the actual observed pixels, and uses minimizing the sum of squared reprojection errors of all corner points as the objective function. Iteratively optimizes the intrinsic parameters, distortion coefficients, and extrinsic transformation matrices of all cameras simultaneously. This global optimization method ensures that the parameters of all cameras achieve optimal coordination under the same objective function, eliminating coordinate deviations that may be introduced by independent calibration of each camera.
[0034] After global parameter optimization, a unified world coordinate system is established using the first camera coordinate system or any fixed point in space as the reference origin. Based on the intrinsic and extrinsic parameters of each camera, a mapping relationship from arbitrary local image pixel coordinates to global world coordinates can be established, generating a mapping matrix. Pixel equivalent refers to the physical size corresponding to a single pixel in the image. By calibrating and converting pixel coordinates to actual millimeter dimensions, a unified conversion from pixel units to millimeter physical dimensions is achieved. This conversion allows subsequent positional calculation results to be directly output in millimeters, facilitating direct comparison with the tolerance requirements specified on the workpiece drawing.
[0035] In step S3, the mapping matrix associates the pixel coordinates of each local image with the global world coordinates, providing an initial coordinate mapping basis for image stitching.
[0036] The hybrid feature set includes two different types of image features: corner features and edge features. Corner features are pixels in an image whose gradient magnitude and direction change significantly across multiple scales. They are rotation-invariant and scale-invariant, making them suitable for scenarios with changes in angle and scale. Edge features are a collection of pixels in an image whose grayscale changes drastically, representing geometric structures such as the contour lines and boundary lines of a workpiece. These two types of features differ in their physical form and mathematical description, and represent different dimensions of information in the image. Extracting both types of features simultaneously can create a complementary effect.
[0037] Coarse matching alignment refers to mapping each image to a unified coordinate system based on global initial values, and then using a feature matching algorithm to associate and pair mixed features in the overlapping areas of adjacent images to determine the relative positional relationship between the images.
[0038] Fine deformation correction refers to the fine adjustment of pixel coordinates in overlapping areas by using a deformation correction algorithm to address local nonlinear distortions (such as local stretching, misalignment, and twisting) remaining after coarse matching and alignment. This correction uses matching feature point pairs as control points to construct a smooth coordinate mapping function, calculates the precise coordinate offset for each pixel in the overlapping area, and ensures that corresponding pixels in adjacent images accurately overlap in the overlapping area.
[0039] Pixel fusion refers to the process of combining the pixel values of corresponding positions in the overlapping areas of adjacent images into a single pixel value according to certain rules. The fused overlapping area retains the effective information of each source image while avoiding seams and ghosting.
[0040] In step S4, the global stitched image is a complete workpiece image formed by stitching and fusing all local images, containing imaging information for the entire workpiece area. Extracting features from this complete image ensures that all features are measured in a unified coordinate system.
[0041] The datum feature is a geometric feature on the workpiece used to establish a measurement reference datum; its theoretical position and geometric shape are specified by the workpiece drawing. The measured feature is a geometric feature on the workpiece whose positional accuracy needs to be checked. Both features are extracted with sub-pixel precision, meaning the positioning accuracy of the contour points reaches the sub-pixel level.
[0042] A theoretical reference model is a theoretical reference system established based on the measured position of a reference feature in a globally unified coordinate system and according to the geometric constraints specified in the workpiece drawing. This model defines the theoretical position of the measured feature under ideal conditions.
[0043] The least squares constrained algorithm uses a theoretical benchmark model as a constraint and minimizes the sum of squared deviations of all measured features as the optimization objective to solve for the offset of the actual position of each measured feature relative to its theoretical position. This algorithm incorporates all measured features into a unified optimization objective function and solves for them simultaneously. The solutions for each feature are interconnected and mutually constrained, rather than calculated independently.
[0044] Two-dimensional positional offset refers to the comprehensive deviation of the actual center coordinates of the measured feature from the theoretical center coordinates in the plane. According to the definition of positional offset in the geometric tolerance standard, positional offset is equal to twice the center deviation vector magnitude, that is, positional offset = 2 × √(Δx² + Δy²).
[0045] The preset tolerance threshold refers to the upper limit of the positional tolerance of each measured feature as specified in the workpiece drawing. The calculated positional tolerance value is compared with this threshold to determine whether the positional tolerance of the measured feature is qualified or out of tolerance.
[0046] In step S5, the global calibration parameters include the intrinsic parameters, distortion coefficients, extrinsic transformation matrices, and global coordinate mapping matrices of all cameras. The standard workpiece datum and the theoretical coordinates of the measured feature refer to the datum feature position data and the theoretical center coordinates of the measured feature obtained after performing a complete inspection process on a standard qualified workpiece. The above data is persistently stored in a cache (GPU memory and / or system memory).
[0047] When batch inspecting workpieces of the same specification, the global calibration and standard template generation are no longer repeated for subsequent workpieces. Instead, the calibration parameters and template data in the cache are directly called. The currently acquired workpiece image is compared with the template, and only the small deviation between the two is calculated.
[0048] In step S6, the global stitched image and positional detection data are output to the host computer via a data interface for operators to view and archive. During the detection process, three indicators are continuously monitored: stitching error, positional determination result, and process time. When the stitching error exceeds a preset upper limit, the positional accuracy of any measured feature deviates from the tolerance, or the process time exceeds the specified time, an audible and visual alarm is triggered, and the current abnormal image is saved to a storage device for future reference.
[0049] For example, the complete execution process is illustrated using a new energy battery tray as the detection object.
[0050] Three 5-megapixel 2D area array industrial cameras (2592×1944 pixels resolution) are arranged along the length of the battery tray at the production line inspection station, corresponding to the head, middle, and tail areas of the tray, respectively. A 15% image overlap area is reserved between the fields of view of adjacent cameras. An FPGA synchronous trigger unit is installed on the side of the production line conveyor belt. This unit is connected to the external trigger interface of each of the three cameras via hardware trigger lines. The FPGA synchronous trigger unit integrates a 50MHz high-precision crystal oscillator. When the photoelectric sensor detects that the tray has arrived at the inspection station, the unit simultaneously sends synchronous exposure pulse signals to the three cameras, controlling the three cameras to start exposure and complete image acquisition at the same time.
[0051] Three grayscale images captured by three cameras are uploaded in parallel to the GPU processing unit via their respective gigabit network transmission channels. The GPU processing unit performs preprocessing on each local image frame by frame: remapping the image pixel coordinates according to the pre-calibrated distortion coefficients of each camera to complete lens distortion correction; calculating the image grayscale histogram and using a histogram equalization algorithm to stretch the grayscale distribution to the full range to eliminate the influence of uneven illumination; and using a 3×3 window median filter to traverse each pixel of the image and replace the current pixel value with the median of the neighborhood to suppress image noise. After preprocessing, the three corrected local images are output.
[0052] A checkerboard calibration board with an accuracy of 0.001 mm is placed at the inspection station, ensuring that the board is simultaneously within the overlapping field of view of the three cameras. The three cameras simultaneously acquire images of the calibration board under FPGA synchronous triggering. After acquisition, the calibration board is moved 50 mm along the workpiece conveying direction to the next position, and the acquisition is repeated, resulting in 12 calibration images at different positions. All calibration images are input into a global joint calibration module: this module detects the pixel coordinates of the checkerboard corner points in each calibration image, correlates the observed pixel coordinates of the same 3D world point in each camera image, and constructs an objective function containing all camera parameters and all corner point 3D coordinates. The objective function is the sum of squared reprojection errors of all corner points. The Levenberg-Marquardt algorithm is used to iteratively optimize this objective function, with 50 iterations. The convergence condition is that the reprojection error change is less than 0.001 pixels. Simultaneously, the intrinsic parameter matrix (including principal distance and principal point coordinates), radial distortion coefficients, tangential distortion coefficients, rotation matrix, and translation vector between adjacent cameras are solved. A unified world coordinate system is established with the first camera coordinate system as the reference, generating a mapping matrix from the pixel coordinates of each local image to the global world coordinates, with the pixel equivalent converted to 0.001 mm / pixel. All calibration parameters are stored in the GPU memory cache.
[0053] The GPU processing unit, based on the CUDA parallel architecture, processes the three corrected local images simultaneously. For each image, SIFT corner features and sub-pixel contour edge features are extracted simultaneously: the SIFT algorithm detects scale-space extrema, generating approximately 2000 128-dimensional feature descriptors per image; for sub-pixel contour edges, the Canny operator is used to detect edges, and then gray-level gradient changes are fitted along the edge normal direction to locate the edges with sub-pixel precision, extracting approximately 1500 edge feature points per image. The two types of features are merged to form a hybrid feature set.
[0054] The three images are mapped to a unified world coordinate system based on a global calibration mapping matrix. For mixed features in the overlapping regions of adjacent cameras, the FLANN algorithm is used to construct a KD-Tree index for nearest neighbor search matching. Feature point pairs with a ratio of nearest neighbor distance to second nearest neighbor distance of less than 0.7 are used as initial matching point pairs. The RANSAC algorithm is used to iterate the initial matching point pairs 2000 times. Each time, 4 pairs of matching points are randomly selected to calculate the transformation matrix. The number of interior points that satisfy the transformation is counted. The interior point distance threshold is set to 3.0 pixels. The transformation model with the most interior points is selected as the final model. Mismatched outliers that do not satisfy the model are removed to complete the coarse stitching.
[0055] For the local stretching and misalignment distortion remaining in the overlapping area after coarse splicing, 50 pairs of control points evenly distributed in the overlapping area are selected. The minimum bending energy interpolation function is constructed using the thin plate spline interpolation algorithm. The coordinate offset of each pixel in the overlapping area is smoothly interpolated. The process is iterated 3 times. After each iteration, the control point matching error is re-evaluated until it converges to within 0.5 pixels, thus completing the fine deformation correction.
[0056] For each pixel location in the overlapping region, the gradient magnitude of each source image at that location is calculated. The gradient magnitude is then normalized and used as the fusion weight. A larger gradient magnitude indicates a clearer image with richer details at that location, thus receiving a higher fusion weight. The pixel value at that location is then output after weighted summation. After fusion, a complete, seamless global stitched image is output.
[0057] In the globally stitched image, a sub-pixel edge localization algorithm based on gray-scale moments is used to extract the sub-pixel contours of the two reference long sides of the tray: Canny coarse edge localization is performed within the ROI containing the reference long sides to obtain integer pixel edge points. A 5×5 neighborhood gray-scale distribution is sampled along the normal direction with each edge point as the center, and the gray-scale moment is calculated. The sub-pixel offset is calculated based on the gray-scale moment ratio, and the edge is localized to a precision of 0.05 pixels. Simultaneously, the sub-pixel contours of the 12 mounting positioning holes are extracted using the same method.
[0058] A reference coordinate system is established by fitting a linear equation to the measured sub-pixel contour lines of the two reference long sides using the least squares method. Based on the nominal dimensions of the 12 mounting and positioning holes marked on the workpiece drawing, the theoretical center coordinates of each hole are calculated in the reference coordinate system. Using the reference coordinate system as a fixed constraint, a minimum objective function is constructed to minimize the sum of squared deviations between the actual and theoretical center coordinates of all positioning holes. The QR decomposition method is used to solve for the two-dimensional offset of the actual center coordinates of each positioning hole relative to the theoretical center coordinates. The two-dimensional positional degree of each positioning hole is calculated using the formula: positional degree = 2 × √(Δx² + Δy²). The contour area and roundness are calculated for each extracted contour. If the contour area deviates from the standard template by more than ±15% or the roundness deviates by more than ±10%, it is judged as a false feature caused by burrs or dust and filtered out. The positional degree values of each positioning hole are compared with the preset tolerance of ±0.05mm to determine whether each hole is qualified or out of tolerance.
[0059] After the initial calibration and standard workpiece inspection are completed, the intrinsic parameter matrices, distortion coefficients, rotation matrices, translation vectors, and global coordinate mapping matrices of all cameras are stored in the GPU memory cache. At the same time, the global stitched image of the standard qualified tray, the linear equation parameters of the two reference long sides, and the theoretical center coordinates of the 12 mounting positioning holes are stored in the system memory template library.
[0060] When batch inspecting pallets of the same specification, the inspection process for each pallet is as follows: After acquiring and preprocessing three-channel images, the GPU processing unit directly reads calibration parameters from GPU memory and a standard template from system memory. Based on the template matching algorithm, it calculates the deviation adjustment between the current image and the standard template within a search range of ±50 pixels and performs stitching fine-tuning. In the positional calculation stage, the theoretical coordinates of the reference long side and the theoretical coordinates of the positioning holes are read from the template, and only the actual position offset of the features in the current image is updated. After the entire process is completed, a global stitched image and the positional data of 12 positioning holes are output.
[0061] The data output and status monitoring module synchronously outputs the global stitched image, the two-dimensional coordinates (global world coordinate system) of the 12 positioning holes, the positional accuracy values of each hole, and the pass / fail judgment results to the inspection host computer via TCP / IP protocol. The built-in timer starts timing from the image acquisition trigger until the positional accuracy calculation results are output, recording the total time consumed in a single process in real time. The stitching error monitoring unit calculates the root mean square value of the coordinate difference between corresponding feature points in the overlapping area of adjacent images in real time. When the total time exceeds 18ms, the stitching error reaches 0.015mm, or the positional accuracy of any hole exceeds the tolerance, an audible and visual alarm is triggered via the RS485 interface. Simultaneously, the current global stitched image and positional accuracy data are saved to the local hard drive in JPEG and JSON formats, with the file name including a timestamp and workpiece ID.
[0062] In this embodiment, the measured global stitching error is 0.011mm, the single hole position measurement accuracy is ±0.016mm, the position repeatability measurement accuracy is ±0.02mm, the single image stitching processing time is 6.2ms, the 12-hole position calculation time is 7.5ms, the template fine-tuning time is 0.9ms, and the total process time is 16.2ms.
[0063] In this application, FPGA hardware synchronously triggers and controls the simultaneous exposure of multiple cameras, keeping the timing deviation within 500ns. This ensures that each camera captures an image of the workpiece at the same spatial location, avoiding feature misalignment caused by different acquisition times. Global joint calibration uses the BA bundle adjustment method to synchronously solve for all camera parameters, unifying all local images to the same world coordinate system, ensuring consistent coordinate references for subsequent stitching and measurement. This process forms a complete data consistency guarantee chain from image acquisition to coordinate mapping.
[0064] N cameras (N≥2) are arranged in multiple locations, with overlapping areas reserved between adjacent cameras. This allows for the complete imaging of large workpieces by segmenting coverage by multiple cameras when the field of view of a single camera is insufficient, thus overcoming the physical limitations of the field of view of a single camera.
[0065] The layered stitching strategy, which combines GPU parallel extraction of hybrid features, coarse matching alignment, and fine deformation correction, significantly improves stitching speed (stitching time ≤ 8ms) while ensuring stitching accuracy (stitching error ≤ 0.015mm), thus meeting the real-time requirements of online detection.
[0066] Reference features and measured features are uniformly extracted from the globally stitched image. A constraint model is constructed using the global reference to solve for the position degree. All measured features are measured under the same reference, eliminating the error accumulation caused by the inconsistency of the reference in regional measurement.
[0067] By caching calibration parameters and standard templates, batch detection only calculates the minute deviations between the current image and the template, significantly reducing repetitive computations and achieving high-speed batch detection. Real-time monitoring of stitching errors, process time, and positional deviations triggers alarms and saves abnormal images when anomalies occur, ensuring the controllability of the detection process and the traceability of the detection data.
[0068] Preferably, N 2D area array cameras are arranged along the length and / or width of the workpiece, with a 10% to 20% image overlap area reserved between the fields of view of adjacent cameras, and N is 2 to 6 cameras; The FPGA synchronous triggering unit controls the timing deviation of all cameras to be exposed synchronously within 500ns; Local images are uploaded in parallel to the GPU processing unit via a gigabit network interface and / or a USB 3.0 high-speed channel; Single-image distortion correction and grayscale preprocessing include performing lens distortion correction, grayscale equalization, and noise filtering on each local image frame by frame.
[0069] Specifically, the arrangement orientation of the 2D area array cameras is determined according to the geometry of the workpiece. For workpieces whose length dimension is much larger than their width dimension, the cameras are arranged in a single row along the length direction of the workpiece, with each camera sequentially covering a continuous segmented area along the length direction of the workpiece. For workpieces with large length and width dimensions, the cameras are arranged in a two-dimensional array along both the length and width directions, respectively covering continuous segmented areas along the length and width directions of the workpiece.
[0070] A 10%–20% image overlap area refers to the proportion of the area where the fields of view of adjacent cameras overlap in the projection onto the workpiece surface, relative to the width of the field of view of a single camera. This overlap area provides sufficient feature matching range for stitching adjacent images. When the overlap area ratio is less than 10%, the number of matchable features within the overlap area is insufficient, making it difficult to guarantee stitching accuracy; when the overlap area ratio is greater than 20%, the effective utilization rate of the camera field of view decreases, increasing the requirement for the number of cameras.
[0071] The range of 2 to 6 cameras covers the inspection needs of workpieces from small to large. Two cameras are suitable for smaller workpieces that only require two-segment assembly; six cameras are suitable for larger workpieces that require six-segment assembly.
[0072] The FPGA synchronous trigger unit simultaneously triggers all cameras via hardware level signals, with the timing deviation of each camera receiving the trigger signal not exceeding 500ns. A timing deviation of 500ns corresponds to a positional offset of less than 0.001mm (calculated at a conveyor belt speed of 2m / s) during the exposure time, which is negligible relative to the pixel equivalent.
[0073] Gigabit Ethernet and USB 3.0 interfaces are both commonly used high-speed data transmission interfaces for industrial cameras, with transmission rates reaching 1Gbps and 5Gbps respectively. Parallel uploading refers to the simultaneous transmission of image data from each camera in independent channels at their respective destinations.
[0074] Lens distortion correction uses the distortion coefficients obtained from camera calibration to perform an inverse transformation on the coordinates of each pixel in the image, remapping the distorted image to a distortion-free image. Gray-level equalization remaps the image's gray levels to achieve a uniform histogram distribution, enhancing image contrast. Noise filtering uses algorithms such as median filtering or Gaussian filtering to remove random noise from the image.
[0075] For example, for small stamped parts with a maximum size not exceeding 500mm × 300mm, two 5-megapixel area array cameras (resolution 2592 × 1944 pixels) are arranged along the length of the workpiece. The first camera covers the left half of the stamped part, and the second camera covers the right half, with a 15% overlap area reserved between the fields of view of the two cameras. An FPGA synchronous trigger unit controls the synchronous exposure of the two cameras, with a measured timing deviation of 350ns. The two cameras upload images in parallel to the GPU processing unit via independent gigabit network interfaces. Each frame upload takes approximately 3ms.
[0076] For a large PCB board (1200mm × 600mm), six 2K high-resolution area scan cameras (2048 × 2048 pixels) were arranged along the length of the PCB board, with each camera covering one of six consecutive segmented areas. A 10% overlap was reserved between the fields of view of adjacent cameras—this is the minimum overlap ratio for a six-camera configuration, aiming to achieve maximum coverage with the fewest cameras while ensuring stitching accuracy. An FPGA synchronous trigger unit controlled the simultaneous exposure of the six cameras, with a measured timing deviation of 420ns. The six cameras transmitted data in parallel via dual gigabit Ethernet ports, with three cameras sharing one gigabit Ethernet port, and each image upload taking approximately 5ms.
[0077] For the two camera configurations mentioned above (2 and 6 cameras), the single-image preprocessing for each camera performs the following operations: A distortion mapping table is constructed based on the pre-calibrated radial and tangential distortion coefficients of each camera; each pixel of the input image is remapped to the corrected coordinates according to the distortion mapping table, and a distortion-corrected image is output; the gray-level histogram of the corrected image is statistically analyzed, the cumulative distribution function is calculated, and the original gray-level values are mapped to equalized gray-level values, making the gray-level histogram tend to be uniformly distributed; a 3×3 window mid-range filter is used to traverse each pixel of the corrected image, and the current pixel value is replaced by the median gray-level value of neighboring pixels.
[0078] In this application, the number of cameras, ranging from 2 to 6, covers the detection needs of workpieces from small (2 cameras) to large (6 cameras). Arranged along the length and / or width directions, they can adapt to workpiece geometries with different aspect ratios, exhibiting broad scene adaptability. An overlap area of 10% to 20% achieves an optimal balance between ensuring stitching accuracy (providing sufficient matching features) and detection efficiency (avoiding excessive waste of camera field of view). Below 10%, matching features are insufficient; above 20%, detection efficiency decreases. Verification through embodiments shows that within this overlap area, using the hybrid feature matching and TPS deformation correction of this invention, a stitching error of 0.011mm can be achieved. A timing deviation of 500ns makes the imaging position deviation of the moving workpiece on the conveyor belt negligible (calculated at a conveyor speed of 2m / s, the deviation is only 0.001mm), eliminating image misalignment caused by different acquisition times. Gigabit Ethernet / USB 3.0 high-speed parallel upload ensures real-time transmission of multiple high-resolution images, avoiding the time accumulation of serial transmission and providing timely data supply for subsequent GPU parallel processing.
[0079] Preferably, the bundle adjustment method simultaneously solves for the intrinsic parameter matrix, radial distortion coefficient and tangential distortion coefficient of each camera, as well as the rotation matrix and translation vector between adjacent cameras in the global parameter optimization. During production line operation, the features of the fixed reference hole of the workpiece are continuously extracted. When the global splicing offset reaches 0.01mm, the external parameter matrix is automatically corrected to compensate for the calibration drift caused by the vibration and / or temperature deformation of the support.
[0080] Specifically, the intrinsic parameter matrix A is a 3×3 upper triangular matrix with the form: A = [fx, 0, cx; 0, fy, cy; 0, 0, 1]; where fx and fy are the principal distances in the x and y directions of the image (in pixels), respectively, and cx and cy are the principal point coordinates (in pixels). This matrix describes the mapping relationship from the camera coordinate system to the image pixel coordinate system.
[0081] The radial distortion coefficients, including three parameters k1, k2, and k3, describe the image distortion along the radial direction caused by the characteristics of the spherical lens in the lens optical system. The tangential distortion coefficients, including two parameters p1 and p2, describe the image distortion along the tangential direction caused by the non-parallelism between the lens and the imaging plane in the lens optical system. These five distortion coefficients together constitute the distortion model, which is used to correct the positional offset of each pixel in the image.
[0082] The rotation matrix R is a 3×3 orthogonal matrix with a determinant of 1, describing the relative attitude relationship between adjacent camera coordinate systems and containing three rotational degrees of freedom. The translation vector T is a 3×1 vector, describing the relative position offset between the origins of adjacent camera coordinate systems and containing three translational degrees of freedom. R and T together constitute the extrinsic transformation matrix, describing the spatial pose relationship between adjacent cameras.
[0083] BA global optimization uses all intrinsic and extrinsic parameters of all cameras and the 3D coordinates of all calibration plate corner points as optimization variables, and solves them synchronously and iteratively. This minimizes the deviation between the projected position of the same corner point in different camera images and the actual observed position when all variables are optimized simultaneously.
[0084] The workpiece fixed reference hole is a geometric feature on the workpiece with high positional accuracy, which exists in every workpiece and has a relatively fixed position. Its coordinates have been recorded in the standard template.
[0085] Global stitching offset refers to the root mean square value of the coordinate difference between corresponding feature points in the overlapping area of adjacent camera images in the stitching coordinate system. When this value reaches 0.01mm, it indicates that the calibration parameters may have drifted due to support vibration or temperature changes.
[0086] Automatic correction of extrinsic parameters refers to using the deviation between the actual position of the currently acquired reference hole feature and the theoretical position recorded in the template as the observation value, and using an optimization algorithm to fine-tune the original extrinsic parameters R and T so that the corrected extrinsic parameters can eliminate the splicing offset currently observed.
[0087] For example, BA global optimization uses the first camera coordinate system as a reference, incorporating the 3D world coordinates of the corner points of the checkerboard calibration board and the intrinsic and extrinsic parameters of all cameras into the objective function. The objective function E has the form: E = Σ i Σ j ||p ij -K i [R i |T i ]P j ||², where p ij Let P be the pixel coordinates of the j-th corner point detected in the image of the i-th camera. j Let K be the three-dimensional coordinates of the corner point in the world coordinate system. i Let [R] be the intrinsic parameter matrix of the i-th camera. i |T i Let be the extrinsic parameter matrix of the i-th camera. The Levenberg-Marquardt algorithm is used iteratively to find the minimum value of the objective function. During the iteration, the intrinsic parameter matrices A1, A2, and A3 (each containing four parameters fx, fy, cx, and cy), radial distortion coefficients (each containing k1, k2, and k3), tangential distortion coefficients (each containing p1 and p2), and the extrinsic parameters R between adjacent cameras are updated simultaneously. 12 T 12 R 23 T 23 After 50 iterations, the reprojection error converges to 0.0008 pixels, and all calibration parameters are output.
[0088] The online self-calibration mechanism is implemented as follows: After each tray completes inspection, the system automatically extracts the center coordinates of the two reference holes (10mm diameter, 500mm center distance) on the tray. The current splicing offset Δ is calculated as follows: Δ = √[(x1- 1)²+(y1- 1)²], where (x1, y1) are the current measured center coordinates of the reference hole, ( 1, 1) The theoretical coordinates of the reference hole are stored in the template. When Δ ≥ 0.01 mm, the deviation between the current measured coordinates and the theoretical coordinates of the two reference holes is used as the control point, and the correction amount of the extrinsic parameter matrix is resolved using least squares optimization. The optimization objective is min||J·δ||², where J is the Jacobian matrix and δ is the extrinsic parameter correction vector. The gradient descent method is used for iterative solution, and the step size of each iteration is adaptively adjusted according to the current error. The iteration stops when the number of iterations does not exceed 10 or the change in correction amount is less than 0.001 mm. After self-calibration is completed, the extrinsic parameter matrix in the cache is updated. Each self-calibration takes about 2 ms.
[0089] In this application, the BA algorithm simultaneously optimizes the intrinsic parameter matrix, radial distortion coefficient, tangential distortion coefficient, rotation matrix, and translation vector of all cameras, minimizing the reprojection error of all calibration plate corner points globally. This simultaneous optimization eliminates the coordinate deviation accumulated during independent calibration of each camera, establishing a high-precision unified world coordinate system. The online self-calibration function continuously extracts reference hole features and monitors the stitching offset in real time, automatically correcting the extrinsic parameter matrix when the offset reaches 0.01mm. This mechanism effectively compensates for calibration drift caused by support vibration and temperature deformation, ensuring stable detection accuracy during long-term operation and reducing the frequency of manual calibration and maintenance costs. In the embodiment, the stitching error drift did not exceed 0.007mm after 8 hours of continuous operation.
[0090] Preferably, the hybrid feature set includes SIFT corner features and sub-pixel contour edge features, and the single-channel image feature extraction time does not exceed 2ms; Coarse matching alignment uses the FLANN fast nearest neighbor search algorithm to complete feature matching of overlapping regions and remove mismatched outliers; Fine deformation correction employs a thin-plate spline interpolation algorithm to perform nonlinear mapping of pixel coordinates in the overlapping region; Pixel fusion employs a confidence-weighted fusion strategy; The stitching error of the global stitched image does not exceed 0.015mm, and the processing time for a single stitching operation does not exceed 8ms.
[0091] Specifically, SIFT (Scale-Invariant Feature Transform) corner features construct Gaussian pyramids and difference pyramids on the image to detect extreme points in scale space as candidate feature points. A principal orientation is assigned to each feature point, generating a 128-dimensional feature descriptor. SIFT features are invariant to image rotation and scale changes, and also exhibit some robustness to changes in illumination and viewpoint.
[0092] Subpixel contour edge features first employ edge detection operators (such as the Canny operator) to detect edge pixels in the image, obtaining an edge point set with integer pixel precision. Then, subpixel fitting is performed on the gray-level gradient along the normal direction of the edge points to precisely locate the edge position to the subpixel level.
[0093] Two types of features are extracted simultaneously from the same image: SIFT corner features represent point structures with significant texture variations in the image, while subpixel contour edge features represent the edges and contours of objects in the image. They complement each other in terms of feature type and the geometric information they represent: when the surface texture of the workpiece is sparse, resulting in an insufficient number of SIFT corner points, edge features can still provide sufficient matching information; when the workpiece edges are blurred, corner features can still provide stable matching points.
[0094] Single-channel image feature extraction time refers to the time required to extract all features from a single image captured by a single camera, from input to completion. This time of no more than 2ms is achieved through GPU parallel computing.
[0095] FLANN (Fast Library for Approximate Nearest Neighbors) is a fast approximate nearest neighbor search algorithm library for high-dimensional feature vectors. For the 128-dimensional feature descriptors generated by SIFT, FLANN constructs a KD-Tree or multi-dimensional random tree index structure and performs nearest neighbor search in the index to quickly find the nearest and second nearest feature points to the current feature point.
[0096] The removal of outliers by mismatches is achieved using the RANSAC (Random Sample Consensus) algorithm. This algorithm distinguishes between correct matches (inside points) and incorrect matches (outside points) through random sampling, model fitting, and inlier statistics, and removes the incorrect matches from the matching set.
[0097] Thin Plate Spline (TPS) interpolation is a mathematical method that extends the bending model of thin metal plates to multidimensional interpolation. This algorithm uses matching feature point pairs as control points to construct an interpolation function with a radial basis function of φ(r) = r²log(r), which minimizes the bending energy of the thin plate. The pixel coordinate offsets of the control points are used as constraints on the interpolation function. A smooth, non-linear offset is calculated for each pixel coordinate within the overlapping region, mapping pixels from adjacent images at that location to precisely overlapping positions.
[0098] Confidence-weighted fusion refers to evaluating the confidence level of each pixel in the overlapping region at that location from each source image. Confidence levels can be indicators such as image sharpness (gradient magnitude), distance from the boundary of the overlapping region, or local image contrast. The fused pixel value is obtained by weighting and summing the pixel values of each source image at the same location according to their respective confidence levels.
[0099] Global stitching error refers to the root mean square value of the coordinate deviation of corresponding feature points within the overlapping areas of adjacent images in the globally stitched image. This error comprehensively reflects the accuracy of each stage of coarse matching alignment, deformation correction, and fusion. A tolerance of no more than 0.015mm ensures the geometric accuracy of feature positions in the stitched image. The processing time for a single stitching operation, from the input of the corrected multi-channel images into the stitching module to the output of the globally stitched image, includes the time consumed by feature extraction, matching, deformation correction, and fusion. A tolerance of no more than 8ms ensures that the stitching stage does not become the time bottleneck of the entire detection process.
[0100] For example, in the three-way parallel image processing, the feature extraction process for each image is as follows: A Gaussian pyramid (4 layers per group, 3 groups in total) is constructed. Local extrema are detected in the difference pyramid as candidate feature points. Feature points with low contrast and strong edge response are removed. The remaining feature points are assigned a principal direction and a 128-dimensional descriptor is generated. Approximately 2000 SIFT corner features are extracted from each image. Simultaneously, the Canny operator (low threshold 50, high threshold 150, Gaussian filter σ=1.0) is used to detect image edges. After obtaining the integer pixel coordinates of the edge points, a 5×5 neighborhood grayscale distribution is sampled along the edge normal direction. The sub-pixel offset δ=(3M1-M0) / (2(M1+M0)) is calculated using the grayscale moment method, outputting the sub-pixel contour edge features. Approximately 1500 sub-pixel edge points are extracted from each image. After merging the two types of features, approximately 3500 mixed feature points are obtained from each image. The measured single-channel image feature extraction time on an RTX4060 GPU is 1.6ms.
[0101] For the mixed feature set in the overlapping region of adjacent cameras, a random KD-Tree index (4 trees) is constructed using the FLANN algorithm. Nearest neighbor search is performed on each feature point, and feature point pairs with a nearest neighbor distance to second nearest neighbor distance ratio less than 0.7 are used as initial matches. After obtaining the initial matching point set, the RANSAC algorithm is executed: four pairs of matching points are randomly selected to estimate the homography transformation matrix H. The projection error of all matching points after transformation is calculated, and matching points with an error less than 3.0 pixels are marked as inliers. This process is repeated 2000 times, and the transformation matrix with the most inliers is selected as the optimal transformation. All outliers that do not satisfy this transformation are removed, and the coarsely matched inlier matching set is output.
[0102] Fine deformation correction is performed using a thin-plate spline interpolation algorithm: 50 pairs of control points uniformly distributed in the overlapping region are selected from the RANSAC in-point matching set. Using the control point coordinate offset as the interpolation constraint, a thin-plate spline interpolation function with radial basis function φ(r) = r²log(r) is constructed. The offsets in the X and Y directions are calculated for the coordinates of each pixel in the overlapping region. The algorithm is iterated three times, and the control point coordinate error is re-evaluated after each iteration. Iteration stops when the errors of all control points converge to within 0.5 pixels.
[0103] The pixel fusion of the overlapping region is performed as follows: For each pixel position in the overlapping region, calculate the gradient magnitude of the first source image at that position G1=√(Gx1²+Gy1²) and the gradient magnitude of the second source image at that position G2=√(Gx2²+Gy2²). After normalization, the weights w1=G1 / (G1+G2) and w2=G2 / (G1+G2) are obtained. The fused pixel value I=w1·I1+w2·I2.
[0104] In this embodiment, the measured global stitching error was 0.011mm, and the processing time for a single stitching operation was 6.2ms.
[0105] In this application, the hybrid feature set composed of SIFT corner features and sub-pixel contour edge features complements each other in scenarios where a single feature fails. When the surface texture of the workpiece is sparse, resulting in an insufficient number of SIFT corner points, the sub-pixel contour edge features can still provide sufficient matching information; when the edges are blurred, the corner features can still work stably. This hybrid strategy makes the stitching algorithm applicable to workpieces with various materials and surface properties, such as metal, plastic, matte, and small-hole types. The FLANN algorithm quickly searches for nearest neighbors in a 128-dimensional high-dimensional feature space, significantly reducing the search time while ensuring matching accuracy. Combined with RANSAC to remove mismatched outliers, it ensures that all matching points participating in the stitching are valid matches, improving the reliability of the stitching. TPS thin plate spline interpolation constructs a minimum bending energy interpolation function with matching feature point pairs as control points, performing smooth nonlinear mapping on each pixel in the overlapping area. This algorithm effectively eliminates the local stretching and misalignment distortions left by coarse stitching, enabling adjacent images to achieve pixel-level precise overlap in the overlapping area, outputting a seamless global image. The actual measured stitching error in the embodiment is 0.011mm. Confidence-weighted fusion uses sharpness (gradient magnitude) as the weight, assigning higher fusion weights to areas with higher sharpness. This allows the fused image to retain more detail in overlapping areas, resulting in an output image quality superior to simple average fusion. The stitching error ≤0.015mm and stitching time ≤8ms provide clear performance targets for the system design, and both targets have been met in actual testing, as verified by implementation examples.
[0106] Preferably, the reference features include reference holes and / or reference edges, the measured features include mounting holes and / or positioning bosses, and the sub-pixel contour extraction is achieved based on a sub-pixel edge positioning algorithm; The least squares constraint algorithm constructs global constraint conditions based on the reference features, solves the two-dimensional offset of the actual center coordinates of each measured feature relative to the theoretical center coordinates, and calculates the position degree value according to the form and position tolerance standard. A global noise filtering threshold is introduced to eliminate false contour features caused by burrs and / or dust.
[0107] Specifically, a datum hole is a circular or oblong through hole or blind hole on a workpiece that serves as a measurement reference. Its position and size are specified by the workpiece drawing, and its machining accuracy is usually higher than that of general features. A datum edge is a straight edge on a workpiece that serves as a measurement reference, usually the long side of the workpiece or a precision-machined straight profile. Datum features are used to establish a measurement reference coordinate system, and their selection principles are positional stability, high machining accuracy, and clear visibility in the global image.
[0108] Mounting holes are hole structures on a workpiece used for assembly and connection with other components; their positional accuracy directly affects assembly quality. Locating bosses are raised structures on a workpiece used for positioning; their positional accuracy affects the workpiece's positioning accuracy in subsequent processes. These two types of features are the features whose positional accuracy needs to be tested.
[0109] The subpixel edge localization algorithm first uses a pixel-level edge detection operator to determine the integer pixel position of the edge, and then performs subpixel-level fitting on the gray-level distribution in the neighborhood of the integer pixel edge point to calculate the precise position offset of the edge point, thereby improving the edge localization accuracy from integer pixels to the subpixel level.
[0110] Constructing global constraints using datum features means treating the measured positions of all datum features as immutable fixed quantities, and establishing the entire measurement reference system with these datum features as anchor points. The positional deviation of each measured feature is then solved under the condition that the datum constraints are satisfied.
[0111] Two-dimensional offset refers to the difference between the position of the measured feature center in the actual image and its theoretical position in the reference coordinate system, including the offset Δx in the X direction and the offset Δy in the Y direction.
[0112] Geometric tolerance standards refer to the definitions and calculation methods for position tolerance in international standard ISO 1101 or national standard GB / T 1182. The position tolerance value is defined as the diameter of the maximum permissible range of variation of the actual position of the measured feature relative to its theoretical position, and the calculation formula is position tolerance = 2 × √(Δx² + Δy²).
[0113] The global noise filtering threshold is a pre-defined filtering condition based on the geometric attributes of the features (such as contour area, perimeter, roundness, aspect ratio, etc.). When the geometric attributes of the extracted contour features deviate from the theoretical geometric attributes of the standard features by more than the threshold, the feature is determined to be noise rather than the actual measured feature and is removed from subsequent calculations.
[0114] For example, in a battery tray inspection scenario, the reference features are selected from the two long sides of the tray as reference edges. These two long sides are approximately 1500mm long, with a machining accuracy of ±0.01mm, and are clearly visible in the global image. The features to be measured are selected from 12 mounting and positioning holes, each with a diameter of 10mm and a positional tolerance of ±0.05mm.
[0115] In the globally stitched image, sub-pixel contour extraction is performed on each baseline edge and each positioning hole: First, edge pixel-level detection is performed within the ROI containing the feature using the Canny operator (low threshold 50, high threshold 150), and the integer pixel coordinates of all edge points are marked. Then, for each edge point, 5 pixels are sampled on both the positive and negative sides of its edge normal direction, forming a grayscale sequence of 11 pixels. The sub-pixel offset is calculated using the grayscale moment method, with the formula δ=(3M1-M0) / (2(M1+M0)), where M0 is the first moment of the grayscale moments of each pixel on both sides of the edge line, and M1 is the second moment. After calculating the sub-pixel offset for all edge points, the coordinates of each edge point are corrected to integer coordinates plus the sub-pixel offset, and the sub-pixel contour point set is output.
[0116] For the subpixel contour point set of the two reference edges, the least squares method is used to fit the linear equations. The fitted linear equation for the first reference edge is a1x + b1y + c1 = 0, and for the second it is a2x + b2y + c2 = 0. A reference coordinate system is established with the first reference edge as the X-axis, the average direction of the two reference edges as the reference direction, and the point specified on the workpiece drawing near the midpoint of the reference edge as the origin. Based on the nominal dimensions on the workpiece drawing, the theoretical center coordinates of the 12 positioning holes are calculated in the reference coordinate system. i , i ).
[0117] For each positioning hole's sub-pixel contour point set, a circle is fitted using the least squares method to obtain the actual center coordinates (x... i ,y i Construct the objective function E=Σ i [(x i - i )²+(y i - i Using the baseline as a fixed constraint (constraint weights tending to infinity), the QR decomposition method is employed to solve this least squares problem, yielding the two-dimensional offset (Δx) of the actual center of each positioning hole relative to the theoretical center. i ,Δy i According to the definition of positional tolerance in GB / T 1182-2018 standard, calculate the positional tolerance PD of each hole. i =2×√(Δx i ²+Δy i ²).
[0118] After each positioning hole contour is extracted, the area A = ∮(xdy-ydx) / 2 and the perimeter P = ∮√(dx²+dy²) of the contour are calculated, and the roundness C = 4πA / P² is further calculated. The area filtering threshold is set to ±15% of the standard template area, and the roundness filtering threshold is ±10% of the standard template roundness. When the area or roundness of a contour exceeds this threshold, the contour is determined to be a false feature caused by burrs or dust, and it is removed from the positioning hole contour set and not included in subsequent positional accuracy calculations. In this embodiment, the single-hole positional accuracy measurement accuracy is ±0.016mm.
[0119] In this application, the contour extracted based on the sub-pixel edge positioning algorithm achieves a positioning accuracy of 0.05 pixels. Combined with a pixel equivalent of 0.001 mm / pixel, the physical positioning accuracy reaches 0.00005 mm. This level of accuracy provides high-precision input data for subsequent positional calculations, ensuring the accuracy of the positional measurement results. Global constraints are constructed using reference holes and / or reference edges, allowing all measured features (mounting holes and / or positioning bosses) to simultaneously solve for two-dimensional offsets under the same reference. This global constraint mode avoids error accumulation caused by inconsistent references when features are measured independently, ensuring consistency and comparability in positional measurements across different regions. Positional values are calculated according to the geometric tolerance standard (GB / T 1182-2018), and the measurement results can be directly compared with the tolerance requirements indicated on the workpiece drawings, demonstrating good industry universality and standard compliance. The global noise filtering threshold filters out false features caused by burrs and dust based on geometric attributes such as contour area and roundness, ensuring that all features involved in the positional calculation are genuine workpiece features, thus improving the reliability of the measurement results.
[0120] Preferably, the positional repeatability measurement accuracy is ±0.02mm, and the calculation time for multiple feature positional parameters in a single batch does not exceed 9ms.
[0121] Specifically, positional repeatability refers to the degree of dispersion of positional values obtained from multiple measurements of the same workpiece and the same measured feature under the same inspection conditions (same inspection system, same inspection procedure, same environmental conditions). A repeatability accuracy of ±0.02 mm means that the fluctuation range of the measured value is within ±0.02 mm centered on the average value, corresponding to the 3σ standard. This accuracy index reflects the measurement consistency and repeatability of the inspection system under stable conditions.
[0122] For example, the verification of positional repeatability measurement accuracy was performed as follows: The same standard qualified battery tray was selected, and under the same environmental conditions (temperature 20±1℃, humidity 50±5%RH), the same testing system was used for 10,000 consecutive tests. Each test performed a complete image acquisition, stitching, and positional calculation process. The positional measurement values of the 12 positioning holes were recorded in each test. The difference between the maximum and minimum positional accuracy of each positioning hole in the 10,000 measurements was calculated. The maximum difference for the 12 positioning holes ranged from 0.006mm to 0.008mm, all not exceeding 0.008mm. The repeatability measurement accuracy was calculated according to the 3σ standard. The repeatability measurement accuracy of the 12 positioning holes was distributed within the range of ±0.019mm to ±0.021mm, meeting the ±0.02mm requirement. In the 10,000 tests, the positional tolerance was set to ±0.05mm. The pass / fail judgment results of all 10,000 tests were consistent with the judgment results of the standard template, with a consistency rate of 100%.
[0123] The actual time taken for single-batch multi-feature positional calculation is as follows: Timing begins from the input of the global stitched image to the positional calculation module. The process sequentially executes sub-pixel contour extraction of 12 positioning holes, contour area and roundness calculation and filtering, least-squares fitting of the baseline edge, circle fitting of the positioning holes, establishment of the baseline coordinate system, least-squares constraint solving, numerical calculation of the 12 positional dimensions, and qualification judgment, until all data is output and timing ends. On an RTX4060 GPU, the total time taken for the entire calculation process of the 12 positioning holes was 7.5ms. In the PCB large board 48-pad inspection scenario, the total time taken for contour extraction, filtering, and positional calculation of the 48 pads was 8.6ms. Both measured data do not exceed the 9ms requirement.
[0124] In this application, the positional repeatability measurement accuracy of ±0.02mm (3σ standard) ensures a high degree of consistency in the results of multiple measurements of the same workpiece, making the measurement results reliable and reproducible. In the example, the numerical fluctuation of 10,000 consecutive tests did not exceed 0.008mm, and the pass / fail consistency rate was 100%, fully verifying the reliability of this repeatability accuracy index. The calculation time for the positional accuracy of multiple features in a single batch is ≤9ms, and the total time after adding the splicing time (≤8ms) is ≤18ms, ensuring that the entire inspection process does not become a bottleneck for the production line cycle time and meets the real-time requirements of high-speed online inspection.
[0125] Preferably, the global calibration parameters include the intrinsic parameters, distortion coefficients and global coordinate mapping matrix of all cameras, the standard workpiece cache template contains the global stitched image of the standard qualified workpiece, the theoretical coordinates of the reference feature and the theoretical coordinates of the measured feature, and the high-speed memory cache is the GPU memory and / or system memory. The calculation of the deviation between the current image and the cache template takes no more than 1ms, and the total time for a single complete image stitching plus positional calculation does not exceed 18ms.
[0126] Specifically, the global calibration parameters are all the mathematical parameters required to perform image stitching and coordinate transformation. These include the intrinsic parameter matrix A (containing fx, fy, cx, cy) for each camera, the radial distortion coefficients k1, k2, k3 and the tangential distortion coefficients p1, p2, the rotation matrix R and translation vector T between adjacent cameras, and the mapping matrix from local image pixel coordinates to global world coordinates. These parameters form the mathematical basis for performing image mapping, feature matching, and deformation correction in step three.
[0127] The global stitched image of a standard qualified workpiece is the output image after performing the complete process on the standard qualified workpiece using steps one to three of this invention. It contains all the imaging information of the standard qualified workpiece. The theoretical coordinates of the datum features are the measured values of the datum features (datum hole center coordinates or datum edge line equations) extracted from this global stitched image. The theoretical coordinates of the measured features are the measured values of each measured feature (mounting hole center coordinates or positioning boss center coordinates) extracted from this global stitched image. The standard template is established using standard workpieces that have been verified as qualified by a coordinate measuring machine or higher precision testing equipment.
[0128] GPU memory is high-speed dedicated memory onboard the GPU processing unit. It has extremely high data bandwidth with the GPU computing core (e.g., the GDDR6 memory bandwidth of the RTX 4060 is 256GB / s), making it suitable for storing data that needs to be frequently accessed during GPU core calculations, such as image data and calibration parameters. System memory is the system memory (DDR4 or DDR5) on the computer's motherboard. Its capacity is usually larger than GPU memory, making it suitable for storing large amounts of data with relatively low access frequency, such as standard template image libraries.
[0129] Deviation fine-tuning calculation refers to the process of batch inspecting workpieces of the same specification without re-performing the complete global calibration and standard template establishment. Instead, based on cached data, only the minute deviation between the currently acquired image and the standard template is calculated. The complexity of this calculation is far lower than that of the complete stitching process, and the time taken is no more than 1 ms.
[0130] The total time for a single complete image stitching and positional calculation refers to the time required from the completion of multi-channel image acquisition and input into the processing system, through distortion correction and preprocessing, global joint calibration parameter loading, GPU parallel image stitching, global positional calculation, to the final data output. A total time of no more than 18ms corresponds to a detection processing capacity of over 33 pieces per minute (including loading, unloading, and conveying time), meeting the detection cycle requirements of most high-speed production lines.
[0131] For example, after the initial global calibration is completed, the intrinsic parameter matrices of the three cameras (each a 3×3 matrix containing fx, fy, cx, cy), radial distortion coefficients (k1, k2, k3), tangential distortion coefficients (p1, p2), rotation matrix (3×3), translation vector (3×1), and global coordinate mapping matrix (3×4) are stored in the GPU memory cache area, occupying approximately 4MB of storage space.
[0132] After the initial standard workpiece inspection is completed, the global stitched image of the standard qualified pallet (7776×1944 pixels, 8-bit grayscale, approximately 15MB) is stored in the system memory cache. The linear equation parameters (a, b, c) of the two reference edges and the theoretical center coordinates of the 12 positioning holes are also stored. i , i The template data is stored in the GPU memory cache. The template data is stored in GPU memory in an array format that can be directly accessed by the CUDA core, in order to avoid additional latency caused by data format conversion.
[0133] When batch inspecting pallets of the same specification, the inspection process for each pallet no longer requires re-execution of global calibration and standard template establishment. During the stitching stage, the GPU processing unit directly reads calibration parameters from video memory and standard template images from system memory, performs normalized cross-correlation template matching (NCC), calculates the offset between the current image and the standard template within a ±50 pixel search range, and adjusts the stitching parameters based on the offset to complete stitching fine-tuning. The computational cost of this fine-tuning process is significantly reduced compared to full feature extraction, with a measured fine-tuning time of 0.9ms. In the positional calculation stage, the theoretical coordinates of the baseline features and the measured features are directly read from GPU video memory. Only the actual positions of each feature in the current image are updated, and then the positional offset is calculated based on the baseline constraints, avoiding the repeated establishment of the baseline model.
[0134] The actual measured total time of the entire process consists of: image acquisition and transmission 4.0ms, distortion correction and preprocessing 1.6ms, stitching fine-tuning 0.9ms, position calculation 7.5ms, and data output 2.2ms (executed in parallel with stitching and calculation), totaling 16.2ms, not exceeding 18ms.
[0135] In this application, the cached data covers all key information from calibration parameters (intrinsic parameters, distortion coefficients, mapping matrix) to standard templates (global stitched image, baseline, and theoretical coordinates of the measured features), forming a complete reusable data system. During batch detection, no cached calculations need to be re-executed. The dual-caching mechanism of GPU memory and system memory balances speed and capacity: the high bandwidth of GPU memory (≥256GB / s) is suitable for storing calibration parameters and template coordinates that require high-frequency GPU access, while the large capacity of system memory is suitable for storing a complete template image library. The two work together to achieve the fastest data access. The calculation time for deviation fine-tuning is ≤1ms, more than 8 times faster than the complete stitching process (approximately 8ms). Combined with positional calculation (≤9ms), the total time for single-piece detection is ≤18ms, enabling the system to process more than 33 pieces per minute, meeting the needs of high-speed production lines.
[0136] Preferably, when the workpiece shape changes, the global splicing error exceeds 0.015mm, or the change in lighting conditions exceeds the set range, the global calibration is automatically re-executed and / or the standard workpiece template is re-acquired and the cache is updated. The preset thresholds include a total time threshold of 18ms for a single stitching and positional calculation, a global stitching error threshold of 0.015mm, and upper and lower limits for the positional tolerance of each measured feature.
[0137] Specifically, workpiece shape change refers to switching to workpieces of different models or sizes on the production line. The original calibration parameters and template data are no longer applicable to the new workpieces, and new templates need to be recalibrated and collected.
[0138] A global stitching error exceeding 0.015mm means that the measured global stitching error during online testing exceeds the allowable upper limit. This deviation may be caused by factors such as bracket vibration, temperature changes leading to camera extrinsic parameter drift, or lens loosening. 0.015mm is used as the update trigger threshold, consistent with the upper limit of the global stitching error.
[0139] Lighting condition changes exceeding the set range refer to changes in ambient lighting (such as changes in light source brightness or light source position shift) causing the image grayscale distribution to exceed the preset allowable range. Significant changes in lighting conditions can affect the stability of feature extraction and matching accuracy.
[0140] When any of the above triggering conditions occur, the system automatically performs cache updates: for calibration-related triggers (splitting error exceeding the standard), recalibration is performed; for triggers caused by changes in workpiece shape or lighting, the standard workpiece template is re-acquired; for multiple triggers occurring simultaneously, recalibration and template re-acquisition are performed simultaneously.
[0141] The total processing time threshold of 18ms specifies the maximum allowable processing time from data acquisition completion to data output. The global stitching error threshold of 0.015mm specifies the maximum allowable difference in coordinates between corresponding feature points in the overlapping area of adjacent images in the stitched image. The upper and lower limits of the positional tolerance of each measured feature are specified by the workpiece drawing; different workpieces and different features may have different positional tolerances.
[0142] Specifically, the template pre-caching and reuse module includes a cache status monitoring subunit, which monitors three types of triggering conditions in real time and performs corresponding update operations: (1) Workpiece shape change trigger: When the host computer sends a workpiece model switching command via Modbus TCP protocol, the cache status monitoring subunit immediately marks the current cache template as invalid after receiving the command. At the same time, it sends a recalibration request to the global joint calibration module, and the calibration module automatically starts the calibration process (acquiring calibration board image, performing BA optimization, and updating calibration parameters). After calibration, it sends a re-acquisition template request to the position calculation module to acquire the standard template of the new workpiece. The entire update process is completed automatically. During the update, the system pauses batch detection and sends a "Cache updating in progress" status signal to the host computer. After the update is completed, detection is automatically resumed.
[0143] (2) Triggering of excessive splicing error: After each inspection, the splicing error monitoring unit calculates the current global splicing error E. An error buffer queue is defined to store the splicing error values of the three most recent workpieces. When the splicing error of three consecutive workpieces is greater than 0.015mm, it is determined that the calibration parameters have drifted significantly, and a recalibration request is automatically sent to the global joint calibration module. Inspection automatically resumes after the update is completed.
[0144] (3) Triggering a significant change in illumination conditions: After preprocessing each image channel, the grayscale statistics unit calculates the average grayscale μ and grayscale variance σ² of that image channel. The illumination condition database stores the standard average grayscale μ0 and standard grayscale variance σ0² of each camera when the standard template is established. When |μ-μ0| / μ0 > 20% or |σ²-σ0²| / σ0² > 30% of a certain image channel in the current detection, it is determined that the illumination conditions have changed significantly, and a request to re-acquire the template is automatically sent to the position calculation module. Detection automatically resumes after re-acquiring the standard workpiece template and updating the cache.
[0145] The alarm mechanism with a preset threshold: The timer starts counting from the moment the multi-channel image acquisition is completed and input into the processing system, and ends counting from the moment the positional calculation is completed and the first frame of data is sent to the data output module. The timing result is compared with the total time threshold of 18ms. The stitching error monitoring unit calculates the root mean square value of the coordinate difference of all matching feature points in the overlapping area of adjacent cameras, E_RMS=√[(1 / n)Σ(dx)]. i ²+dy i²)], compare E_RMS with the splicing error threshold of 0.015mm. The positional accuracy PD of each measured feature. i The data is compared with preset tolerance upper and lower limits (upper limit L_U, lower limit L_L, specified by the workpiece drawing). An alarm is triggered when either comparison result exceeds the threshold. The alarm signal is sent to the audible and visual alarm via the RS485 interface, outputting an audible alarm and a red flashing alarm. Simultaneously, the current global stitched image is saved to the local hard drive in JPEG format and the positional data is saved in JSON format, with the file names "abnormal_date_time_workpieceID.jpg" and "abnormal_date_time_workpieceID.json".
[0146] In this application, when the workpiece shape changes, the splicing error exceeds the limit, or the lighting conditions change significantly, the system automatically triggers recalibration and / or re-acquisition of templates and updates the cache. This adaptive mechanism ensures that the cached data always matches the current production conditions, avoiding detection errors caused by cached data invalidation due to production changes or environmental changes. Automatic cache updates are triggered when the splicing error exceeds the limit (0.015mm), completing parameter correction before the detection accuracy decreases. This achieves a "prevention-oriented" rather than "retroactive" maintenance mode, ensuring stable 24 / 7 system operation. A three-level monitoring system is constructed, consisting of a total processing time threshold (18ms), a splicing error threshold (0.015mm), and upper and lower limits of positional tolerance. This comprehensively monitors the detection process from three dimensions: processing speed, image splicing quality, and measurement results. In case of abnormalities, audible and visual alarms are triggered, and abnormal images are archived, ensuring that problems can be detected promptly and traced for analysis.
[0147] See Figure 2 As shown, this application provides a 2D area scan camera array stitching and position detection system for performing a 2D area scan camera array stitching and position detection method. The system includes: The multi-area array synchronous acquisition module is used to control multiple 2D area array cameras to synchronously acquire local images of the workpiece from multiple positions through the FPGA hardware synchronous triggering unit, and to complete single-image distortion correction and grayscale preprocessing. The global joint calibration module is connected to the multi-faceted array synchronous acquisition module. It is used to receive the corrected local images, and to globally optimize and solve all camera intrinsic and extrinsic parameters, distortion coefficients and global coordinate mapping matrix through the bundle adjustment method, establish a unified world coordinate system and perform online self-calibration. The GPU parallel hierarchical image stitching module is connected to the global joint calibration module. It is used to extract mixed features from multiple images in parallel based on the mapping matrix, perform coarse matching alignment and fine deformation correction, and pixel fusion, and output a globally stitched image. The global position degree unified calculation module is connected to the GPU parallel hierarchical image stitching module. It is used to extract the reference features and the sub-pixel contours of the measured features in the global stitched image, and solve the two-dimensional position degree of each feature in batches based on the least squares constraint and determine the tolerance qualification status. The template pre-caching and reuse module is connected to the global joint calibration module and the global position degree unified calculation module, respectively. It is used to cache calibration parameters and standard workpiece templates, and reuse cached data in batch inspection. The data output and status monitoring module is connected to the global position degree unified calculation module. It is used to output the global stitched image, the two-dimensional coordinates of each feature, the position degree value and the qualification judgment result, monitor the stitching accuracy and calculation time in real time, and trigger alarms and data archiving in abnormal conditions.
[0148] Specifically, the multi-area array synchronous acquisition module is the physical module that implements the hardware acquisition function in step S1. It consists of multiple 2D area array industrial cameras, an FPGA hardware synchronization trigger unit, and a high-speed image transmission channel. The FPGA hardware synchronization trigger unit is the core control component of this module, responsible for sending synchronization trigger signals to all cameras. The output of this module is a corrected local image after distortion correction and grayscale preprocessing.
[0149] The global joint calibration module receives calibration board images from the multi-array synchronous acquisition module, performs the global calibration function in step S2, and outputs the intrinsic and extrinsic parameters, distortion coefficients, and global coordinate mapping matrix of all cameras. The connection between this module and the acquisition module includes a data connection (receiving the calibrated images) and a control connection (controlling the calibration image acquisition process). This module also performs an online self-calibration function.
[0150] The GPU parallel hierarchical image stitching module receives the corrected local image from the multi-faceted array synchronous acquisition module and the calibration parameters from the global joint calibration module, executes the stitching function in step S3, and outputs the globally stitched image. This module runs on a GPU parallel architecture and is equipped with a CUDA computing core.
[0151] The global position degree unified calculation module receives the global stitched image from the GPU parallel hierarchical image stitching module, executes the position degree solution function in step S4, and outputs the two-dimensional position degree values and pass / fail judgment results of each measured feature.
[0152] The template pre-caching and reuse module receives and stores calibration parameters from the global joint calibration module and standard template data from the global position degree unified calculation module. During the cache reuse process in step S5, it provides cached data to these two modules. This module has a bidirectional connection with the two modules: data writing direction is from the calibration / calculation module to the cache module, and data reading direction is from the cache module to the calibration / calculation module.
[0153] The data output and status monitoring module receives position detection data and stitched images from the global position unified calculation module, outputs them to an external host computer, and monitors stitching accuracy and calculation time in real time. It also triggers alarms and data archiving when abnormalities occur.
[0154] The specific deployment methods and collaborative working processes of the six modules in the battery tray inspection application are as follows: The multi-area array synchronous acquisition module is deployed at the production line inspection station. This module contains three 5-megapixel 2D area array cameras, arranged along the length of the tray, with an overlap of 15% between adjacent cameras. An FPGA synchronous trigger unit (containing a 50MHz crystal oscillator) is connected to the external trigger interface of each camera via a hardware trigger line. When the photoelectric sensor is triggered, the FPGA synchronous trigger unit simultaneously sends exposure pulses (10μs pulse width) to all three cameras, controlling the exposure timing deviation of the three cameras to ≤300ns. The grayscale images acquired by each camera are transmitted in parallel to the GPU processing unit via three independent gigabit network cables (each with 1Gbps bandwidth). The module has a built-in single-image preprocessing submodule that performs distortion correction, histogram equalization, and median filtering frame-by-frame on each image, outputting three corrected images.
[0155] The global joint calibration module runs on the CPU and connects to the multi-faceted array synchronous acquisition module via gigabit network. During calibration, this module sends calibration image acquisition commands to the acquisition module, which returns 12 sets of calibration board images (each set containing three images). The calibration module detects checkerboard grid points and corners in each image, constructs an objective function containing all intrinsic and extrinsic parameters from the three cameras, and uses the Levenberg-Marquardt algorithm iteratively 50 times to synchronously solve all calibration parameters, generating a global coordinate mapping matrix. After calibration, all parameters are output to the template pre-caching and reuse module for storage. During production line operation, this module continuously receives reference hole images from the acquisition module, calculates the stitching offset, and automatically corrects the extrinsic parameter matrix when the offset reaches 0.01mm.
[0156] The GPU-parallel layered image stitching module runs on the GPU processing unit and is connected to the global joint calibration module via the CUDA data bus, receiving the mapping matrix output by the calibration module. It is also connected to the multi-faceted array synchronous acquisition module via a high-speed data bus, receiving three corrected local images. This module utilizes 3072 CUDA cores to process the three images simultaneously: approximately 1024 cores are allocated to each image, performing SIFT corner detection and sub-pixel edge extraction in parallel. FLANN matching and TPS correction are also computed in parallel on the GPU. After stitching, the globally stitched image is output to the global positional uniformity calculation module.
[0157] The global positional calculation module runs on the GPU processing unit and is connected to the stitching module via CUDA shared memory, directly reading the global stitched image. The sub-pixel contour extraction unit of this module detects the baseline edge and the edges of the positioning holes in the stitched image and locates them to sub-pixel accuracy; the baseline constraint construction unit fits the equation of the baseline edge line and establishes the baseline coordinate system; the least squares positional calculation unit constructs the optimization objective function for the 12 positioning holes and solves for the positional degree of each hole, while simultaneously performing contour filtering to remove noise. After the solution is completed, the positional degree data of the 12 positioning holes and the global stitched image are output to the data output and status monitoring module.
[0158] The template pre-caching and reuse module uses GPU memory and system memory as storage media, and is connected to the global joint calibration module and the global positional calculation module via a memory read / write bus, respectively. During the initial calibration and template establishment phases, this module receives and stores all calibration parameters from the calibration module and standard template data from the positional calculation module. During the batch detection phase, the positional calculation module reads the calibration parameters and template data from this module for rapid comparison. When the cache status monitoring subunit detects a trigger condition, this module sends an update request to the calibration module and / or the positional calculation module.
[0159] The data output and status monitoring module connects to the global positional calculation module via TCP / IP protocol. This module receives positional data, encapsulates it in JSON format, and receives the global stitched image, encodes it in Base64 format, and sends it to the host computer via a gigabit network interface. The built-in timer starts counting from the moment of data acquisition, and the stitching error monitoring unit reads the coordinate differences of corresponding feature points from the stitching module to calculate the stitching error. When the threshold is exceeded, an alarm signal is output via the RS485 interface, and the abnormal data is simultaneously written to the local hard drive for storage.
[0160] In this application, six modules are connected sequentially according to the data flow direction, with clear functional boundaries and well-defined interfaces for each module. The acquisition module is responsible for hardware-level image acquisition, the calibration module is responsible for establishing coordinate references, the stitching module is responsible for image processing, the calculation module is responsible for measurement and solution, the caching module is responsible for data acceleration, and the output module is responsible for result presentation and monitoring. The modular design facilitates system deployment, fault location, and independent upgrades. The connection relationship between the modules is consistent with the data flow direction (acquisition → calibration → stitching → calculation → output), and data is transferred between modules in a pipeline manner, eliminating data backflow or duplicate transmission, resulting in high processing efficiency. The template pre-caching and reuse module is connected to both the calibration and calculation modules, acting as an acceleration hub between the two key stages: receiving and storing calibration parameters in the calibration stage, and providing reused data in the calculation stage, enabling the calibration results and template data to be generated once and used multiple times. A complete closed loop is formed from acquisition to output: the acquisition module provides raw data, the calibration and stitching modules generate detection images, the calculation module outputs measurement results, and the output module monitors indicators at each stage and provides alarm feedback when anomalies occur, ensuring the controllability of the entire process and the reliability of the detection results.
[0161] The 2D area array camera array stitching and position detection system provided in this application embodiment can be applied to the 2D area array camera array stitching and position detection method provided above. For relevant details, please refer to the above method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.
[0162] It should be noted that the 2D area array stitching and position detection system provided in this embodiment is only illustrated by the above-mentioned division of functional modules / units when performing 2D area array stitching and position detection. In practical applications, the above functions can be assigned to different functional modules / units as needed, that is, the internal structure of the 2D area array stitching and position detection system can be divided into different functional modules / units to complete all or part of the functions described above. Furthermore, the implementation method of the 2D area array stitching and position detection method provided in the above-mentioned embodiment 1 and the implementation method of the 2D area array stitching and position detection system provided in this embodiment 2 belong to the same concept. The specific implementation process of the 2D area array stitching and position detection system provided in this embodiment 2 is detailed in the above-mentioned embodiment 1, and will not be repeated here.
[0163] Preferably, the multi-camera synchronous acquisition module includes an FPGA hardware synchronization triggering unit and a high-speed parallel image transmission channel. The FPGA hardware synchronization triggering unit controls the exposure timing deviation of the multiple cameras to not exceed 500ns, and the high-speed parallel image transmission channel is a gigabit network interface and / or a USB 3.0 interface. The GPU parallel hierarchical image stitching module is equipped with a CUDA computing core, and the global image stitching error does not exceed 0.015mm, with a stitching processing time of no more than 8ms. The global positional uniformity calculation module outputs a positional repeatability measurement accuracy of ±0.02mm, and the calculation time does not exceed 9ms. The template pre-caching and reuse module can fine-tune the deviation between the current image and the cached template in batch detection in no more than 1ms. The total time for a single complete stitching and positional calculation of the entire system is no more than 18ms.
[0164] Specifically, the FPGA hardware synchronization trigger unit is the core control component of the acquisition module, and the timing accuracy of its generated synchronization trigger signal determines the synchronization consistency of multi-camera exposures. A timing deviation of no more than 500ns ensures that the positional deviation of the moving workpiece in the imaging of each camera is negligible. Gigabit Ethernet and USB 3.0 interfaces provide sufficient parallel data transmission bandwidth.
[0165] CUDA (Compute Unified Device Architecture) is a GPU parallel computing architecture introduced by NVIDIA. It allows developers to use languages such as C / C++ to programmatically invoke GPU computing cores to perform massively parallel computing. This architecture breaks down large computing tasks into thousands of concurrent threads, which are executed simultaneously on multi-core GPUs.
[0166] For example, in a three-camera battery tray testing application, the measured data of each module's performance indicators are as follows: Multi-array synchronous acquisition module: The FPGA synchronous trigger unit uses an EP4CE10 FPGA chip with an integrated 50MHz crystal oscillator. The measured rising edges of the trigger pulses received by the three cameras were t0, t0+280ns, and t0+300ns, respectively, with a maximum timing deviation of 300ns, better than the 500ns requirement. The three cameras are connected to three gigabit Ethernet ports on the motherboard of the computer where the GPU processing unit is located via their respective independent gigabit Ethernet interfaces. The measured total image data upload rate was 3 × 150MB / s = 450MB / s, and the parallel upload time for the three images (5MB each) was approximately 4ms.
[0167] The GPU-parallel layered image stitching module utilizes 3072 CUDA cores on an RTX 4060 GPU. In actual testing, the entire computation process from input to the stitching module for three images, to the output of the globally stitched image, totaled 6.2ms (1.6ms for hybrid feature extraction, 1.2ms for FLANN matching, 1.8ms for TPS deformation correction, 0.9ms for confidence-weighted fusion, and 0.7ms for other overhead). The global stitching error was obtained by measuring the root mean square value of the coordinate differences between 50 pairs of corresponding feature points in the overlapping area; the measured value was 0.011mm.
[0168] Global positional accuracy unified calculation module: On an RTX4060 GPU, the entire process of sub-pixel contour extraction, contour area and roundness calculation and filtering, baseline edge line straight line fitting, positioning hole circle fitting, baseline coordinate system establishment, 12 positional accuracy calculations, pass / fail judgment, and result output for 12 positioning holes was measured to take 7.5ms. For 10,000 consecutive inspections of the same standard tray, the positional accuracy repeatability measurement accuracy of the 12 positioning holes, calculated according to the 3σ standard, ranged from ±0.019mm to ±0.021mm, meeting the ±0.02mm requirement.
[0169] Template pre-caching and reuse module: In batch detection mode, the entire process from reading cache calibration parameters and template data, performing normalized cross-correlation template matching (search range ±50 pixels), calculating deviation fine-tuning amount to completing splicing parameter adjustment takes 0.9ms in actual measurement, which is better than the 1ms requirement.
[0170] The total time for a single complete process of the entire system is calculated from the start of timing when the photoelectric sensor triggers the FPGA synchronous trigger unit until the data output and status monitoring module sends the detection data to the host computer. The total time consists of: image acquisition and transmission 4.0ms, distortion correction and grayscale preprocessing 1.6ms, global calibration parameter loading and mapping 0.3ms, stitching fine-tuning 0.9ms (in cache reuse mode), position calculation 7.5ms, and data packaging and output 2.2ms (executed in parallel with the stitching and calculation pipeline, with an actual additional time of 0.5ms). The actual measured total time for each stage is 4.0 + 1.6 + 0.3 + 0.9 + 7.5 + 0.5 = 14.8ms. Considering the data transfer and cache read / write overhead between stages, the actual measured total time for a single complete process is 16.2ms, which is better than the 18ms target requirement.
[0171] In the 6-camera PCB large board inspection system, the performance indicators of each module are as follows: The FPGA synchronous trigger unit controls the synchronous exposure of the 6 cameras, with a measured timing deviation of 420ns, which is better than 500ns; the GPU parallel layered image stitching module (RTX4090, 16384 CUDA cores) has a measured stitching processing time of 7.8ms and a global stitching error of 0.011mm; the global positional calculation module has a measured calculation time of 8.6ms for 48 sets of pad positionalities, with a repeatability accuracy of ±0.021mm; the template pre-buffer reuse module has a measured fine-tuning time of 0.8ms; and the total time for a single complete process of the entire system is measured to be 17.5ms. The measured data of both system configurations fully meet the corresponding indicator requirements.
[0172] In this application, by defining key parameters for each stage of the system—the acquisition module (timing deviation ≤ 500ns), the stitching module (error ≤ 0.015mm, time ≤ 8ms), the calculation module (repetition accuracy ±0.02mm, time ≤ 9ms), and the caching module (fine-tuning time ≤ 1ms)—the feasibility and verifiability of the system performance are ensured from the local to the overall level. The total time of ≤ 18ms for a single complete stitching and position calculation directly corresponds to the production line inspection cycle requirements, providing a clear performance basis for production line deployment. Actual measured data (16.2ms for the battery tray scenario and 17.5ms for the PCB board scenario) verify the engineering feasibility of this indicator. Achieving 0.015mm stitching accuracy, ±0.02mm repeatability accuracy, and 18ms total time simultaneously within the same system overcomes the limitations of traditional solutions where "high accuracy equates to slow speed, and fast speed equates to low accuracy," achieving a balance between high precision and high efficiency.
Claims
1. A 2D area array camera array stitching and position degree detection method, characterized in that, include: The FPGA synchronous triggering unit controls N 2D area array cameras arranged in different detection areas of the workpiece to expose synchronously, acquire local images of the workpiece corresponding to the field of view of each camera in parallel, and perform single-image distortion correction and grayscale preprocessing on each local image to output the corrected local image, N≥2. Based on a high-precision calibration board, calibration images are acquired in the overlapping area of each camera. The intrinsic parameters, distortion coefficients and extrinsic parameter transformation matrices between adjacent cameras are solved simultaneously. Global parameter optimization is performed by bundle adjustment method, a unified world coordinate system is established, and a mapping matrix from the pixel coordinates of each local image to the global world coordinates is generated. The pixel equivalent is uniformly converted to the physical size of millimeters. Based on the mapping matrix, a mixed feature set containing corner and edge features is extracted in parallel from the local image after multi-path correction. Coarse matching and alignment of the mixed features in the overlapping area are performed, fine deformation correction is performed on the residual distortion of the coarse stitching, and pixel fusion is performed in the overlapping area to output a global stitched image. In the globally stitched image, the reference features and the sub-pixel contours of all measured features are extracted. A theoretical reference model is constructed using the reference features in the global coordinate system. The least squares constraint algorithm is used to solve the two-dimensional positional offset of each measured feature relative to the theoretical reference. The qualified status of each measured feature is determined according to the preset tolerance threshold. The obtained global calibration parameters, the obtained standard workpiece reference, and the theoretical coordinates of the measured feature are stored in the cache. When batch testing workpieces of the same specification, the cached data is directly called to calculate the deviation fine-tuning amount between the current image and the cache template. Output global stitched image and positional accuracy detection data of each feature, monitor stitching error and process time in real time, and trigger audible and visual alarms and save abnormal images when stitching error, positional accuracy exceeds the tolerance or process time exceeds the preset threshold.
2. The method for stitching and position detection of a 2D area array camera array according to claim 1, characterized in that: The N 2D area array cameras are arranged along the length and / or width of the workpiece, with a 10% to 20% image overlap area reserved between the fields of view of adjacent cameras, and N is 2 to 6 cameras; The FPGA synchronous triggering unit controls the timing deviation of all cameras' synchronous exposure to not exceed 500ns; The local images are uploaded in parallel to the GPU processing unit via a gigabit network interface and / or a USB 3.0 high-speed channel; The single-image distortion correction and grayscale preprocessing includes performing lens distortion correction, grayscale equalization, and noise filtering on each local image frame by frame.
3. The method for stitching and position detection of a 2D area array camera array according to claim 2, characterized in that: The bundle adjustment method simultaneously solves for the intrinsic parameter matrix, radial distortion coefficient and tangential distortion coefficient of each camera, as well as the rotation matrix and translation vector between adjacent cameras in the global parameter optimization. During production line operation, the features of the fixed reference hole of the workpiece are continuously extracted. When the global splicing offset reaches 0.01mm, the external parameter matrix is automatically corrected to compensate for the calibration drift caused by the vibration and / or temperature deformation of the support.
4. The method for stitching and position detection of a 2D area array camera array according to claim 3, characterized in that: The hybrid feature set includes SIFT corner features and sub-pixel contour edge features, and the single-channel image feature extraction time does not exceed 2ms. The coarse matching alignment uses the FLANN fast nearest neighbor search algorithm to complete the feature matching of overlapping areas and remove mismatched outliers. The deformation fine correction uses a thin plate spline interpolation algorithm to perform nonlinear mapping on the pixel coordinates of the overlapping area; The pixel fusion adopts a confidence-weighted fusion strategy; The stitching error of the global stitched image does not exceed 0.015mm, and the processing time for a single stitching operation does not exceed 8ms.
5. The method for stitching and positional detection of a 2D area array camera array according to claim 4, characterized in that: The reference feature includes a reference hole and / or a reference edge line, the measured feature includes a mounting hole and / or a positioning boss, and the sub-pixel contour extraction is implemented based on a sub-pixel edge positioning algorithm. The least squares constraint algorithm constructs global constraint conditions based on the reference features, solves the two-dimensional offset of the actual center coordinates of each measured feature relative to the theoretical center coordinates, and calculates the position degree value according to the form and position tolerance standard. A global noise filtering threshold is introduced to eliminate false contour features caused by burrs and / or dust.
6. The 2D area array camera array stitching and position degree detection method according to claim 5, characterized in that: The positional repeatability measurement accuracy is ±0.02mm, and the calculation time for multiple feature positional degrees in a single batch does not exceed 9ms.
7. The method for stitching and position detection of a 2D area array camera array according to claim 6, characterized in that: The global calibration parameters include the intrinsic parameters, distortion coefficients and global coordinate mapping matrix of all cameras; the standard workpiece cache template contains the global stitched image of the standard qualified workpiece, the theoretical coordinates of the reference feature and the theoretical coordinates of the measured feature; and the high-speed memory cache is the GPU memory and / or system memory. The calculation of the deviation between the current image and the cache template takes no more than 1ms, and the total time for a single complete image stitching plus positional calculation does not exceed 18ms.
8. The method for stitching and position detection of a 2D area array camera array according to claim 7, characterized in that: When the workpiece shape changes, the global splicing error exceeds 0.015mm, or the change in lighting conditions exceeds the set range, the global calibration is automatically re-executed and / or the standard workpiece template is re-acquired and the cache is updated. The preset thresholds include a total time threshold of 18ms for single splicing and positional calculation, a global splicing error threshold of 0.015mm, and upper and lower limits of positional tolerance for each measured feature.
9. A 2D area array camera array stitching and position degree detection system, characterized in that, The system is used to perform the 2D area array camera array stitching and position detection method according to any one of claims 1 to 8, the system comprising: The multi-area array synchronous acquisition module is used to control multiple 2D area array cameras to synchronously acquire local images of the workpiece from multiple positions through the FPGA hardware synchronous triggering unit, and to complete single-image distortion correction and grayscale preprocessing. The global joint calibration module is connected to the multi-faceted array synchronous acquisition module. It is used to receive the corrected local image, and to globally optimize and solve all camera intrinsic and extrinsic parameters, distortion coefficients and global coordinate mapping matrix through the bundle adjustment method, establish a unified world coordinate system and perform online self-calibration. The GPU parallel hierarchical image stitching module is connected to the global joint calibration module. It is used to extract mixed features from multiple images in parallel based on the mapping matrix, perform coarse matching alignment and fine deformation correction, and pixel fusion to output a global stitched image. The global position degree unified calculation module is connected to the GPU parallel layered image stitching module. It is used to extract the reference features and the sub-pixel contours of the measured features in the global stitched image, solve the two-dimensional position degree of each feature in batches based on the least squares constraint, and determine the tolerance qualified status. The template pre-caching and reuse module is connected to the global joint calibration module and the global position degree unified calculation module, respectively, and is used to cache calibration parameters and standard workpiece templates, and reuse cached data in batch detection. The data output and status monitoring module is connected to the global position degree unified calculation module. It is used to output the global stitched image, the two-dimensional coordinates of each feature, the position degree value and the qualification judgment result, monitor the stitching accuracy and calculation time in real time, and trigger alarms and data archiving in abnormal conditions.
10. The 2D area array camera array stitching and position detection system according to claim 9, characterized in that: The multi-faceted array synchronous acquisition module includes an FPGA hardware synchronization trigger unit and a high-speed parallel image transmission channel. The FPGA hardware synchronization trigger unit controls the exposure timing deviation of the multiple cameras to not exceed 500ns, and the high-speed parallel image transmission channel is a gigabit network interface and / or a USB 3.0 interface. The GPU parallel layered image stitching module is equipped with a CUDA computing core, and the global image stitching error does not exceed 0.015mm, and the stitching processing time does not exceed 8ms. The global position degree unified calculation module outputs a position degree repeatability measurement accuracy of ±0.02mm, and the calculation time does not exceed 9ms; The template pre-caching and reuse module achieves fine-tuning of the deviation between the current image and the cached template in batch detection in no more than 1ms, and the total time for a single complete stitching and positional calculation of the entire system is no more than 18ms.
