Skip to content

Commit 5fc948e

Browse files
Merge pull request #2016 from alicevision/dev/disableStructure
Add an option to disable structure refinement
2 parents d3f38a5 + 5f703bb commit 5fc948e

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

meshroom/aliceVision/SfmExpanding.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.2"
1+
__version__ = "2.3"
22

33
from meshroom.core import desc
44
from meshroom.core.utils import VERBOSE_LEVEL
@@ -174,6 +174,12 @@ class SfMExpanding(desc.AVCommandLineNode):
174174
"This may be helpful if the input cameras are already fully calibrated.",
175175
value=False,
176176
),
177+
desc.BoolParam(
178+
name="enableStructureRefinement",
179+
label="Enable Structure Refinement",
180+
description="Bundle adjustment will try to optimize the landmarks positions.",
181+
value=True,
182+
),
177183
desc.IntParam(
178184
name="minNbCamerasToRefinePrincipalPoint",
179185
label="Min Nb Cameras To Refine Principal Point",

src/aliceVision/sfm/pipeline/expanding/SfmBundle.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ bool SfmBundle::process(sfmData::SfMData & sfmData, const track::TracksHandler &
2222

2323
refineOptions |= BundleAdjustment::REFINE_ROTATION;
2424
refineOptions |= BundleAdjustment::REFINE_TRANSLATION;
25-
refineOptions |= BundleAdjustment::REFINE_STRUCTURE;
25+
26+
if (_isStructureRefinementEnabled)
27+
{
28+
refineOptions |= BundleAdjustment::REFINE_STRUCTURE;
29+
}
30+
2631
refineOptions |= BundleAdjustment::REFINE_INTRINSICS_ALL;
2732

2833
options.setSparseBA();

src/aliceVision/sfm/pipeline/expanding/SfmBundle.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ class SfmBundle
7272
_minNbCamerasToRefinePrincipalPoint = count;
7373
}
7474

75+
/**
76+
* @brief Set whether to enable structure refinement in bundle adjustment
77+
* @param flag true to enable structure refinement, false to disable it
78+
*/
79+
void setIsStructureRefinementEnabled(bool flag)
80+
{
81+
_isStructureRefinementEnabled = flag;
82+
}
83+
7584
private:
7685
/**
7786
* Initialize bundle properties
@@ -105,6 +114,7 @@ class SfmBundle
105114
size_t _minNbCamerasLBA = 100;
106115
size_t _LBAGraphDistanceLimit = 1;
107116
size_t _LBAMinNbOfMatches = 50;
117+
bool _isStructureRefinementEnabled = true;
108118
};
109119

110120
} // namespace sfm

src/software/pipeline/main_sfmExpanding.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// These constants define the current software version.
2929
// They must be updated when the command line is changed.
3030
#define ALICEVISION_SOFTWARE_VERSION_MAJOR 2
31-
#define ALICEVISION_SOFTWARE_VERSION_MINOR 2
31+
#define ALICEVISION_SOFTWARE_VERSION_MINOR 3
3232

3333
using namespace aliceVision;
3434

@@ -100,6 +100,7 @@ int aliceVision_main(int argc, char** argv)
100100
double maxReprojectionError = 4.0;
101101
double maxTriangulationError = 8.0;
102102
bool lockAllIntrinsics = false;
103+
bool enableStructureRefinement = true;
103104
int minNbCamerasToRefinePrincipalPoint = 3;
104105
bool useRigConstraint = true;
105106
int minNbCamerasForRigCalibration = 20;
@@ -146,9 +147,10 @@ int aliceVision_main(int argc, char** argv)
146147
("maxTriangulationError", po::value<double>(&maxTriangulationError)->default_value(maxTriangulationError), "Maximum reprojection error in the triangulation process.")
147148
("maxReprojectionError", po::value<double>(&maxReprojectionError)->default_value(maxReprojectionError), "Maximum reprojection error in the bundle verification step.")
148149
("lockAllIntrinsics", po::value<bool>(&lockAllIntrinsics)->default_value(lockAllIntrinsics), "Force lock of all camera intrinsic parameters, so they will not be refined during Bundle Adjustment.")
150+
("enableStructureRefinement", po::value<bool>(&enableStructureRefinement)->default_value(enableStructureRefinement), "Bundle adjustment will try to optimize the landmarks positions.")
149151
("minNbCamerasToRefinePrincipalPoint", po::value<int>(&minNbCamerasToRefinePrincipalPoint)->default_value(minNbCamerasToRefinePrincipalPoint),
150152
"Minimal number of cameras to refine the principal point of the cameras (one of the intrinsic parameters of the camera). "
151-
"If we do not have enough cameras, the principal point in consider is considered in the center of the image. "
153+
"If we do not have enough cameras, the principal point is considered in the center of the image. "
152154
"If minNbCamerasToRefinePrincipalPoint<=0, the principal point is never refined. "
153155
"If minNbCamerasToRefinePrincipalPoint==1, the principal point is always refined.")
154156
("useRigConstraint", po::value<bool>(&useRigConstraint)->default_value(useRigConstraint), "Enable/Disable rig constraint.")
@@ -233,6 +235,7 @@ int aliceVision_main(int argc, char** argv)
233235
sfmBundle->setMinAngleLandmark(minAngleForLandmark);
234236
sfmBundle->setMaxReprojectionError(maxReprojectionError);
235237
sfmBundle->setMinNbCamerasToRefinePrincipalPoint(minNbCamerasToRefinePrincipalPoint);
238+
sfmBundle->setIsStructureRefinementEnabled(enableStructureRefinement);
236239

237240
sfm::PointFetcher::uptr pointFetcherHandler;
238241
if (!meshFilename.empty())

0 commit comments

Comments
 (0)