Blender V4.3
libmv/autotrack/reconstruction.h
Go to the documentation of this file.
1// Copyright (c) 2014 libmv authors.
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to
5// deal in the Software without restriction, including without limitation the
6// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7// sell copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in
11// all copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19// IN THE SOFTWARE.
20//
21// Author: mierle@gmail.com (Keir Mierle)
22
23#ifndef LIBMV_AUTOTRACK_RECONSTRUCTION_H_
24#define LIBMV_AUTOTRACK_RECONSTRUCTION_H_
25
26#include "libmv/base/map.h"
27#include "libmv/base/vector.h"
30
31namespace mv {
32
34using libmv::vector;
35
36class Model;
37
39 int clip;
40 int frame;
41 int intrinsics;
42 Mat3 R;
43 Vec3 t;
44};
45
46class Point {
47 int track;
48
49 // The coordinates of the point. Note that not all coordinates are always
50 // used; for example points on a plane only use the first two coordinates.
51 Vec3 X;
52};
53
54// A reconstruction for a set of tracks. The indexing for clip, frame, and
55// track should match that of a Tracks object, stored elsewhere.
57 public:
58 // All methods copy their input reference or take ownership of the pointer.
59 void AddCameraPose(const CameraPose& pose);
61 int AddPoint(const Point& point);
62 int AddModel(Model* model);
63
64 // Returns the corresponding pose or point or NULL if missing.
65 CameraPose* CameraPoseForFrame(int clip, int frame);
66 const CameraPose* CameraPoseForFrame(int clip, int frame) const;
67 Point* PointForTrack(int track);
68 const Point* PointForTrack(int track) const;
69
70 const vector<vector<CameraPose>>& camera_poses() const {
71 return camera_poses_;
72 }
73
74 private:
75 // Indexed by CameraPose::intrinsics. Owns the intrinsics objects.
76 vector<CameraIntrinsics*> camera_intrinsics_;
77
78 // Indexed by Marker::clip then by Marker::frame.
79 vector<map<int, CameraPose>> camera_poses_;
80
81 // Indexed by Marker::track.
82 vector<Point> points_;
83
84 // Indexed by Marker::model_id. Owns model objects.
85 vector<Model*> models_;
86};
87
88} // namespace mv
89
90#endif // LIBMV_AUTOTRACK_RECONSTRUCTION_H_
CameraPose * CameraPoseForFrame(int clip, int frame)
int AddPoint(const Point &point)
void AddCameraPose(const CameraPose &pose)
int AddCameraIntrinsics(CameraIntrinsics *intrinsics)
const Point * PointForTrack(int track) const
Point * PointForTrack(int track)
const vector< vector< CameraPose > > & camera_poses() const
const CameraPose * CameraPoseForFrame(int clip, int frame) const
int AddModel(Model *model)
float[3][3] Mat3
Definition gpu_matrix.cc:28
std::vector< ElementType, Eigen::aligned_allocator< ElementType > > vector