shelf_aligner
ShelfAligner Module Technical Report
Overview
The ShelfAligner module implements computer vision-based shelf localization and alignment for retail monitoring systems. It identifies which reference shelf a camera frame corresponds to using feature matching and homography estimation.
Architecture
Core Components
- ShelfAligner: Main orchestrator class that manages shelf identification workflow
- FeatureMatcher: Handles feature extraction and matching using ORB/SIFT descriptors
- HomographyEstimator: Computes geometric transformations between frames and references
Key Features
- Multi-shelf Support: Loads and matches against multiple reference shelf images
- Feature-based Matching: Uses configurable ORB or SIFT feature detectors
- Robust Homography: RANSAC-based homography estimation with validation
- Confidence Scoring: Inlier ratio-based confidence assessment
Technical Implementation
Feature Matching Pipeline
- Feature Extraction: Detects keypoints and computes descriptors (ORB/SIFT)
- Descriptor Matching: K-nearest neighbor matching with Lowe’s ratio test
- Outlier Filtering: Geometric consistency through homography estimation
Homography Validation
- Determinant bounds check (0.1 ≤ det ≤ 10)
- Perspective distortion limits (|H[2,0]|, |H[2,1]| < 0.002)
- Condition number validation (singular value ratio < 10)
Configuration Parameters
| Parameter | Default | Purpose |
|---|---|---|
min_alignment_confidence | 0.3 | Minimum confidence threshold |
max_features | 5000 | Maximum keypoints per image |
match_threshold | 0.75 | Lowe’s ratio test threshold |
ransac_reproj_threshold | 5.0 | RANSAC reprojection error |
Performance Characteristics
Computational Complexity
- Feature Extraction: O(n) where n = image pixels
- Matching: O(m×k) where m = features, k = reference shelves
- Homography: O(matches) with RANSAC iterations
Quality Metrics
- Alignment Success: Determined by inlier ratio > threshold
- Geometric Consistency: Validated through homography constraints
- Runtime Efficiency: Precomputed reference features for fast matching