Skip to content

Commit 227de34

Browse files
committed
d
1 parent a34b979 commit 227de34

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

glomap/controllers/rotation_averager_test.cc

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ void ExpectEqualGravity(
124124
}
125125

126126
TEST(RotationEstimator, WithoutNoise) {
127+
colmap::SetPRNGSeed(1);
128+
127129
const std::string database_path = colmap::CreateTestDir() + "/database.db";
128130

129131
auto database = colmap::Database::Open(database_path);
@@ -153,8 +155,8 @@ TEST(RotationEstimator, WithoutNoise) {
153155
global_mapper.Solve(
154156
*database, view_graph, rigs, cameras, frames, images, tracks);
155157

156-
// TODO: The current 1-dof rotation averaging sometimes fail to pick the right
157-
// solution (e.g., 180 deg flipped).
158+
// TODO: The current 1-dof rotation averaging sometimes fails to pick the
159+
// right solution (e.g., 180 deg flipped).
158160
for (const bool use_gravity : {false}) {
159161
SolveRotationAveraging(
160162
view_graph, rigs, frames, images, CreateRATestOptions(use_gravity));
@@ -168,6 +170,8 @@ TEST(RotationEstimator, WithoutNoise) {
168170
}
169171

170172
TEST(RotationEstimator, WithoutNoiseWithNoneTrivialKnownRig) {
173+
colmap::SetPRNGSeed(1);
174+
171175
const std::string database_path = colmap::CreateTestDir() + "/database.db";
172176

173177
auto database = colmap::Database::Open(database_path);
@@ -210,6 +214,8 @@ TEST(RotationEstimator, WithoutNoiseWithNoneTrivialKnownRig) {
210214
}
211215

212216
TEST(RotationEstimator, WithoutNoiseWithNoneTrivialUnknownRig) {
217+
colmap::SetPRNGSeed(1);
218+
213219
const std::string database_path = colmap::CreateTestDir() + "/database.db";
214220

215221
auto database = colmap::Database::Open(database_path);
@@ -246,8 +252,8 @@ TEST(RotationEstimator, WithoutNoiseWithNoneTrivialUnknownRig) {
246252
global_mapper.Solve(
247253
*database, view_graph, rigs, cameras, frames, images, tracks);
248254

249-
// For unknown rigs, it is not supported to use gravity
250-
for (bool use_gravity : {false}) {
255+
// For unknown rigs, it is not supported to use gravity.
256+
for (const bool use_gravity : {false}) {
251257
SolveRotationAveraging(
252258
view_graph, rigs, frames, images, CreateRATestOptions(use_gravity));
253259

@@ -260,6 +266,8 @@ TEST(RotationEstimator, WithoutNoiseWithNoneTrivialUnknownRig) {
260266
}
261267

262268
TEST(RotationEstimator, WithNoiseAndOutliers) {
269+
colmap::SetPRNGSeed(1);
270+
263271
const std::string database_path = colmap::CreateTestDir() + "/database.db";
264272

265273
auto database = colmap::Database::Open(database_path);
@@ -289,7 +297,7 @@ TEST(RotationEstimator, WithNoiseAndOutliers) {
289297
global_mapper.Solve(
290298
*database, view_graph, rigs, cameras, frames, images, tracks);
291299

292-
for (bool use_gravity : {true, false}) {
300+
for (const bool use_gravity : {true, false}) {
293301
SolveRotationAveraging(
294302
view_graph, rigs, frames, images, CreateRATestOptions(use_gravity));
295303

@@ -306,6 +314,8 @@ TEST(RotationEstimator, WithNoiseAndOutliers) {
306314
}
307315

308316
TEST(RotationEstimator, WithNoiseAndOutliersWithNonTrivialKnownRigs) {
317+
colmap::SetPRNGSeed(1);
318+
309319
const std::string database_path = colmap::CreateTestDir() + "/database.db";
310320

311321
auto database = colmap::Database::Open(database_path);
@@ -334,7 +344,9 @@ TEST(RotationEstimator, WithNoiseAndOutliersWithNonTrivialKnownRigs) {
334344
global_mapper.Solve(
335345
*database, view_graph, rigs, cameras, frames, images, tracks);
336346

337-
for (bool use_gravity : {true, false}) {
347+
// TODO: The current 1-dof rotation averaging sometimes fails to pick the
348+
// right solution (e.g., 180 deg flipped).
349+
for (const bool use_gravity : {true, false}) {
338350
SolveRotationAveraging(
339351
view_graph, rigs, frames, images, CreateRATestOptions(use_gravity));
340352

@@ -351,6 +363,8 @@ TEST(RotationEstimator, WithNoiseAndOutliersWithNonTrivialKnownRigs) {
351363
}
352364

353365
TEST(RotationEstimator, RefineGravity) {
366+
colmap::SetPRNGSeed(1);
367+
354368
const std::string database_path = colmap::CreateTestDir() + "/database.db";
355369

356370
auto database = colmap::Database::Open(database_path);
@@ -393,6 +407,8 @@ TEST(RotationEstimator, RefineGravity) {
393407
}
394408

395409
TEST(RotationEstimator, RefineGravityWithNontrivialRigs) {
410+
colmap::SetPRNGSeed(1);
411+
396412
const std::string database_path = colmap::CreateTestDir() + "/database.db";
397413

398414
auto database = colmap::Database::Open(database_path);

0 commit comments

Comments
 (0)