45#ifndef SFM_FUNDAMENTAL_HEADER
46#define SFM_FUNDAMENTAL_HEADER
121 std::vector<CameraPose>* result);
146template <
typename T,
int DIM>
163pose_7_point (Seven2DPoints
const& points_view_1,
164 Seven2DPoints
const& points_view_2,
165 std::vector<FundamentalMatrix>* result);
177pose_5_point (Five2DPoints
const& points_view_1,
178 Five2DPoints
const& points_view_2,
179 std::vector<EssentialMatrix>* result);
184template <
typename T,
int DIM>
192 for (
int i = 0; i < DIM; ++i)
194 for (
int j = 0; j < 3; ++j)
196 mean[j] += points(j, i);
197 aabb_min[j] = std::min(aabb_min[j], points(j, i));
198 aabb_max[j] = std::max(aabb_max[j], points(j, i));
201 mean /=
static_cast<T
>(DIM);
202 T norm = (aabb_max - aabb_min).maximum();
204 t[0] = T(1) / norm; t[1] = T(0); t[2] = -mean[0] / norm;
205 t[3] = T(0); t[4] = T(1) / norm; t[5] = -mean[1] / norm;
206 t[6] = T(0); t[7] = T(0); t[8] = T(1);
Matrix class for arbitrary dimensions and types.
Vector class for arbitrary dimensions and types.
void enforce_fundamental_constraints(FundamentalMatrix *matrix)
Constraints the given matrix to have TWO NON-ZERO eigenvalues.
bool fundamental_least_squares(Correspondences2D2D const &points, FundamentalMatrix *result)
Algorithm to compute the fundamental or essential matrix from image correspondences.
void compute_normalization(math::Matrix< T, 3, DIM > const &points, math::Matrix< T, 3, 3 > *transformation)
Computes a transformation for 2D points in homogeneous coordinates such that the mean of the points i...
void enforce_essential_constraints(EssentialMatrix *matrix)
Constraints the given matrix to have TWO EQUAL NON-ZERO eigenvalues.
std::vector< Correspondence2D2D > Correspondences2D2D
void fundamental_from_pose(CameraPose const &cam1, CameraPose const &cam2, FundamentalMatrix *result)
Computes the fundamental matrix corresponding to cam1 and cam2.
void pose_from_essential(EssentialMatrix const &matrix, std::vector< CameraPose > *result)
Retrieves the camera matrices from the essential matrix.
bool fundamental_8_point(Eight2DPoints const &points_view_1, Eight2DPoints const &points_view_2, FundamentalMatrix *result)
Algorithm to compute the fundamental or essential matrix from 8 image correspondences.
double sampson_distance(FundamentalMatrix const &F, Correspondence2D2D const &m)
Computes the Sampson distance for an image correspondence given the fundamental matrix between two vi...
#define SFM_NAMESPACE_END
#define SFM_NAMESPACE_BEGIN
The camera pose is the 3x4 matrix P = K [R | t].
Two image coordinates which correspond to each other in terms of observing the same point in the scen...