39 #ifndef INCLUDE_OKVIS_OPENGV_FRAMEROTATIONONLYSACPROBLEM_HPP_
40 #define INCLUDE_OKVIS_OPENGV_FRAMEROTATIONONLYSACPROBLEM_HPP_
43 #include <opengv/types.hpp>
44 #include <opengv/relative_pose/methods.hpp>
45 #include <opengv/sac_problems/relative_pose/RotationOnlySacProblem.hpp>
55 namespace sac_problems {
59 namespace relative_pose {
71 typedef RotationOnlySacProblem
base_t;
74 using base_t::adapter_t;
76 using base_t::model_t;
86 *static_cast<opengv::relative_pose::FrameRelativeAdapter*>(&_adapter)) {
89 dynamic_cast<opengv::relative_pose::FrameRelativeAdapter*>(&_adapter),
90 "only opengv::absolute_pose::FrameRelativeAdapter supported");
101 const std::vector<int> & indices)
102 :
base_t(adapter, indices),
104 *static_cast<opengv::relative_pose::FrameRelativeAdapter*>(&_adapter)) {
107 dynamic_cast<opengv::relative_pose::FrameRelativeAdapter*>(&_adapter),
108 "only opengv::absolute_pose::FrameRelativeAdapter supported");
123 const std::vector<int> & indices,
124 std::vector<double> & scores)
const {
125 for (
size_t i = 0; i < indices.size(); i++) {
130 bearingVector_t f2_unrotated = model * f2;
133 bearingVector_t f1_unrotated = model.transpose() * f1;
135 point_t error1 = (f2_unrotated - f1);
136 point_t error2 = (f1_unrotated - f2);
137 double error_squared1 = error1.transpose() * error1;
138 double error_squared2 = error2.transpose() * error2;
141 + error_squared2 * 0.5
virtual opengv::bearingVector_t getBearingVector2(size_t index) const
Retrieve the bearing vector of a correspondence in viewpoint 2.
Definition: FrameRelativeAdapter.cpp:254
virtual void getSelectedDistancesToModel(const model_t &model, const std::vector< int > &indices, std::vector< double > &scores) const
Compute the distances of all samples whith respect to given model coefficients.
Definition: FrameRotationOnlySacProblem.hpp:122
Functions for fitting a rotation-only model to a set of bearing-vector correspondences (using twopt_r...
Definition: FrameRotationOnlySacProblem.hpp:67
Header file for the FrameRelativeAdapter class.
Adapter for relative pose RANSAC (2D2D)
Definition: FrameRelativeAdapter.hpp:60
opengv::relative_pose::FrameRelativeAdapter & adapterDerived_
The adapter holding the bearing, correspondences etc.
Definition: FrameRotationOnlySacProblem.hpp:148
#define OKVIS_DEFINE_EXCEPTION(exceptionName, exceptionParent)
Macro for defining an exception with a given parent.
Definition: assert_macros.hpp:52
This file contains some useful assert macros.
FrameRotationOnlySacProblem(adapter_t &adapter, const std::vector< int > &indices)
Constructor.
Definition: FrameRotationOnlySacProblem.hpp:100
virtual ~FrameRotationOnlySacProblem()
Definition: FrameRotationOnlySacProblem.hpp:111
double getSigmaAngle2(size_t index)
Obtain the angular standard deviation of the correspondence in frame 2 in [rad].
Definition: FrameRelativeAdapter.cpp:303
RotationOnlySacProblem base_t
Definition: FrameRotationOnlySacProblem.hpp:71
virtual opengv::bearingVector_t getBearingVector1(size_t index) const
Retrieve the bearing vector of a correspondence in viewpoint 1.
Definition: FrameRelativeAdapter.cpp:248
double getSigmaAngle1(size_t index)
Obtain the angular standard deviation of the correspondence in frame 1 in [rad].
Definition: FrameRelativeAdapter.cpp:297
#define OKVIS_ASSERT_TRUE(exceptionType, condition, message)
Definition: assert_macros.hpp:111