MultiMarkerBundle.h
Go to the documentation of this file.
1 /*
2  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3  *
4  * Copyright 2007-2012 VTT Technical Research Centre of Finland
5  *
6  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7  * <http://www.vtt.fi/multimedia/alvar.html>
8  *
9  * ALVAR is free software; you can redistribute it and/or modify it under the
10  * terms of the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17  * for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with ALVAR; if not, see
21  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22  */
23 
24 #ifndef MULTIMARKERBUNDLE_H
25 #define MULTIMARKERBUNDLE_H
26 
34 #include "MultiMarker.h"
35 #include "Optimization.h"
36 #include <Eigen/StdVector>
37 
38 namespace alvar {
39 
46 {
47 protected:
51  bool optimizing;
52  std::vector<Pose> camera_poses; // Estimated camera pose for every frame
53  std::map<int, PointDouble> measurements; //
54  int measurements_index(int frame, int marker_id, int marker_corner) {
55  // hop return (int) (frame*marker_indices.size()*4)+(marker_id*4)+marker_corner;
56  return (int) (frame*marker_indices.size()*4)+(get_id_index(marker_id)*4)+marker_corner;
57  }
58 
59  void _MeasurementsAdd(MarkerIterator &begin, MarkerIterator &end, const Pose& camera_pose);
60 
61 public:
62 
66  MultiMarkerBundle(std::vector<int>& indices);
67 
69 
73  void MeasurementsReset();
74 
75  double GetOptimizationError() { return optimization_error; }
76  int GetOptimizationKeyframes() { return optimization_keyframes; }
77  int GetOptimizationMarkers() { return optimization_markers; }
78  bool GetOptimizing() { return optimizing; }
79 
84  template <class M>
85  void MeasurementsAdd(const std::vector<M, Eigen::aligned_allocator<M> > *markers, const Pose& camera_pose) {
86  MarkerIteratorImpl<M> begin(markers->begin());
87  MarkerIteratorImpl<M> end(markers->end());
88  _MeasurementsAdd(begin, end,
89  camera_pose);
90  }
91  //LEVENBERGMARQUARDT
98  bool Optimize(Camera *_cam, double stop, int max_iter, Optimization::OptimizeMethod method = Optimization::TUKEY_LM); //TUKEY_LM
99 };
100 
101 } // namespace alvar
102 
103 #endif
Main ALVAR namespace.
Definition: Alvar.h:174
void MeasurementsAdd(const std::vector< M, Eigen::aligned_allocator< M > > *markers, const Pose &camera_pose)
Adds new measurements that are used in bundle adjustment.
int measurements_index(int frame, int marker_id, int marker_corner)
Base class for using MultiMarker.
Definition: MultiMarker.h:47
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camer...
Definition: Camera.h:82
OptimizeMethod
Selection between the algorithm used in optimization. Following should be noticed: ...
Definition: Optimization.h:74
This file implements several optimization algorithms.
Multi marker that uses bundle adjustment to refine the 3D positions of the markers (point cloud)...
Pose representation derived from the Rotation class
Definition: Pose.h:50
std::map< int, PointDouble > measurements
Iterator type for traversing templated Marker vector without the template.
Definition: Marker.h:277
#define ALVAR_EXPORT
Definition: Alvar.h:168
This file implements a multi-marker.
Iterator implementation for traversing templated Marker vector without the template.
Definition: Marker.h:294
std::vector< Pose > camera_poses


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Thu Jun 6 2019 19:27:24