DsfTrackGenerator.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
19 #pragma once
20 #include <gtsam/base/DSFMap.h>
21 #include <gtsam/sfm/SfmTrack.h>
22 
23 #include <Eigen/Core>
24 #include <map>
25 #include <optional>
26 #include <vector>
27 
28 namespace gtsam {
29 
30 namespace gtsfm {
31 
32 typedef Eigen::MatrixX2i CorrespondenceIndices; // N x 2 array
33 
34 // Output of detections in an image.
35 // Coordinate system convention:
36 // 1. The x coordinate denotes the horizontal direction (+ve direction towards
37 // the right).
38 // 2. The y coordinate denotes the vertical direction (+ve direction downwards).
39 // 3. Origin is at the top left corner of the image.
40 struct Keypoints {
41  // The (x, y) coordinates of the features, of shape Nx2.
42  Eigen::MatrixX2d coordinates;
43 
44  // Optional scale of the detections, of shape N.
45  // Note: gtsam::Vector is typedef'd for Eigen::VectorXd.
46  std::optional<gtsam::Vector> scales;
47 
49  std::optional<gtsam::Vector> responses;
50 
51  Keypoints(const Eigen::MatrixX2d &_coordinates)
52  : coordinates(_coordinates) {}
53 };
54 
55 using KeypointsVector = std::vector<Keypoints>;
56 // Mapping from each image pair to (N,2) array representing indices of matching
57 // keypoints.
58 using MatchIndicesMap = std::map<IndexPair, CorrespondenceIndices>;
59 
72 std::vector<SfmTrack2d> GTSAM_EXPORT tracksFromPairwiseMatches(
73  const MatchIndicesMap& matches, const KeypointsVector& keypoints,
74  bool verbose = false);
75 
76 } // namespace gtsfm
77 
78 } // namespace gtsam
gtsam::gtsfm::Keypoints
Definition: DsfTrackGenerator.h:40
setup.matches
matches
Definition: wrap/pybind11/setup.py:74
DSFMap.h
Allow for arbitrary type in DSF.
gtsam::gtsfm::Keypoints::Keypoints
Keypoints(const Eigen::MatrixX2d &_coordinates)
Definition: DsfTrackGenerator.h:51
gtsam::gtsfm::CorrespondenceIndices
Eigen::MatrixX2i CorrespondenceIndices
Definition: DsfTrackGenerator.h:32
gtsam::gtsfm::MatchIndicesMap
std::map< IndexPair, CorrespondenceIndices > MatchIndicesMap
Definition: DsfTrackGenerator.h:58
gtsam::gtsfm::Keypoints::responses
std::optional< gtsam::Vector > responses
Optional confidences/responses for each detection, of shape N.
Definition: DsfTrackGenerator.h:49
gtsam
traits
Definition: SFMdata.h:40
gtsam::gtsfm::Keypoints::coordinates
Eigen::MatrixX2d coordinates
Definition: DsfTrackGenerator.h:42
gtsam::gtsfm::tracksFromPairwiseMatches
std::vector< SfmTrack2d > tracksFromPairwiseMatches(const MatchIndicesMap &matches, const KeypointsVector &keypoints, bool verbose)
Creates a list of tracks from 2d point correspondences.
Definition: DsfTrackGenerator.cpp:103
gtsam::gtsfm::Keypoints::scales
std::optional< gtsam::Vector > scales
Definition: DsfTrackGenerator.h:46
SfmTrack.h
A simple data structure for a track in Structure from Motion.
gtsam::gtsfm::KeypointsVector
std::vector< Keypoints > KeypointsVector
Definition: DsfTrackGenerator.h:55


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:29