MultiMarkerInitializer.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 MULTIMARKERINITIALIZER_H
25 #define MULTIMARKERINITIALIZER_H
26 
34 #include "MultiMarker.h"
35 #include <Eigen/StdVector>
36 
37 namespace alvar {
38 
51 {
52 public:
56  class MarkerMeasurement : public Marker {
57  long _id;
58  public:
59  MarkerMeasurement() : globalPose(false) {}
60  bool globalPose;
61  unsigned long GetId() const { return _id; }
62  void SetId(unsigned long _id) { this->_id = _id; }
63  };
64 
65 protected:
66  std::vector<bool> marker_detected;
67  std::vector<std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> > > measurements;
68  typedef std::vector<std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> > >::iterator MeasurementIterator;
71 
72  bool updateMarkerPoses(std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> > &markers, const Pose &pose);
73  void MeasurementsAdd(MarkerIterator &begin, MarkerIterator &end);
74 
75 public:
76  MultiMarkerInitializer(std::vector<int>& indices, int filter_buffer_min = 4, int filter_buffer_max = 15);
78 
94  template <class M>
95  void MeasurementsAdd(const std::vector<M, Eigen::aligned_allocator<M> > *markers) {
96  MarkerIteratorImpl<M> begin(markers->begin());
97  MarkerIteratorImpl<M> end(markers->end());
98  MeasurementsAdd(begin, end);
99  }
100 
104  void MeasurementsReset();
105 
111  int Initialize(Camera* cam);
112 
113  int getMeasurementCount() { return measurements.size(); }
114 
115  const std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> >& getMeasurementMarkers(int measurement) {
116  return measurements[measurement];
117  }
118 
119  double getMeasurementPose(int measurement, Camera *cam, Pose &pose) {
120  MarkerIteratorImpl<MarkerMeasurement> m_begin(measurements[measurement].begin());
121  MarkerIteratorImpl<MarkerMeasurement> m_end(measurements[measurement].end());
122  return _GetPose(m_begin, m_end, cam, pose, NULL);
123  }
124 };
125 
126 } // namespace alvar
127 
128 #endif
double getMeasurementPose(int measurement, Camera *cam, Pose &pose)
Main ALVAR namespace.
Definition: Alvar.h:174
unsigned long GetId() const
Get id for this marker This is used e.g. in MarkerDetector to associate a marker id with an appropria...
Initializes multi marker by estimating their relative positions from one or more images.
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
std::vector< std::vector< MarkerMeasurement, Eigen::aligned_allocator< MarkerMeasurement > > >::iterator MeasurementIterator
void MeasurementsAdd(const std::vector< M, Eigen::aligned_allocator< M > > *markers)
Pose representation derived from the Rotation class
Definition: Pose.h:50
Basic 2D Marker functionality.
Definition: Marker.h:52
MarkerMeasurement that holds the maker id.
std::vector< std::vector< MarkerMeasurement, Eigen::aligned_allocator< MarkerMeasurement > > > measurements
Iterator type for traversing templated Marker vector without the template.
Definition: Marker.h:277
#define ALVAR_EXPORT
Definition: Alvar.h:168
FilterMedian provides an median filter
Definition: Filter.h:133
This file implements a multi-marker.
Iterator implementation for traversing templated Marker vector without the template.
Definition: Marker.h:294
Camera * cam
const std::vector< MarkerMeasurement, Eigen::aligned_allocator< MarkerMeasurement > > & getMeasurementMarkers(int measurement)


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