Adaptive Machine Vision Measurement for EV Battery Packs

As a researcher focused on industrial inspection technologies, I have dedicated my recent work to solving the measurement challenges of EV battery packs in high-mix, low-volume production lines. The manufacturing precision of an EV battery pack directly influences its safety and energy density. Through my doctoral research, I have developed a machine vision system that integrates adaptive focusing, single-image calibration, and robust 3D measurement algorithms to meet the stringent requirements of micron-level quality control. This article presents the core innovations and experimental validations of my proposed scheme.

## 1. System Architecture and Hardware Design

I designed the measurement system using a modular architecture, which comprises a motion control subsystem and a machine vision subsystem. The motion control subsystem uses an industrial motion control card (PCIe-1203) communicating via EtherCAT bus to command servo drives and I/O modules, enabling precise positioning of conveyor stoppers, lifting cylinders, clamping arms, and a 90° flipping mechanism. The vision subsystem is equipped with eight 2D industrial cameras for hole and aperture inspections, and two 3D line-laser cameras for surface scanning and thickness measurements. Each vision station uses an open-ring LED surface light to suppress high-reflection noise from metallic electrodes.

### 1.1 Servo System Selection

The lifting axes must handle a 50 kg load with a vertical stroke of 500 mm at a speed of 0.3 m/s and a repeatability of ±0.01 mm. I calculated the required torque as follows:

Given the gear radius \( r = 0.03 \, \text{m} \) and load force \( F = 500 \, \text{N} \), the load torque is:

\[
T_l = F \cdot r = 500 \times 0.03 = 15 \, \text{N·m}
\]

Considering a gearbox efficiency of 0.95 and a safety factor of 1.5, the motor-side torque requirement is:

\[
T_m = \frac{T_l \cdot 1.5}{i \cdot \eta} = \frac{15 \times 1.5}{7 \times 0.95} \approx 3.38 \, \text{N·m}
\]

I selected a servomotor with a rated torque of 4.9 N·m and a 7:1 planetary gearbox, providing an output torque of 34.3 N·m, which gives a comfortable margin.

For the flipping axis, the moment of inertia of a rectangular module of length 0.5 m and height 0.1 m with mass 50 kg is:

\[
J = \frac{1}{12} m (L^2 + H^2) = \frac{1}{12} \times 50 \times (0.5^2 + 0.1^2) = 1.08 \, \text{kg·m}^2
\]

This inertia is reflected to the motor side through a 5:1 reduction ratio:

\[
J_m = \frac{J}{i^2} = \frac{1.08}{25} = 0.0432 \, \text{kg·m}^2
\]

For a 90° rotation in 2 s with an acceleration time of 0.2 s, the angular acceleration is \( \alpha = 4.36 \, \text{rad/s}^2 \). The required motor torque is:

\[
T = \frac{J_m \cdot \alpha}{i \cdot \eta} = \frac{0.0432 \times 4.36}{5 \times 0.95} \approx 0.039 \, \text{N·m}
\]

Thus, a lower-power motor with a 5:1 gearbox and 23-bit absolute encoder was chosen.

## 2. Adaptive Focusing for Rapid Model Changeover

A major pain point in EV battery pack inspection is the frequent changeover between different module models, each with different heights and optical working distances. When a new model arrives, the camera must refocus quickly and accurately. Traditional manual focusing is slow and inconsistent. To address this, I developed a novel autofocus evaluation function called the **Robust Adaptive Gradient-Variance Fusion (RAGVF)**.

### 2.1 Limitations of Conventional Focusing Functions

The most widely used focus measures include the variance function, Tenengrad gradient, energy-of-gradient (EOG), Fourier-based functions, and entropy methods. Their formulas are summarized below:

**Variance function:**

\[
F_{\text{variance}} = \frac{1}{N} \sum_{i,j} \left( I(i,j) – \mu \right)^2
\]

**Tenengrad gradient:**

\[
F_{\text{Tenengrad}} = \sum_{i,j} \left( G_x^2(i,j) + G_y^2(i,j) \right)
\]

where \( G_x \) and \( G_y \) are Sobel convolution results in the x and y directions.

**Energy of gradient (EOG):**

\[
F_{\text{EOG}} = \sum_{i,j} \left[ \left( I(i+1,j) – I(i,j) \right)^2 + \left( I(i,j+1) – I(i,j) \right)^2 \right]
\]

**Fourier-based function:**

\[
F_{\text{freq}} = \sum_{u,v} |F(u,v)|^2 (u^2 + v^2)
\]

**Entropy function:**

\[
F_{\text{entropy}} = – \sum_{g=0}^{G} P(g) \log P(g)
\]

These functions suffer from several issues when applied to EV battery pack surfaces, which contain highly reflective metal terminals, dark plastic housings, and insulating films with varied textures. The traditional gradient operators are easily confused by specular highlights and sensor noise, producing false peaks in the focus curve. The Fourier transform is computationally heavy and less sensitive for low-texture surfaces. Entropy-based methods cannot distinguish between defocus blur and lack of texture.

### 2.2 The Proposed RAGVF Function

The RAGVF function operates in three stages:

1. **Gaussian pre-filtering:** The original image is convolved with a 2D Gaussian kernel:

\[
G(x,y) = \frac{1}{2\pi\sigma^2} e^{-\frac{x^2+y^2}{2\sigma^2}}
\]

I set \( \sigma = 1.5 \) to balance noise suppression and edge preservation. This step eliminates random hot spots caused by specular reflection on the electrode surfaces, which would otherwise dominate the gradient energy and destabilize the focus measurement.

2. **Eight-neighbor Laplacian gradient:** After filtering, I compute the second-order gradient using an eight-neighbor Laplacian kernel. The Laplacian response is more sensitive to defocus than a first-order gradient because the curvature of an edge drops faster than its slope when defocus blur increases. It also has a natural robustness to uniform illumination changes, which is beneficial in industrial environments with varying ambient light.

3. **Local variance weighting:** To retain sensitivity in low-texture areas while suppressing noise in high-reflectance zones, I calculate the local variance in a \( 3 \times 3 \) neighborhood:

\[
\mu_W = \frac{1}{9} \sum_{m=-1}^{1} \sum_{n=-1}^{1} I_g(i+m, j+n)
\]

\[
\operatorname{Var}(W) = \frac{1}{9} \sum_{m=-1}^{1} \sum_{n=-1}^{1} \left( I_g(i+m, j+n) – \mu_W \right)^2
\]

The final focus measure is:

\[
F_{\text{RAGVF}} = \sum_{i,j} \left| \nabla^2 I_g(i,j) \right|^2 \cdot \operatorname{Var}(W)
\]

The local variance acts as an adaptive weight that gives more influence to high-detail areas while suppressing flat regions where noise might otherwise create false gradients.

### 2.3 Experimental Comparison

I evaluated the RAGVF alongside five conventional methods using a sequence of 121 images of an EV battery pack end plate captured with different focal positions. The images were arranged from far defocus to exact focus and then to near defocus. I normalized each function’s output to the range [0,1]. The ideal focus curve should be unimodal, with the peak at the correct focus position and no local maxima.

The following table lists the sensitivity metric \( \text{MSE} \) defined as:

\[
\text{MSE} = \frac{F_{\max} – F(x+\Delta)}{F_{\max}} \times 100\%
\]

with \( \Delta = 5 \) image steps, and the computation time \( \tau \) for processing the entire 121-image sequence.

| Evaluation Function | MSE (%) | Computation Time (s) |
|———————|———|———————-|
| Variance | 5.01 | 10.02 |
| EOG | 18.60 | 19.71 |
| Tenengrad | 10.97 | 6.20 |
| Fourier | 17.90 | 20.80 |
| Entropy | 12.32 | 6.01 |
| **RAGVF (proposed)** | **19.70** | **16.81** |

The RAGVF achieved the highest sensitivity, meaning its slope near the focus position is steeper than that of all other functions. Although it is not the fastest computational method, the 16.81 s for 121 images corresponds to about 139 ms per image, which is acceptable for online autofocus. To further test noise robustness, I added zero-mean Gaussian noise (variance 0.05) to the whole sequence. The normalized focus curves showed that the RAGVF maintained a single sharp peak while several other functions (Variance and EOG) lost their unimodal property. This confirms the advantage of the Gaussian pre-filter and variance weighting.

## 3. Single-Image Camera Calibration Using Vanishing Points

After focusing, the vision system must calibrate the camera to convert pixel coordinates to physical dimensions. Traditional multi-view calibration methods, such as Zhang’s method, require capturing multiple images of a planar chessboard from different angles. However, the physical space of the inspection station is limited, and mounting a calibration target at different orientations is time-consuming. I therefore developed a calibration method that requires only a single image of a circular dot array, using the orthogonality of vanishing points derived from the dot rows and columns.

### 3.1 Camera Model and Distortion

The pinhole camera model maps a 3D world point \( (X_w, Y_w, Z_w) \) to a 2D pixel coordinate via extrinsic parameters \([R|t]\) and intrinsic matrix \( K \):

\[
\lambda \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} = K [R | t] \begin{bmatrix} X_w \\ Y_w \\ Z_w \\ 1 \end{bmatrix}
\]

with

\[
K = \begin{bmatrix} f_x & 0 & u_0 \\ 0 & f_y & v_0 \\ 0 & 0 & 1 \end{bmatrix}
\]

The lens distortion model includes radial and tangential components. For a distorted point \( (u_d, v_d) \), the undistorted coordinate \( (u_p, v_p) \) satisfies:

\[
u_p = u_d + \delta_u, \quad v_p = v_d + \delta_v
\]

\[
\delta_u = (u_d – u_0)(k_1 r^2 + k_2 r^4) + p_1(3(u_d-u_0)^2 + (v_d-v_0)^2) + 2p_2(u_d-u_0)(v_d-v_0)
\]

\[
\delta_v = (v_d – v_0)(k_1 r^2 + k_2 r^4) + 2p_1(u_d-u_0)(v_d-v_0) + p_2((u_d-u_0)^2 + 3(v_d-v_0)^2)
\]

where \( r^2 = (u_d-u_0)^2 + (v_d-v_0)^2 \).

### 3.2 Distortion Correction Using Row/Column Line Constraints

I used a glass scale plate with a 23×17 array of circular dots spaced 10 mm apart. The centers of the dots were extracted by ellipse fitting. Due to distortion, points on the same physical row are not strictly collinear in the image. I fit an optimal line for each row and column by minimizing the perpendicular distance:

\[
\min_{a_i,b_i,c_i} \sum_{j=1}^{N} \frac{(a_i u_{ij} + b_i v_{ij} + c_i)^2}{a_i^2 + b_i^2}
\]

This gives undistorted coordinates \( (u’_{ij}, v’_{ij}) \) that satisfy the collinearity constraint. Then, using the correspondence between distorted and undistorted points, the distortion coefficients \( k_1, k_2, p_1, p_2 \) and the principal point \( (u_0, v_0) \) can be solved by nonlinear least squares (Levenberg-Marquardt). The principal point is determined as the center of symmetry of the distortion field.

### 3.3 Focal Length from Orthogonal Vanishing Points

After undistorting the entire image, the horizontal and vertical dot rows provide two sets of parallel lines in the scene. Their intersection points are the vanishing points:

\[
V_x = (v_{x,1}, v_{x,2}), \quad V_y = (v_{y,1}, v_{y,2})
\]

Since the rows and columns are orthogonal in the world coordinate system, the corresponding directions in camera coordinates are orthogonal. This imposes the constraint:

\[
V_x^T (KK^T)^{-1} V_y = 0
\]

Assuming a square pixel (\( f_x = f_y = f \)), the focal length is:

\[
f^2 = – \frac{(v_{x,1} – u_0)(v_{y,1} – u_0) + (v_{x,2} – v_0)(v_{y,2} – v_0)}{(v_{x,2} – v_0)(v_{y,2} – v_0)}
\]

In practice, I use all available row and column vanishing point pairs to get a robust solution via SVD. The final camera parameters are refined by minimizing the reprojection error over all extracted dot centers:

\[
\min_{K, R, t} \sum_{j=1}^{m} \| p_j – \hat{p}(K, R, t, P_j) \|^2
\]

### 3.4 Calibration Accuracy Validation

I compared my method against Zhang’s multi-view method using a 23×17 circular dot plate. The table below summarizes the estimated parameters and reprojection RMSE.

| Parameter | Proposed Method | Zhang’s Method |
|——————|—————–|—————-|
| Focal length \( f \) | 1526 pixels | 1532 pixels |
| Principal point \( (u_0, v_0) \) | (640.2, 512.7) | (638.9, 510.1) |
| Reprojection RMSE | 0.43 pixels | 0.38 pixels |

The focal lengths differ by only 0.39%, and the principal point offset is about 2.8 pixels, indicating excellent consistency. The slightly higher RMSE of my method results from the single-image constraint set, but 0.43 pixels is still below the sub-pixel threshold required for high-precision measurement. To confirm the practical accuracy, I used both intrinsic parameter sets to measure a standard rectangular test object with known dimensions of 10 mm × 10 mm. The dimensional tolerance measured with my calibration was ±0.0030 mm, while Zhang’s method yielded ±0.0015 mm. Both are acceptable, and my method offers a significant reduction in calibration time and hardware complexity.

## 4. 2D Measurement of Module Holes Using Improved RANSAC

The accurate measurement of mounting holes and terminal slots on the EV battery pack end plates is essential for assembly line palletization. I developed a 2D measuring pipeline that combines ROI-based shape matching, caliper edge extraction, and a robust RANSAC circle fitting algorithm.

### 4.1 Image Preprocessing

The acquired images first undergo a three-stage preprocessing chain:

1. **Adaptive Gaussian low-pass filtering** to reduce Gaussian and impulse noise caused by sensor temperature and electromagnetic interference. The kernel size is dynamically adjusted based on local signal-to-noise ratio.

2. **Segmented linear contrast enhancement**:

\[
G(g) = \begin{cases}
\alpha \cdot g & 0 \le g < T_l \\
\beta \cdot (g – T_l) + g_1 & T_l \le g < T_h \\
\gamma \cdot (g – T_h) + g_2 & T_h \le g < 255
\end{cases}
\]

where \( \alpha, \beta, \gamma \) are chosen to brighten mid-tones and compress the highlight region to recover details behind specular reflections.

3. **Morphological closing** with a circular structuring element of radius 2 to fill small holes and smooth edge discontinuities.

After preprocessing, the signal-to-noise ratio improved from 18.6 dB to 32.4 dB, and the edge localization standard deviation dropped from ±1.5 pixels to ±0.3 pixels.

### 4.2 Template Matching and Caliper Edge Extraction

I generated a template image of a typical hole ROI and built a pyramid of 5 levels. The shape similarity between the rotated template \( T_{\text{rot}} \) and the subimage \( I_{\text{sub}} \) is calculated as:

\[
S = \frac{\sum T_{\text{rot}} \cdot I_{\text{sub}}}{\sqrt{\sum T_{\text{rot}}^2 \cdot \sum I_{\text{sub}}^2}}
\]

After locating the coarse hole center, I define a circular caliper region of width 20 pixels along the hole boundary. Along the circumference, 128 radial measurement lines are spaced uniformly. On each line, a Canny edge filter combined with a Zernike moment operator locates the subpixel edge position. This produces a set of 128 edge points for circle fitting.

### 4.3 Improved RANSAC Circle Fitting

The edge point set may contain outliers from burrs, stains, or lighting artifacts. To fit a robust circle, I use an improved RANSAC procedure:

1. Randomly sample 3 non-collinear points and compute the circle parameters \( (x_c, y_c, r) \).
2. Compute the radial distance \( d_i \) for every edge point:
\[
d_i = \left| \sqrt{(x_i – x_c)^2 + (y_i – y_c)^2} – r \right|
\]
3. Point \( i \) is an inlier if \( d_i < 1.2 \) pixels.
4. The iteration count is updated adaptively:
\[
k = \frac{\log(1-p)}{\log(1-w^3)}
\]
where \( p=0.99 \) and \( w \) is the current inlier ratio.
5. After the maximum consensus set is found, the circle is re-fitted using the least squares method on all inliers.

I evaluated the algorithm by measuring an M8 mounting hole whose reference diameter determined by a coordinate measuring machine (CMM) was 7.998 mm ± 0.003 mm. The results are shown below.

| Method | Mean Diameter (mm) | Std. Deviation (mm) | Max Deviation (mm) | Time per Hole (ms) |
|———————–|——————–|———————|———————|——————–|
| Manual micrometer | 7.992 | 0.012 | 0.025 | 2100 |
| Halcon edge detector | 8.003 | 0.008 | 0.018 | 320 |
| Improved RANSAC | 7.999 | 0.003 | 0.006 | 180 |

The improved algorithm reduced measurement uncertainty to ±0.006 mm, far exceeding the required ±0.02 mm tolerance for EV battery pack production.

## 5. 3D Reconstruction Using Cross-Ratio Invariance

For thickness and flatness measurements, the system employs two line-laser 3D cameras. The line-laser triangulation principle requires calibration of the light plane. I adopted a method based on the invariance of cross-ratio in projective geometry.

### 5.1 Light-Plane Calibration

A planar chessboard with known square size is placed in the field of view. Three collinear corners A, B, C on the board define a line \( l_1 \). The laser stripe intersects this line at point D. Due to the cross-ratio invariance between the world line and its image line, the world coordinate of D can be calculated as:

\[
\frac{AD}{AC} \cdot \frac{BQ}{BC} = \frac{ad}{ac} \cdot \frac{bq}{bc}
\]

where lowercase letters denote image projections. Solving for the world coordinate \( X_D \):

\[
X_D = \frac{K \cdot X_A (X_B – X_C) – X_B (X_A – X_C)}{K (X_B – X_C) – (X_A – X_C)}
\]

with

\[
K = \frac{ad / ac}{bq / bc}
\]

By moving the calibration board to multiple planes, I collected a set of 3D points lying on the laser plane. The plane equation:

\[
AX + BY + CZ = D
\]

is solved by SVD of the design matrix:

\[
P X = 0
\]

where \( X = [A, B, C, D]^T \). The result yields the optimal light-plane parameters.

### 5.2 Depth Image and Point Cloud Conversion

The 3D camera provides depth maps where each pixel \((u,v)\) corresponds to a unique 3D point \((X,Y,Z)\). To facilitate user interaction, I render the depth data with pseudo-coloring based on a dynamic colormap. In the background, the system converts depth maps to point clouds for plane-fitting and then converts back for visualization.

## 6. Robust PCA Plane-Fitting Algorithm

Flatness measurement of the EV battery pack surfaces is a key quality metric. The raw point cloud often contains outliers due to vibration, reflection, and double-sensor interference. To overcome the sensitivity of ordinary PCA to outliers, I proposed a novel robust algorithm that integrates RANSAC with PCA.

### 6.1 Traditional Plane-Fitting Methods

**Least Squares (LS):** Minimizes the sum of squared residuals for \( z = ax + by + c \). It is efficient but heavily biased by outliers.

**RANSAC:** Randomly samples three points, computes a plane, and counts the number of points within a threshold distance. It is robust but discards up to 12% of valid data points in my experiments.

**PCA:** The normal vector of the fitted plane corresponds to the eigenvector of the smallest eigenvalue of the covariance matrix:

\[
C = \frac{1}{n} \sum_{i=1}^{n} (p_i – \bar{p})(p_i – \bar{p})^T
\]

This method fails if the point cloud has local structures (e.g., a groove or a weld seam) or outliers that distort the covariance.

### 6.2 Proposed Algorithm

My algorithm proceeds as follows:

1. Randomly select a subset of 3 points from the point cloud.
2. Compute the local mean \( \bar{p} \) and the covariance matrix \( \Sigma = S^T S \) where \( S \) is the centered subset.
3. Perform eigen-decomposition of \( \Sigma \). The eigenvector \( v_1 \) corresponding to the smallest eigenvalue \( \lambda_1 \) is the candidate normal vector.
4. For the whole point cloud, compute the orthogonal distance of each point to the candidate plane:
\[
d_i = \frac{| (p_i – \bar{p}) \cdot v_1 |}{\| v_1 \|}
\]
Points with \( d_i < \tau = 0.1 \) mm are considered inliers.
5. Iterate up to 100 times, retaining the plane with the maximum number of inliers.
6. Refine the final normal vector by performing a standard PCA on the final inlier set.

This method combines the outlier rejection power of RANSAC with the accuracy of PCA on a clean subset.

### 6.3 Simulation Validation

I generated an ideal plane:

\[
z = 0.5x + 0.3y + 1
\]

with 800 points and added Gaussian noise with a standard deviation of 0.1. Then I inserted 100 random outliers uniformly distributed in the cube \([-1,1]^3\). The fitted plane coefficients \( a, b, c \) from each method are compared below.

| Method | \( a \) | \( b \) | \( c \) | \( \text{En} \) (°) | \( \text{Ed} \) (μm) |
|———————–|———|———|———|———————-|———————-|
| Least Squares | 0.606 | 0.422 | 1.079 | 6.53 | 112.2 |
| Traditional PCA | 0.677 | 0.341 | 0.904 | 7.32 | 118.3 |
| Classic RANSAC | 0.467 | 0.228 | 0.900 | 3.64 | 94.84 |
| **Robust PCA (proposed)** | **0.535** | **0.350** | **0.998** | **2.64** | **89.51** |

The proposed method achieved the smallest normal vector error (2.64°) and the lowest mean distance error (89.51 μm). Compared to classic RANSAC, the normal vector error was reduced by 27.5% while preserving about 95% of the valid data points.

### 6.4 Real-World Validation on EV Battery Packs

I integrated the algorithm into the inspection system and scanned a 100 mm × 200 mm region of an EV battery pack module side surface containing approximately 500,000 points. The true flatness value measured by a CMM was 38.6 μm. The results are shown below.

| Method | Computed Flatness (μm) | Deviation from CMM (%) |
|—————–|————————|————————|
| Least Squares | 102.3 | 165 |
| Classic RANSAC | 57.8 | 49.7 |
| Robust PCA | 41.8 | 8.3 |

The robust PCA algorithm delivered a flatness value of 41.8 μm, which is within the accepted range for EV battery pack production (≤50 μm). It also ran in about 85 ms on a standard industrial PC, meeting the real-time inspection requirement.

## 7. Thickness Measurement Using Dual-Camera Affine Transformation

To measure the thickness of the entire EV battery pack, the system uses two 3D cameras facing opposite sides. Each camera works in its own coordinate system. I developed a composite calibration fixture with multiple spheres having known physical coordinates measured by a CMM.

### 7.1 Calibration Fixture

The fixture is a rectangular block on which 9 spheres are mounted on each of the two opposite sides. The physical coordinates of each sphere center were obtained by a high-precision CMM. The two 3D cameras capture point clouds of the fixture, and the sphere centers in the point clouds are located using a sphere-fitting algorithm.

### 7.2 Affine Transformation Model

Let a physical point be denoted \( (X, Y, Z) \) and its measured point-cloud coordinate be \( (x, y, z) \). The affine transformation is:

\[
\begin{bmatrix} x \\ y \\ z \end{bmatrix} = A \begin{bmatrix} X \\ Y \\ Z \\ 1 \end{bmatrix}
\]

where

\[
A = \begin{bmatrix}
a_{11} & a_{12} & a_{13} & t_x \\
a_{21} & a_{22} & a_{23} & t_y \\
a_{31} & a_{32} & a_{33} & t_z
\end{bmatrix}
\]

For each pair of corresponding points, three linear equations are formed. With 9 points, the system is overdetermined, and the transformation matrix is solved by linear least squares:

\[
A = M N^T (N N^T)^{-1}
\]

In the actual setup, I obtained the following transformation matrices for the inner and outer cameras:

\[
H_1 = \begin{bmatrix}
7.7573\times10^{-4} & 0.0013 & 0.0092 & 225.3589 \\
1.0535 & 0.0013 & 0.2406 & 21.5198 \\
4.1328\times10^{-4} & 0.9991 & 0.6143 & 19.5521
\end{bmatrix}
\]

\[
H_2 = \begin{bmatrix}
0.2122 & 0.0584 & 10.0112 & 173.9992 \\
2.5456 & 0.0481 & 107.8091 & 2.1244\times10^3 \\
0.3197 & 1.0626 & 15.2917 & 304.1978
\end{bmatrix}
\]

### 7.3 Thickness Computation

During measurement, both cameras scan the opposite surfaces of the EV battery pack. After applying \( H_1 \) to the point cloud from camera 1 and \( H_2 \) to the point cloud from camera 2, all points reside in a common world coordinate system. I then fit a plane to the point cloud from one side using the robust PCA algorithm, and compute the mean distance from all points on the other side to this plane. This mean distance represents the module thickness.

The system was tested with a reference module whose thickness was measured by a CMM as 25.482 mm. The vision system measured 25.466 mm, yielding an error of 16 μm. Over 100 repeated scans, the standard deviation was 8 μm, demonstrating excellent repeatability.

## 8. System Integration and Software Development

To achieve full automation, I developed a software platform in C# with the Halcon machine vision library. The platform follows a layered architecture separating motion control, vision algorithms, and data management.

### 8.1 Motion Control Software

The motion control software provides:

– **User authentication** with different permissions for operators, engineers, and administrators.
– **Real-time monitoring** of servo positions, I/O status, and safety interlock states.
– **Model changeover configuration** based on XML templates. When a new EV battery pack model is selected, the system loads the corresponding motion recipes and auto-focus parameters. The “one-click changeover” function automatically moves the vision system to the required positions and executes the focus and calibration procedure.

The TCP communication layer uses socket connections with asynchronous buffering to exchange commands and status with the vision software and the motion control card. A heartbeat mechanism and automatic reconnection ensure reliable operation in an industrial environment.

### 8.2 Vision Software

The vision software interface contains modules for:

– **Production statistics** showing yield, measurement results, and MES communication status.
– **Measurement records** with detailed dimensional data, tolerance limits, and pass/fail status. Double-clicking an entry displays the original image and point cloud graph.
– **MES connection** for uploading measurement data and downloading work orders.
– **Parameter settings** for camera exposure, light intensity, and ROI positions.
– **Calibration tools** including nine-point, chessboard, and hand-eye calibration routines.

The software supports a full manual test mode where engineers can step through the inspection sequence for debugging. This modular design greatly reduces commissioning time.

### 8.3 Field Performance

The integrated system was deployed on a real production line for a leading EV battery pack manufacturer. The final performance is summarized in the table below.

| Metric | Requirement | Actual Achieved |
|——————————-|————-|—————–|
| 2D measurement accuracy | ≤ 0.03 mm | 0.018 mm |
| 3D measurement accuracy | ≤ 0.05 mm | 0.031 mm |
| Single-module inspection time | ≤ 70 s | 42.1 s |
| Changeover time | ≤ 30 min | 10 min |

During a continuous 72-hour run with 3,200 modules, the system maintained stable measurement accuracy with no accumulated drift. The false rejection rate dropped from 1.8% (manual inspection) to 0.11%, and the throughput improved by a factor of 4.2 compared with manual inspection.

## 9. Conclusions and Future Work

I have developed a comprehensive machine vision solution for adaptive high-precision measurement of EV battery packs. The key innovations include:

1. A gradient-variance fusion autofocus function that is robust to high-reflection surfaces and low-texture regions, significantly improving the speed and reliability of focusing during model changeover.
2. A single-image camera calibration method based on distortion correction and vanishing point constraints, achieving an accuracy comparable to conventional multi-view methods while reducing calibration time by 75%.
3. An improved RANSAC algorithm for sub-pixel hole edge fitting, delivering a 2D measurement accuracy of ±0.02 mm.
4. A robust PCA plane-fitting algorithm that effectively suppresses outliers in point clouds, achieving a flatness measurement accuracy of ±0.04 mm under industrial conditions.
5. A dual-camera affine transformation model that enables reliable thickness measurement of bulky EV battery packs.

My system successfully addresses the need for high flexibility and micron-level precision in modern battery manufacturing. In the future, I plan to explore the integration of deep learning for texture-adaptive segmentation and the use of FPGA-based edge computation to further reduce latency. The vision system currently relies on active laser scanning, but hybrid approaches combining structured light with line-laser triangulation may provide better coverage of complex surface geometries. I am also investigating the possibility of using reinforcement learning to automate the selection of optimal focus regions for different EV battery pack models, which would make the system even more autonomous and adaptive to unknown product variations.

Scroll to Top