MVE - Multi-View Environment mve-devel
|
Structure-from-Motion library. More...
Namespaces | |
namespace | ba |
namespace | bundler |
SfM bundler components. | |
namespace | pba |
Parallel Bundle Adjustment components. | |
Classes | |
class | CameraDatabase |
Camera database which, given a maker and model string, will look for a camera model in the database and return the model on successful lookup. More... | |
struct | CameraModel |
Representation of a digital camera. More... | |
struct | CameraPose |
The camera pose is the 3x4 matrix P = K [R | t]. More... | |
class | CascadeHashing |
struct | Correspondence2D2D |
Two image coordinates which correspond to each other in terms of observing the same point in the scene. More... | |
struct | Correspondence2D3D |
A 3D point and an image coordinate which correspond to each other in terms of the image observing this 3D point in the scene. More... | |
class | ExhaustiveMatching |
class | FeatureSet |
The FeatureSet holds per-feature information for a single view, and allows to transparently compute and match multiple feature types. More... | |
class | Matching |
class | MatchingBase |
class | NearestNeighbor |
Nearest (and second nearest) neighbor search for normalized vectors. More... | |
class | RansacFundamental |
RANSAC pose estimation from noisy 2D-2D image correspondences. More... | |
class | RansacHomography |
RANSAC homography estimation from noisy 2D-2D image correspondences. More... | |
class | RansacPoseP3P |
RANSAC pose estimation from 2D-3D correspondences and known camera calibration using the perspective 3-point (P3P) algorithm. More... | |
class | Sift |
Implementation of the SIFT feature detector and descriptor. More... | |
class | Surf |
Implementation of the SURF feature detector and descriptor as described in: More... | |
class | Triangulate |
Triangulation routine that triangulates a track from camera poses and 2D image positions while keeping triangulation statistics. More... | |
class | Visualizer |
Typedefs | |
typedef std::pair< int, int > | CorrespondenceIndex |
The IDs of a matching feature pair in two images. | |
typedef std::vector< CorrespondenceIndex > | CorrespondenceIndices |
A list of all matching feature pairs in two images. | |
typedef std::vector< Correspondence2D2D > | Correspondences2D2D |
typedef std::vector< Correspondence2D3D > | Correspondences2D3D |
typedef math::Matrix< double, 3, 8 > | Eight2DPoints |
typedef math::Matrix< double, 3, 3 > | EssentialMatrix |
typedef std::pair< float, FocalLengthMethod > | FocalLengthEstimate |
Datatype for the focal length estimate which reports the normalized focal length as well as the method used to obtain the value. | |
typedef math::Matrix< double, 3, 3 > | FundamentalMatrix |
typedef math::Matrix3d | HomographyMatrix |
Enumerations | |
enum | FocalLengthMethod { FOCAL_LENGTH_AND_DATABASE , FOCAL_LENGTH_35MM_EQUIV , FOCAL_LENGTH_FALLBACK_VALUE } |
Indicator which focal length estimation has been used. More... | |
Functions | |
template<typename T , int DIM> | |
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 is zero and the points fit in the unit square. | |
int | compute_ransac_iterations (double inlier_ratio, int num_samples, double desired_success_rate=0.99) |
The function returns the required number of iterations for a desired RANSAC success rate. | |
void | enforce_essential_constraints (EssentialMatrix *matrix) |
Constraints the given matrix to have TWO EQUAL NON-ZERO eigenvalues. | |
void | enforce_fundamental_constraints (FundamentalMatrix *matrix) |
Constraints the given matrix to have TWO NON-ZERO eigenvalues. | |
std::pair< float, FocalLengthMethod > | extract_focal_length (mve::image::ExifInfo const &exif) |
Extracts the focal length from the EXIF tags of an image. | |
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. | |
void | fundamental_from_pose (CameraPose const &cam1, CameraPose const &cam2, FundamentalMatrix *result) |
Computes the fundamental matrix corresponding to cam1 and cam2. | |
bool | fundamental_least_squares (Correspondences2D2D const &points, FundamentalMatrix *result) |
Algorithm to compute the fundamental or essential matrix from image correspondences. | |
bool | homography_dlt (Correspondences2D2D const &matches, HomographyMatrix *result) |
Direct linear transformation algorithm to compute the homography matrix from image correspondences. | |
bool | is_consistent_pose (Correspondence2D2D const &match, CameraPose const &pose1, CameraPose const &pose2) |
Given a two-view pose configuration and a correspondence, this function returns true if the triangulated point is in front of both cameras. | |
void | pose_from_essential (EssentialMatrix const &matrix, std::vector< CameraPose > *result) |
Retrieves the camera matrices from the essential matrix. | |
void | pose_p3p_kneip (math::Vec3d p1, math::Vec3d p2, math::Vec3d p3, math::Vec3d f1, math::Vec3d f2, math::Vec3d f3, std::vector< math::Matrix< double, 3, 4 > > *solutions) |
Implementation of the perspective three point (P3P) algorithm. | |
double | sampson_distance (FundamentalMatrix const &fundamental, Correspondence2D2D const &match) |
Computes the Sampson distance for an image correspondence given the fundamental matrix between two views. | |
double | symmetric_transfer_error (HomographyMatrix const &homography, Correspondence2D2D const &match) |
Computes the symmetric transfer error for an image correspondence given the homography matrix between two views. | |
math::Vector< double, 3 > | triangulate_match (Correspondence2D2D const &match, CameraPose const &pose1, CameraPose const &pose2) |
Given an image correspondence in two views and the corresponding poses, this function triangulates the 3D point coordinate using the DLT algorithm. | |
math::Vector< double, 3 > | triangulate_track (std::vector< math::Vec2f > const &pos, std::vector< CameraPose const * > const &poses) |
Given any number of 2D image positions and the corresponding camera poses, this function triangulates the 3D point coordinate using the DLT algorithm. | |
Structure-from-Motion library.
typedef std::pair<int, int> sfm::CorrespondenceIndex |
The IDs of a matching feature pair in two images.
Definition at line 27 of file correspondence.h.
typedef std::vector<CorrespondenceIndex> sfm::CorrespondenceIndices |
A list of all matching feature pairs in two images.
Definition at line 29 of file correspondence.h.
typedef std::vector<Correspondence2D2D> sfm::Correspondences2D2D |
Definition at line 21 of file correspondence.h.
typedef std::vector<Correspondence2D3D> sfm::Correspondences2D3D |
Definition at line 24 of file correspondence.h.
typedef math::Matrix<double, 3, 8> sfm::Eight2DPoints |
Definition at line 59 of file fundamental.h.
typedef math::Matrix<double, 3, 3> sfm::EssentialMatrix |
Definition at line 61 of file fundamental.h.
typedef std::pair<float, FocalLengthMethod> sfm::FocalLengthEstimate |
Datatype for the focal length estimate which reports the normalized focal length as well as the method used to obtain the value.
Definition at line 34 of file extract_focal_length.h.
typedef math::Matrix<double, 3, 3> sfm::FundamentalMatrix |
Definition at line 60 of file fundamental.h.
typedef math::Matrix3d sfm::HomographyMatrix |
Definition at line 19 of file homography.h.
Indicator which focal length estimation has been used.
Enumerator | |
---|---|
FOCAL_LENGTH_AND_DATABASE | |
FOCAL_LENGTH_35MM_EQUIV | |
FOCAL_LENGTH_FALLBACK_VALUE |
Definition at line 23 of file extract_focal_length.h.
void sfm::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 is zero and the points fit in the unit square.
(The thrid coordinate will still be 1 after normalization.) Optimized version where number of points must be known at compile time.
Definition at line 186 of file fundamental.h.
int sfm::compute_ransac_iterations | ( | double | inlier_ratio, |
int | num_samples, | ||
double | desired_success_rate = 0.99 |
||
) |
The function returns the required number of iterations for a desired RANSAC success rate.
If w is the probability of choosing one good sample (the inlier ratio), then w^n is the probability that all n samples are inliers. Then k is the number of iterations required to draw only inliers with a certain probability of success, p:
log(1 - p) k = ------------ log(1 - w^n)
Example: For w = 50%, p = 99%, n = 8: k = log(0.001) / log(0.99609) = 1176. Thus, it requires 1176 iterations for RANSAC to succeed with a 99% chance.
void sfm::enforce_essential_constraints | ( | EssentialMatrix * | matrix | ) |
Constraints the given matrix to have TWO EQUAL NON-ZERO eigenvalues.
This is done using SVD: F' = USV*, F = UDV* with D = diag(a, a, 0).
Definition at line 129 of file fundamental.cc.
void sfm::enforce_fundamental_constraints | ( | FundamentalMatrix * | matrix | ) |
Constraints the given matrix to have TWO NON-ZERO eigenvalues.
This is done using SVD: F' = USV*, F = UDV* with D = diag(a, b, 0).
Definition at line 113 of file fundamental.cc.
FocalLengthEstimate sfm::extract_focal_length | ( | mve::image::ExifInfo const & | exif | ) |
Extracts the focal length from the EXIF tags of an image.
The algorithm first checks for the availability of the "focal length" in EXIF tags and computes the effective focal length using a database of camera sensor sizes. If the camera model is unknown to the database, the "focal length 35mm equivalent" EXIF tag is used. If this information is also not available, a default value is used.
This estimation can fail in numerous situations:
The resulting focal length is in normalized format, that is the quotient of the image focal length by the sensor size. E.g. a photo taken at 70mm with a 35mm sensor size will result in a normalized focal length of 2.
Definition at line 19 of file extract_focal_length.cc.
bool sfm::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.
It closely follows [Sect. 11.2, Hartley, Zisserman, 2004]. In case of "normalized image coordinates" (i.e. x* = K^-1 x), this code computes the essential matrix.
This does not normalize the image coordinates for stability or enforces constraints on the resulting matrix.
Note: For eight points this code computes the same result as the least squares version but with fixed matrix sizes for compile time optimizations.
Definition at line 78 of file fundamental.cc.
void sfm::fundamental_from_pose | ( | CameraPose const & | cam1, |
CameraPose const & | cam2, | ||
FundamentalMatrix * | result | ||
) |
Computes the fundamental matrix corresponding to cam1 and cam2.
The function relies on the epipole to be visible in the second camera, thus the cameras must not be in the same location.
Definition at line 194 of file fundamental.cc.
bool sfm::fundamental_least_squares | ( | Correspondences2D2D const & | points, |
FundamentalMatrix * | result | ||
) |
Algorithm to compute the fundamental or essential matrix from image correspondences.
This algorithm computes the least squares solution for the fundamental matrix from at least 8 correspondences. The solution is sensitive to outliers.
This does not normalize the image coordinates for stability or enforces constraints on the resulting matrix.
Definition at line 44 of file fundamental.cc.
bool sfm::homography_dlt | ( | Correspondences2D2D const & | matches, |
HomographyMatrix * | result | ||
) |
Direct linear transformation algorithm to compute the homography matrix from image correspondences.
This algorithm computes the least squares solution for the homography matrix from at least 4 correspondences.
Definition at line 21 of file homography.cc.
bool sfm::is_consistent_pose | ( | Correspondence2D2D const & | match, |
CameraPose const & | pose1, | ||
CameraPose const & | pose2 | ||
) |
Given a two-view pose configuration and a correspondence, this function returns true if the triangulated point is in front of both cameras.
Definition at line 76 of file triangulate.cc.
void sfm::pose_from_essential | ( | EssentialMatrix const & | matrix, |
std::vector< CameraPose > * | result | ||
) |
Retrieves the camera matrices from the essential matrix.
This routine recovers P' = [R|t] for the second camera where the first camera is given in canonical form P = [I|0]. The pose can be computed up to scale and a four-fold ambiguity. That is, the resulting translation has length one and four possible solutions are provided. In case of two cameras in the same location, the rotation is still reliable but the translation is unstable.
Each of the solutions must be tested: It is sufficient to test if a single point (triangulated from a 2D-2D correspondence) is in front of both cameras. Note: The resulting camera pose does not contain the K matrix. Before testing the resulting poses, the K-matrix must be set!
Definition at line 148 of file fundamental.cc.
void sfm::pose_p3p_kneip | ( | math::Vec3d | p1, |
math::Vec3d | p2, | ||
math::Vec3d | p3, | ||
math::Vec3d | f1, | ||
math::Vec3d | f2, | ||
math::Vec3d | f3, | ||
std::vector< math::Matrix< double, 3, 4 > > * | solutions | ||
) |
Implementation of the perspective three point (P3P) algorithm.
The algorithm computes the pose of a camera given three 2D-3D correspondences. The implementation closely follows the implementation of Kneip et al. and is described in:
"A Novel Parametrization of the Perspective-Three-Point Problem for a Direct Computation of Absolute Camera Position and Orientation", by Laurent Kneip, Davide Scaramuzza and Roland Siegwart, CVPR 2011. http://www.laurentkneip.de/research.html
The algorithm assumes a given camera calibration and takes as input three 3D points 'p' and three 2D points. Instead of 2D points, the three directions 'f' to the given points computed in the camera frame. Four solutions [R | t] are returned. If the points are co-linear, no solution is returned. The correct solution can be found by back-projecting a forth point in the camera.
Definition at line 74 of file pose_p3p.cc.
double sfm::sampson_distance | ( | FundamentalMatrix const & | F, |
Correspondence2D2D const & | m | ||
) |
Computes the Sampson distance for an image correspondence given the fundamental matrix between two views.
Definition at line 225 of file fundamental.cc.
double sfm::symmetric_transfer_error | ( | HomographyMatrix const & | homography, |
Correspondence2D2D const & | match | ||
) |
Computes the symmetric transfer error for an image correspondence given the homography matrix between two views.
Definition at line 66 of file homography.cc.
math::Vector< double, 3 > sfm::triangulate_match | ( | Correspondence2D2D const & | match, |
CameraPose const & | pose1, | ||
CameraPose const & | pose2 | ||
) |
Given an image correspondence in two views and the corresponding poses, this function triangulates the 3D point coordinate using the DLT algorithm.
Definition at line 20 of file triangulate.cc.
math::Vector< double, 3 > sfm::triangulate_track | ( | std::vector< math::Vec2f > const & | pos, |
std::vector< CameraPose const * > const & | poses | ||
) |
Given any number of 2D image positions and the corresponding camera poses, this function triangulates the 3D point coordinate using the DLT algorithm.
Definition at line 44 of file triangulate.cc.