Case Study & Engineering Showcase: An end-to-end computer vision pipeline designed for real-time panoramic image stitching of commercial shipping containers passing through high-speed automated port gate inspection portals (Smart Gate).
Note
NDA & Proprietary Notice:
To comply with strict Non-Disclosure Agreements (NDA) and Intellectual Property (IP) policies, the complete proprietary codebase, pre-trained neural network weights (.pt), and client operational datasets have been omitted from this public repository. This document presents the technical architecture, computer vision algorithms, and engineering design of the system.
In modern maritime port terminals, container inspection at check-in gates requires capturing high-resolution panoramic images of moving container sides (20ft, 40ft, 42ft, 45ft) to:
- Inspect structural integrity and physical damage (dents, tears, punctures).
- Read optical characters (ISO 6346 container code, danger labels).
- Validate inventory and seal status.
- Severe Perspective Distortion: Fixed wide-angle cameras close to the vehicle lane introduce substantial fisheye barrel distortion.
- Repetitive & Low-Texture Surfaces: Container walls consist of regular corrugated steel panels, rendering classical feature descriptors (SIFT, ORB, SURF) ineffective or prone to severe false positive matches.
- Motion & Dynamic Lighting: Uneven vehicle speeds, stop-and-go movements, vibrations, and varying ambient lighting conditions.
- Multiple Container Configurations: Handling single 40ft/45ft containers vs. trucks transporting two tandem 20ft containers (requiring automated detection and seam-splitting).
flowchart TD
A["Vehicle Camera Video Stream"] --> B["Camera Undistortion (Fisheye Correction)"]
B --> C["Frame Extraction & Crop Filtering"]
C --> D["Deep Learning Object Detection (YOLO)"]
subgraph YOLO_Detections ["YOLO Stage"]
D1["Corner Castings Detection"]
D2["Dent / Damage Surface Detection"]
end
D --> D1
D --> D2
D1 --> E["Tractor / Trailer Filtration & Keyframe Drop"]
D2 --> E
E --> F["Feature Extraction (SuperPoint)"]
F --> G["Graph Feature Matching (SuperGlue)"]
G --> H["Robust Homography Estimation & Warping"]
H --> I["Dent-Compensated Seam Blending"]
I --> J{"Twin 20ft Container Detected?"}
J -- "Yes" --> K["Seam Splitting (Split into 2 Panoramas)"]
J -- "No" --> L["Full Panorama Generation"]
K --> M["Aspect Ratio & Quality Validation"]
L --> M
M --> N["Export Production Panorama & Metadata Log"]
- Pre-calibrated intrinsic matrix
$K$ and distortion coefficients$(k_1, k_2, p_1, p_2)$ mapped using OpenCVcv2.initUndistortRectifyMap. - Real-time remapping on incoming frames before feeding into the detection and stitching pipeline.
- SuperPoint: Extracts sub-pixel repeatable interest points and 256-dimensional descriptor vectors, resilient to varying outdoor illumination.
- SuperGlue: Formulates data association as an optimal transport problem solved via the Sinkhorn-Knopp algorithm, filtering out ambiguous matches along identical corrugated folds.
- Dual-accuracy adaptive matching: Switches dynamically between high-precision mode and low-accuracy fallbacks depending on match density and confidence.
- Corner Casting Detection: Pinpoints ISO standard corner castings to determine container boundaries, beginning/ending frames, and reference planes.
- Dent & Deformity Detection: Detects surface deformations in advance so the homography estimator avoids warping artifacts around heavily damaged panels.
- Analyzes frame width variance to discard the tractor cabin and trailer bed.
- Calculates spatial step intervals to sample keyframes uniformly, reducing redundant frames by 60%–70% and drastically cutting latency.
- When hauling two 20ft containers on a single 40ft chassis, the system automatically detects the central gap using corner casting pairs and splits the panorama into two discrete output files (
cont1.jpgandcont2.jpg).
- Verifies final stitched dimensions against standardized ISO length-to-height aspect ratios:
- 20ft Container: Ratio
$\approx 2.4 : 1$ - 40ft Container: Ratio
$\approx 4.8 : 1$ - 45ft Container: Ratio
$\approx 5.4 : 1$
- 20ft Container: Ratio
- Auto-flags defective stitches in real-time logs for human auditor review.
| Layer | Technologies |
|---|---|
| Language | Python 3.8+ |
| Deep Learning | PyTorch, TorchVision, ONNX Runtime |
| Object Detection | Ultralytics YOLO |
| Feature Matching | SuperPoint, SuperGlue (Graph Neural Networks) |
| Computer Vision | OpenCV (cv2), NumPy, SciPy |
| Container & Ops | Docker, Docker Compose, NVIDIA Container Toolkit (CUDA) |
| Logging & Monitoring | Loguru, Custom Async Watcher |
- Input: Continuous video stream (1080p / 2K, 30-60 FPS).
-
Frame Extraction Latency:
$\approx 0.15\text{s} - 0.35\text{s}$ per vehicle pass. -
Feature Extraction & Matching:
$\approx 15\text{ms} - 25\text{ms}$ per frame pair (NVIDIA RTX 3090 / T4). -
Total Stitching Latency:
$\approx 0.8\text{s} - 1.8\text{s}$ per container (depending on length: 20ft vs. 45ft). -
Output Resolution: Seamless horizontal panorama up to
$10,000 \times 1,600$ pixels.
[Raw Frame 1] + [Raw Frame 2] + ... + [Raw Frame N]
⬇ (SuperPoint + SuperGlue Matching)
[========================================================================]
[ SEAMLESS STITCHED CONTAINER SIDE PANORAMA (40FT) ]
[========================================================================]
(Demo animations and sanitized before/after illustrations can be linked here)
This repository is presented for architectural review, technical demonstration, and portfolio evaluation purposes only. No proprietary assets or company confidential data are distributed within this repository.