MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
ransac_pose_p3p.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015, Simon Fuhrmann
3 * TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4 * All rights reserved.
5 *
6 * This software may be modified and distributed under the terms
7 * of the BSD 3-Clause license. See the LICENSE.txt file for details.
8 */
9
10#ifndef SFM_RANSAC_POSE_P3P_HEADER
11#define SFM_RANSAC_POSE_P3P_HEADER
12
13#include <vector>
14
15#include "math/matrix.h"
16#include "math/vector.h"
17#include "sfm/correspondence.h"
18#include "sfm/defines.h"
19
21
38{
39public:
40 struct Options
41 {
42 Options (void);
43
50
55 double threshold;
56
61 };
62
63 struct Result
64 {
67
69 std::vector<int> inliers;
70 };
71
72public:
73 explicit RansacPoseP3P (Options const& options);
74
75 void estimate (Correspondences2D3D const& corresp,
76 math::Matrix<double, 3, 3> const& k_matrix,
77 Result* result) const;
78
79private:
81 typedef std::vector<Pose> PutativePoses;
82
83private:
84 void compute_p3p (Correspondences2D3D const& corresp,
85 math::Matrix<double, 3, 3> const& inv_k_matrix,
86 PutativePoses* poses) const;
87
88 void find_inliers (Correspondences2D3D const& corresp,
89 math::Matrix<double, 3, 3> const& k_matrix,
90 Pose const& pose, std::vector<int>* inliers) const;
91
92private:
93 Options opts;
94};
95
96/* ------------------------ Implementation ------------------------ */
97
98inline
99RansacPoseP3P::Options::Options (void)
100 : max_iterations(1000)
101 , threshold(0.005)
102 , verbose_output(false)
103{
104}
105
107
108#endif /* SFM_RANSAC_POSE_P3P_HEADER */
Matrix class for arbitrary dimensions and types.
Definition matrix.h:54
RANSAC pose estimation from 2D-3D correspondences and known camera calibration using the perspective ...
std::vector< Correspondence2D3D > Correspondences2D3D
#define SFM_NAMESPACE_END
Definition defines.h:14
#define SFM_NAMESPACE_BEGIN
Definition defines.h:13
bool verbose_output
Produce status messages on the console.
double threshold
Threshold used to determine inliers.
int max_iterations
The number of RANSAC iterations.
math::Matrix< double, 3, 4 > pose
The pose [R|t] which led to the inliers.
std::vector< int > inliers
The correspondence indices which led to the result.