Berkeley SfM
essential_matrix_solver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, The Regents of the University of California (Regents).
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer in the documentation and/or other materials provided
15  * with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Please contact the author(s) of this library if you have any questions.
34  * Authors: David Fridovich-Keil ( dfk@eecs.berkeley.edu )
35  * Erik Nelson ( eanelson@eecs.berkeley.edu )
36  */
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 //
40 // This header defines a set of functions for converting a fundamental matrix
41 // and a pair of camera intrinsics into an essential matrix, and from an
42 // essential matrix to and a set of camera extrinsics.
43 //
44 ///////////////////////////////////////////////////////////////////////////////
45 
46 #ifndef BSFM_GEOMETRY_ESSENTIAL_MATRIX_SOLVER_H
47 #define BSFM_GEOMETRY_ESSENTIAL_MATRIX_SOLVER_H
48 
49 #include <Eigen/Core>
50 
51 #include "../camera/camera_intrinsics.h"
52 #include "../camera/camera_extrinsics.h"
53 #include "../pose/pose.h"
54 #include "../matching/feature_match.h"
55 #include "../util/disallow_copy_and_assign.h"
56 
57 namespace bsfm {
58 
59 using Eigen::Matrix3d;
60 using Eigen::Vector3d;
61 
63 
64 public:
65  // Empty constructor and destructor. No member variables.
68 
69  // Compute the essential matrix from a fundamental matrix and camera intrinsics.
70  Matrix3d ComputeEssentialMatrix(const Matrix3d& F,
71  const CameraIntrinsics& intrinsics1,
72  const CameraIntrinsics& intrinsics2);
73 
74  // Compute relative transformation between two cameras from an essential
75  // matrix and a list of keypoint matches. Note that the translation of the
76  // output relative transformation can only be computed up to a scale factor.
77  bool ComputeExtrinsics(const Matrix3d& E,
78  const FeatureMatchList& matches,
79  const CameraIntrinsics& intrinsics1,
80  const CameraIntrinsics& intrinsics2,
81  Pose& relative_pose);
82 
83 private:
85 
86 }; //\class EssentialMatrixSolver
87 
88 } //\namespace bsfm
89 
90 #endif
bool ComputeExtrinsics(const Matrix3d &E, const FeatureMatchList &matches, const CameraIntrinsics &intrinsics1, const CameraIntrinsics &intrinsics2, Pose &relative_pose)
Matrix3d ComputeEssentialMatrix(const Matrix3d &F, const CameraIntrinsics &intrinsics1, const CameraIntrinsics &intrinsics2)
Definition: camera.cpp:50
std::vector< FeatureMatch > FeatureMatchList
Definition: feature_match.h:99
#define DISALLOW_COPY_AND_ASSIGN(TypeName)