First-class spherical undistort support#1369
Draft
lyehe wants to merge 7 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an internal “virtual cube-face” undistort path for spherical/equirectangular COLMAP cameras when training with --undistort, by expanding panoramas into six pinhole cube-face cameras and routing image/mask loading through projection-aware requests (without changing the UI/CLI or writing a cube_faces/ folder).
Changes:
- Expand equirectangular cameras into internal cube-face pinhole cameras during training setup and preserve train/eval splits through the expansion.
- Add
CubeFaceProjectionmetadata tocore::Cameraand thread it through the pipelined image loader cache keys + decode paths (including alpha-as-mask and grayscale aux images). - Update trainer/strategies/metrics eval to request projection-aware images/masks via the pipelined loader, and tighten early validation/error messaging for unsupported camera models.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/training/training_setup.cpp | Adds equirectangular→cube-face camera expansion for --undistort and applies split selection before expansion. |
| src/training/trainer.cpp | Passes cube-face projection into immediate GT/mask loads; adjusts bilateral-grid sizing by UID range; adds early camera-model validation. |
| src/training/strategies/mrnf.cpp | Routes immediate strategy image loads through projection-aware loader calls. |
| src/training/strategies/improved_gs_plus.cpp | Routes immediate strategy image loads through projection-aware loader calls. |
| src/training/metrics/metrics.hpp | Removes declarations for now-deleted non-pipelined eval helpers. |
| src/training/metrics/metrics.cpp | Switches eval to a projection-aware pipelined dataloader for GT + masks/alpha-masks. |
| src/training/dataset.hpp | Updates pipelined dataloader draining logic and propagates cube-face projection into image requests. |
| src/io/pipelined_image_loader.cpp | Implements CPU-side cube-face reprojection on cache miss and threads projection into caching + decode for images/masks/alpha masks/aux grayscale. |
| src/io/include/io/pipelined_image_loader.hpp | Extends request/worker structs and APIs to carry cube-face projection metadata. |
| src/core/include/core/cube_face_projection.hpp | Introduces CubeFaceProjection data structure. |
| src/core/include/core/camera.hpp | Adds cube-face projection storage/accessors on core::Camera. |
| src/core/camera.cpp | Carries cube-face projection through moves/copies and adjusts image sizing/byte estimates for projected cameras. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+199
to
+200
| int next_uid = 0; | ||
|
|
Comment on lines
+483
to
+487
| try { | ||
| inputs.gt_image = loader->load_image_immediate( | ||
| camera.image_path(), | ||
| make_metrics_load_params(gt_config, camera, true, true)); | ||
| make_metrics_load_params(gt_config, camera, true, true), | ||
| camera.cube_face_projection()); |
de5aac2 to
d8f7b40
Compare
d8f7b40 to
165e33e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes the existing
--undistortpath work for spherical/equirectangular COLMAP datasets by expanding each panorama into internal pinhole tangent views during loading.The current sampling uses 12 icosahedral directions at 90 degrees FOV. The generated views stay virtual: they reuse the source panorama and mask paths, flow through the existing projection-aware image loader/cache, and do not write precomputed split images to disk. That keeps the CLI and UI unchanged while giving the trainer pinhole-compatible views for spherical data.
Behavior
--undistorton spherical COLMAP imports expands each equirectangular panorama into 12 internal pinhole cameras.--undistortor--gut, spherical/non-pinhole datasets fail early with a direct message telling the user to choose one of those paths.--gutremains the native non-pinhole training path.Validation
LichtFeld-Studioin Release withninja -C build LichtFeld-Studio.git diff --check.campus parterreMRNF training pass with--undistort --strategy mrnf --iter 60000:ctest --test-dir build --output-on-failurereports no tests configured in this local build.