Commit 3dabeea
committed
fix: complete rewrite of horizon calculation algorithm
The previous horizon calculation had fundamental bugs:
- Used extrinsics_inv instead of extrinsics (wrong direction)
- Incorrect axis flipping for coordinate transformation
- Complex 3D point projection approach was unreliable
- Resulted in 96%+ false positive rate (2435 issues at 0% tolerance)
New implementation:
- Uses camera pitch angle directly from extrinsics rotation matrix
- Simple and robust: horizon_y = cy - tan(pitch) * fy
- Works correctly with all calibration formats (OSDAR23, OSDAR26)
- No calibration-specific workarounds needed
- Removed unused helper functions and legacy code
Results:
- 0% tolerance: 140 issues (was 2435) - 94% reduction
- 10% tolerance: 4 issues (was 2229) - 99.8% reduction
- All 404 tests passing1 parent bcd656f commit 3dabeea
4 files changed
Lines changed: 290 additions & 342 deletions
File tree
- raillabel_providerkit/validation/validate_horizon
- tests/validation/validate_horizon
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
0 commit comments