MCPcopy Create free account
hub / github.com/PeterFWS/Structure-PLP-SLAM / TEST

Function TEST

test/PLPSLAM/solve/essential_solver.cc:12–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace PLPSLAM;
11
12TEST(essential_solver, linear_solve)
13{
14 // create 3D points
15 const unsigned int num_landmarks = 100;
16 const auto landmarks = create_random_landmarks_in_space(num_landmarks, 100);
17
18 // create two-view poses
19 const Mat33_t rot_1 = util::converter::to_rot_mat(205.0 * M_PI / 180.0 * Vec3_t{4, -6, 2}.normalized());
20 const Vec3_t trans_1 = Vec3_t(-28.1, -63.3, 43.4);
21 const Mat33_t rot_2 = util::converter::to_rot_mat(-15.0 * M_PI / 180.0 * Vec3_t{5, 1, -3}.normalized());
22 const Vec3_t trans_2 = Vec3_t(-30.4, -45.5, -49.6);
23
24 // create bearing vectors from two-view poses and 3D points
25 eigen_alloc_vector<Vec3_t> bearings_1;
26 eigen_alloc_vector<Vec3_t> bearings_2;
27 create_bearing_vectors(rot_1, trans_1, landmarks, bearings_1);
28 create_bearing_vectors(rot_2, trans_2, landmarks, bearings_2);
29
30 // create a true essential matrix
31 Mat33_t true_E_21 = solve::essential_solver::create_E_21(rot_1, trans_1, rot_2, trans_2);
32
33 // solve with SVD
34 Mat33_t E_21 = solve::essential_solver::compute_E_21(bearings_1, bearings_2);
35
36 // align scale and sign
37 true_E_21 /= true_E_21.norm();
38 E_21 /= E_21.norm();
39 if (true_E_21(0, 0) * E_21(0, 0) < 0)
40 {
41 true_E_21 *= -1.0;
42 }
43
44 EXPECT_LT((true_E_21 - E_21).norm(), 1e-4);
45}
46
47TEST(essential_solver, ransac_solve_without_noise)
48{

Callers

nothing calls this directly

Calls 10

create_bearing_vectorsFunction · 0.85
normalizedMethod · 0.80
get_best_E_21Method · 0.80
find_via_ransacMethod · 0.45
solution_is_validMethod · 0.45
get_inlier_matchesMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected