4. Video preprocessing and calibration

Raw high-speed footage from an airbag deployment test is not directly measurable. Before any displacement or velocity can be extracted, the video must be transformed from a perspective projection of a moving scene into a metric, geometrically consistent coordinate system. This chapter covers the four preprocessing stages that make quantitative analysis possible: lens distortion correction, camera pose estimation, spatial scaling, and frame alignment. Each stage removes a specific class of error, and skipping any one of them propagates systematic bias into the final displacement and velocity curves.

Why Preprocessing Determines Measurement Validity

A typical airbag test uses one or more high-speed cameras running at 1,000–10,000 fps with wide-angle lenses to keep the entire deployment envelope in frame. Wide-angle lenses introduce barrel distortion that can displace a feature by tens of pixels near the image edges. The camera is also mounted at an oblique angle to the vehicle, so the image plane is not parallel to the motion plane of the airbag. Finally, the airbag surface moves toward the camera as it inflates, changing the apparent scale of features between frames. Each of these effects must be corrected before pixel coordinates can be converted to millimeters.

Core principle: Every pixel measurement must be traceable to a physical distance in a defined world coordinate system. Preprocessing establishes that traceability chain: distorted pixel → undistorted pixel → normalized image coordinate → world coordinate → metric displacement.

Lens Distortion Correction

Lens distortion is modeled with the standard radial-tangential polynomial. For a normalized image point (x, y) relative to the principal point, the distorted coordinates are:

x_dist = x(1 + k1·r² + k2·r⁴ + k3·r⁶) + 2·p1·x·y + p2·(r² + 2x²)
y_dist = y(1 + k1·r² + k2·r⁴ + k3·r⁶) + p1·(r² + 2y²) + 2·p2·x·y
where r² = x² + y²

The coefficients k1, k2, k3 (radial) and p1, p2 (tangential) are obtained by calibrating the camera with a checkerboard target. A practical procedure for an airbag test setup:

  1. Record 15–25 images of a 10×7 checkerboard (square size 30 mm) at varied orientations covering the full field of view, especially the corners where distortion is strongest.
  2. Run a calibration routine (OpenCV calibrateCamera, MATLAB Camera Calibrator, or equivalent) to solve for the intrinsic matrix K and distortion vector.
  3. Verify the reprojection error. A well-calibrated high-speed camera should yield a mean reprojection error below 0.3 px. If it exceeds 0.5 px, re-examine the target images for motion blur or insufficient corner coverage.
  4. Apply undistort or initUndistortRectifyMap to every frame. For a 1280×1024 sensor with k1 ≈ −0.28, corner pixels may shift by 40–60 px after correction.
Do not calibrate once and reuse the coefficients across different lens zoom or focus settings. Any change to the optical configuration invalidates the distortion model. Re-calibrate whenever the lens is adjusted.

Camera Pose Estimation

After undistortion, the camera's position and orientation relative to the vehicle must be determined. This is the extrinsic calibration. A common approach places a planar target with known 3D points (e.g., a calibration frame or marked vehicle reference points) in the scene and solves the Perspective-n-Point (PnP) problem:

[R | t] = solvePnP(objectPoints, imagePoints, K, distCoeffs)

Here R is the 3×3 rotation matrix and t is the translation vector that map world coordinates to camera coordinates. For airbag analysis, the world coordinate system is typically defined on the vehicle: origin at a reference point on the instrument panel, X axis lateral, Y axis vertical, Z axis longitudinal (toward the rear). Document this convention explicitly and keep it consistent across all cameras and all analysis stages.

The pose estimate lets you compute a homography for any plane in the scene. If the airbag deployment is approximately planar (e.g., a side curtain airbag viewed from the side), a single homography H maps image points to the airbag plane:

H = K · [r1 r2 t]
where r1, r2 are the first two columns of R for the target plane

For non-planar motion, use the full projection matrix P = K[R|t] and triangulate features from two or more synchronized views.

Scaling: Pixels to Millimeters

Scaling converts undistorted, pose-corrected image coordinates into physical units. Two methods are common:

MethodProcedureTypical Accuracy
Reference objectPlace a ruler or known-length marker in the plane of motion; measure its pixel length; compute mm/px±1–2% if the object is coplanar with the airbag
Homography / projectionUse the calibrated P matrix to project known 3D points into the image; derive the local scale factor at the airbag location±0.5–1% with good pose estimation

For a monocular setup with a reference marker of length L_mm spanning L_px pixels, the scale is s = L_mm / L_px. Displacement in millimeters is then d_mm = d_px · s. This is valid only if the airbag surface remains in the same plane as the reference marker. If the airbag moves toward or away from the camera, the scale changes with depth, and a single scalar s introduces error. In that case, use the full projection model to compute depth-dependent scaling.

A quick sanity check: after scaling, verify that a known vehicle dimension (e.g., steering wheel diameter, typically 370 mm) measures within 2% of its true value in the corrected image. If not, revisit the pose or scale calibration.

Frame Alignment and Temporal Synchronization

Frame alignment serves two purposes: aligning multiple camera views to a common time base, and aligning the image content to a stable reference so that only the airbag moves.

Temporal synchronization. When two or more cameras record the same event, their frame timestamps must be aligned. A common hardware method uses a common trigger signal (TTL pulse) that starts all cameras simultaneously. If hardware sync is unavailable, a visual event (e.g., an LED flash or a clapper) visible in all views can be used to find the offset. The offset is then applied by trimming frames so that frame N in camera A corresponds to the same instant as frame N in camera B.

Spatial alignment. Camera shake or vehicle motion during deployment can shift the background between frames. Register each frame to a reference frame using a stable background feature (e.g., a fixed point on the vehicle body). A rigid transform (translation + rotation) estimated from background features removes this motion. After alignment, any residual displacement is attributable to the airbag itself.

# Example: frame alignment using background feature points
# ref_pts: stable background points in reference frame
# cur_pts: corresponding points in current frame
M, inliers = estimateAffinePartial2D(ref_pts, cur_pts)
aligned_frame = warpAffine(current_frame, M, (width, height))

Integrated Preprocessing Pipeline

The four stages form a sequential pipeline. The SVG below shows the data flow and the coordinate transformation at each stage, from raw distorted pixels to metric world coordinates ready for displacement and velocity extraction.

Preprocessing Pipeline: Raw Pixels to Metric World Coordinates 1. Lens Distortion Correction k1,k2,k3,p1,p2 → undistorted px 2. Camera Pose Estimation (PnP) R, t, K → world coords 3. Scaling px → mm s = L_mm / L_px → metric units 4. Frame Alignment sync + register → stable ref Coordinate chain: distorted pixel (u_d, v_d) → undistorted pixel (u, v) → normalized (x, y) → camera 3D (X_c, Y_c, Z_c) → world 3D (X_w, Y_w, Z_w) → metric displacement (mm) Error Sources • Uncorrected barrel distortion • Wrong pose / extrinsic drift • Non-coplanar scale error • Temporal misalignment Verification Checks • Reprojection error < 0.3 px • Known dimension within 2% • Background residual < 1 px • Sync offset confirmed Output Ready For • Displacement vs. time (mm) • Velocity vs. time (m/s) • CAE correlation overlay • Occupant contact timing All stages must be completed before any quantitative measurement is extracted. Skipping a stage introduces systematic bias that cannot be corrected downstream.

Practical Calibration Workflow for an Airbag Test

The following sequence reflects a typical lab workflow for a driver-side airbag test with a single high-speed camera at 2,000 fps:

  1. Pre-test calibration: Record checkerboard images at the same lens setting and focus used during the test. Solve for K and distortion coefficients. Store them with the test metadata.
  2. Reference placement: Place a rigid calibration frame or a set of marked points with known 3D coordinates in the vehicle interior. These serve as the PnP targets for extrinsic calibration.
  3. Trigger check: Confirm that the camera trigger and the airbag ECU trigger share a common time base. Record the trigger offset if any.
  4. Post-test processing: Undistort all frames, solve PnP using the reference points, compute the homography or projection matrix for the airbag plane, apply scaling, and align frames to the first frame or to a stable background reference.
  5. Validation: Measure a known static dimension in the corrected frames. If the error exceeds 2%, adjust the calibration or re-examine the reference point coordinates.

Once these steps are complete, the video is ready for feature tracking and displacement extraction. The quality of the preprocessing directly determines the accuracy of the velocity curve and the validity of any comparison with CAE simulation results. A displacement error of 5 mm at 50 ms can shift the apparent velocity by 0.1 m/s, which may be significant when evaluating airbag deployment timing against occupant contact.