Skip to content

Commit

Permalink
Move old VW bundle adjustment to the graveyard
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-alexandrov committed Nov 23, 2022
1 parent e0c629c commit 568f6e9
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 161 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/vw/BundleAdjustment/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Use wrapper function at this level to avoid code duplication
add_library_wrapper(VwBundleAdjustment "${VW_BUNDLEADJUSTMENT_SRC_FILES}" "${VW_BUNDLEADJUSTMENT_TEST_FILES}" "${VW_BUNDLEADJUSTMENT_LIB_DEPENDENCIES}")

Expand Down
159 changes: 0 additions & 159 deletions src/vw/BundleAdjustment/tests/TestBundleAdjustment.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#include <test/Helpers.h>

#include <vw/Camera/PinholeModel.h>
#include <vw/BundleAdjustment/AdjustRef.h>
#include <vw/BundleAdjustment/AdjustRobustRef.h>
#include <vw/BundleAdjustment/AdjustSparse.h>
#include <vw/BundleAdjustment/AdjustRobustSparse.h>

// This test is for non robust bundle adjustment.

Expand Down Expand Up @@ -213,159 +209,4 @@ class ComparisonTest : public ::testing::Test {
boost::shared_ptr<ControlNetwork> cnet;
};

// Null Tests
// -----------------------
TEST_F( NullTest, AdjustRef ) {
TestBAModel model( cameras, cnet );
AdjustRef< TestBAModel, L2Error > adjuster( model, L2Error(), false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( uint32 i = 0; i < 5; i++ )
adjuster.update(abs_tol,rel_tol);

// Checking solutions
Vector<double,6> zero_vector;
for ( uint32 i = 0; i < 5; i++ ) {
Vector<double> solution = model.cam_params(i);
EXPECT_VECTOR_NEAR( solution, zero_vector, 1e-1 );
}
}

TEST_F( NullTest, AdjustSparse ) {
TestBAModel model( cameras, cnet );
AdjustSparse< TestBAModel, L2Error > adjuster( model, L2Error(), false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( uint32 i = 0; i < 5; i++ )
adjuster.update(abs_tol,rel_tol);

// Checking solutions
Vector<double,6> zero_vector;
for ( uint32 i = 0; i < 5; i++ ) {
Vector<double> solution = model.cam_params(i);
EXPECT_VECTOR_NEAR( solution, zero_vector, 1e-1 );
}
}

TEST_F( NullTest, AdjustRobustRef ) {
TestBAModel model( cameras, cnet );
AdjustRobustRef< TestBAModel, L2Error > adjuster( model, L2Error(), false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( uint32 i = 0; i < 5; i++ )
adjuster.update(abs_tol,rel_tol);

// Checking solutions
Vector<double,6> zero_vector;
for ( uint32 i = 0; i < 5; i++ ) {
Vector<double> solution = model.cam_params(i);
EXPECT_VECTOR_NEAR( solution, zero_vector, 1e-1 );
}
}

TEST_F( NullTest, AdjustRobustSparse ) {
TestBAModel model( cameras, cnet );
AdjustRobustSparse< TestBAModel, L2Error > adjuster( model, L2Error(), false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( uint32 i = 0; i < 5; i++ )
adjuster.update(abs_tol,rel_tol);

// Checking solutions
Vector<double,6> zero_vector;
for ( uint32 i = 0; i < 5; i++ ) {
Vector<double> solution = model.cam_params(i);
EXPECT_VECTOR_NEAR( solution, zero_vector, 1e-1 );
}
}

// Comparison Tests
// -----------------------
TEST_F( ComparisonTest, Ref_VS_Sparse ) {
std::vector<Vector<double> > ref_solution;
std::vector<Vector<double> > spr_solution;

{ // Performing Ref BA
TestBAModel model( cameras, cnet );
AdjustRef< TestBAModel, L2Error > adjuster( model, L2Error(), false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( unsigned i = 0; i < 10; i++ )
adjuster.update(abs_tol,rel_tol);

// Storing result
for ( uint32 i = 0; i < 5; i++ )
ref_solution.push_back( model.cam_params(i) );
}

{ // Performing Sparse BA
TestBAModel model( cameras, cnet );
AdjustSparse< TestBAModel, L2Error > adjuster( model, L2Error(), false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( unsigned i = 0; i < 10; i++ )
adjuster.update(abs_tol,rel_tol);

// Storing result
for ( uint32 i = 0; i < 5; i++ )
spr_solution.push_back( model.cam_params(i) );
}

// Comparison
for ( uint32 i = 0; i < 5; i++ )
ASSERT_VECTOR_NEAR( ref_solution[i],
spr_solution[i],
1e-3 );
}

// For whatever reason .. RobustRef and RobustSparse diverge
// quickly. This is probably do to unwise application of floats or
// arithmetic ordering.
TEST_F( ComparisonTest, DISABLED_RobustRef_VS_RobustSparse ) {
std::vector<Vector<double> > ref_solution;
std::vector<Vector<double> > spr_solution;

{ // Performing Ref BA
TestBAModel model( cameras, cnet );
AdjustRobustRef< TestBAModel, L2Error > adjuster( model, L2Error(),
false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( unsigned i = 0; i < 2; i++ )
adjuster.update(abs_tol,rel_tol);

// Storing result
for ( uint32 i = 0; i < 5; i++ )
ref_solution.push_back( model.cam_params(i) );
}

{ // Performing Sparse BA
TestBAModel model( cameras, cnet );
AdjustRobustSparse< TestBAModel, L2Error > adjuster( model, L2Error(),
false, false);

// Running BA
double abs_tol = 1e10, rel_tol = 1e10;
for ( unsigned i = 0; i < 2; i++ )
adjuster.update(abs_tol,rel_tol);

// Storing result
for ( uint32 i = 0; i < 5; i++ )
spr_solution.push_back( model.cam_params(i) );
}

// Comparison
for ( uint32 i = 0; i < 5; i++ )
ASSERT_VECTOR_NEAR( ref_solution[i],
spr_solution[i],
1e-2 );
}

#endif

0 comments on commit 568f6e9

Please sign in to comment.