Weight observations by temporal position and landmark frequency - #2159
Weight observations by temporal position and landmark frequency#2159CedricThebault wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new observation-weighting strategies to the SfM expanding pipeline (density-based and track-based), integrates them into bundle initialization, and updates residual/error statistics to optionally reflect per-observation weights.
Changes:
- Introduces track-position and track-length weighting utilities (
TrackWeighting.*) plus a dedicated unit test. - Wires observation-weight resets and optional weighting passes into
SfmBundle::initializeIteration, and makes distance weighting multiplicative. - Exposes new CLI/Meshroom parameters and updates residual/error computations to optionally apply observation weights.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/software/pipeline/main_sfmExpanding.cpp | Adds CLI options for the new weighting modes and attempts to pass them into the SfM bundle pipeline. |
| src/aliceVision/sfm/utils/poseFilter.cpp | Weights the accumulated reprojection error contributions by observation weight. |
| src/aliceVision/sfm/sfmStatistics.hpp | Extends residual mean/median API with an optional “weightedResiduals” mode. |
| src/aliceVision/sfm/sfmStatistics.cpp | Implements optional weighted residual collection for mean/median computation. |
| src/aliceVision/sfm/pipeline/expanding/TrackWeighting.hpp | Declares new track-based weighting utilities and documents their intended behavior. |
| src/aliceVision/sfm/pipeline/expanding/TrackWeighting.cpp | Implements temporal-position and track-length weighting plus a weight reset helper. |
| src/aliceVision/sfm/pipeline/expanding/TrackWeighting_test.cpp | Adds unit coverage for the new track-based weighting behavior. |
| src/aliceVision/sfm/pipeline/expanding/SfmBundle.hpp | Adds new configuration knobs for density/track weighting and their parameters. |
| src/aliceVision/sfm/pipeline/expanding/SfmBundle.cpp | Resets weights each iteration and conditionally applies density and/or track weighting. |
| src/aliceVision/sfm/pipeline/expanding/DistanceWeighting.cpp | Switches distance weighting to multiply into existing weights (to compose with other strategies). |
| src/aliceVision/sfm/CMakeLists.txt | Registers new source and test files in the build. |
| meshroom/aliceVision/SfmExpanding.py | Exposes the new weighting options in the Meshroom node UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2c97b0e to
56fba76
Compare
56fba76 to
aadc2de
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/aliceVision/sfm/pipeline/expanding/TrackWeighting.cpp:14
- TrackWeighting.cpp throws std::out_of_range later in the file but does not include . This can fail to compile on toolchains that don't include it transitively.
#include <vector>
#include <stack>
#include <cmath>
#include <aliceVision/stl/mapUtils.hpp>
#include <aliceVision/system/Logger.hpp>
| } | ||
|
|
||
| if (_enableObservationsWeighting) | ||
| resetObservationWeights(sfmData); |
…, and/or on the number of observations of the landmark
aadc2de to
6feabd3
Compare
|



This pull request introduces advanced observation weighting strategies to the Structure-from-Motion (SfM) expanding pipeline, allowing for more robust and configurable handling of feature tracks and observation density. The main changes add options for density-based and track-based observation weighting, new parameters for fine-tuning these behaviors, and supporting implementations and tests.
Observation weighting enhancements
Added support for observation density weighting and track-based weighting in the SfM expanding pipeline, with new parameters to control fading size, track length thresholds, and maximum weights. This enables more nuanced control over how observations contribute to bundle adjustment and outlier rejection. (
meshroom/aliceVision/SfmExpanding.py,src/software/pipeline/main_sfmExpanding.cpp,src/aliceVision/sfm/pipeline/expanding/SfmBundle.cpp,src/aliceVision/sfm/pipeline/expanding/SfmBundle.hpp) [1] [2] [3] [4] [5]Implemented new functions for weighting observations along tracks and by track length, as well as resetting observation weights, with documentation and logic for fade-in/out and thresholding. (
src/aliceVision/sfm/pipeline/expanding/TrackWeighting.cpp,src/aliceVision/sfm/pipeline/expanding/TrackWeighting.hpp) [1] [2]Integration and testing
src/aliceVision/sfm/pipeline/expanding/SfmBundle.cpp,src/aliceVision/sfm/CMakeLists.txt) [1] [2] [3]Residual and error computation updates
src/aliceVision/sfm/sfmStatistics.cpp,src/aliceVision/sfm/sfmStatistics.hpp,src/aliceVision/sfm/utils/poseFilter.cpp) [1] [2] [3] [4]Minor code improvements
src/aliceVision/sfm/pipeline/expanding/DistanceWeighting.cpp) [1] [2]