Berkeley SfM
types.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: Erik Nelson ( eanelson@eecs.berkeley.edu )
35  * David Fridovich-Keil ( dfk@eecs.berkeley.edu )
36  */
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 //
40 // This file defines typedefs for generic types and primitives used for SfM.
41 //
42 // ////////////////////////////////////////////////////////////////////////////
43 
44 #ifndef BSFM_UTIL_TYPES_H
45 #define BSFM_UTIL_TYPES_H
46 
47 #include <Eigen/Core>
48 #include <opencv2/features2d/features2d.hpp>
49 #include <limits>
50 #include <vector>
51 
52 namespace bsfm {
53 
54 // -------------------- Custom types -------------------- //
55 
56 // Each ViewIndex corresponds to a unique View that is constructed at runtime
57 // and can be accessed with View::GetView(ViewIndex index).
58 typedef unsigned int ViewIndex;
59 
60 // Each LandmarkIndex corresponds to a unique Landmark that is constructed at
61 // runtime and can be accessed with Landmark::GetLandmark(LandmarkIndex index).
62 typedef unsigned int LandmarkIndex;
63 
64 // Designate some invalid indices.
65 static constexpr ViewIndex kInvalidView = std::numeric_limits<ViewIndex>::max();
66 static constexpr LandmarkIndex kInvalidLandmark =
67  std::numeric_limits<LandmarkIndex>::max();
68 
69 
70 // -------------------- Third-party typedefs -------------------- //
71 
72 // When extracting N-dimensional descriptors from a set of M keypoints, OpenCV
73 // will store the desriptors in a (M-K)xN matrix, where K is the number of
74 // keypoints that OpenCV failed to compute a descriptor for. In other words,
75 // rows correspond to keypoints, and columns to indices of the descriptor.
76 typedef ::cv::Mat DescriptorList;
77 
78 // Keypoints contain (u, v) image-space coordinates.
79 typedef ::cv::KeyPoint Keypoint;
80 typedef ::std::vector<Keypoint> KeypointList;
81 
82 // Descriptors are dynamically sized vectors of doubles.
83 typedef ::Eigen::Matrix<double, Eigen::Dynamic, 1> Descriptor;
84 
85 // Used to represent [R | t] and P, the camera extrinsics and projection
86 // matrices.
87 typedef ::Eigen::Matrix<double, 3, 4> Matrix34d;
88 
89 } //\namespace bsfm
90 
91 #endif
::cv::KeyPoint Keypoint
Definition: types.h:79
unsigned int ViewIndex
Definition: types.h:58
unsigned int LandmarkIndex
Definition: types.h:62
static constexpr LandmarkIndex kInvalidLandmark
Definition: types.h:66
static constexpr ViewIndex kInvalidView
Definition: types.h:65
::std::vector< Keypoint > KeypointList
Definition: types.h:80
Definition: camera.cpp:50
::Eigen::Matrix< double, 3, 4 > Matrix34d
Definition: types.h:87
::cv::Mat DescriptorList
Definition: types.h:76
::Eigen::Matrix< double, Eigen::Dynamic, 1 > Descriptor
Definition: types.h:83