Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MULTIMARKERINITIALIZER_H
00025 #define MULTIMARKERINITIALIZER_H
00026
00034 #include "MultiMarker.h"
00035 #include <Eigen/StdVector>
00036
00037 namespace alvar {
00038
00050 class ALVAR_EXPORT MultiMarkerInitializer : public MultiMarker
00051 {
00052 public:
00056 class MarkerMeasurement : public Marker {
00057 long _id;
00058 public:
00059 MarkerMeasurement() : globalPose(false) {}
00060 bool globalPose;
00061 unsigned long GetId() const { return _id; }
00062 void SetId(unsigned long _id) { this->_id = _id; }
00063 };
00064
00065 protected:
00066 std::vector<bool> marker_detected;
00067 std::vector<std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> > > measurements;
00068 typedef std::vector<std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> > >::iterator MeasurementIterator;
00069 FilterMedian *pointcloud_filtered;
00070 int filter_buffer_min;
00071
00072 bool updateMarkerPoses(std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> > &markers, const Pose &pose);
00073 void MeasurementsAdd(MarkerIterator &begin, MarkerIterator &end);
00074
00075 public:
00076 MultiMarkerInitializer(std::vector<int>& indices, int filter_buffer_min = 4, int filter_buffer_max = 15);
00077 ~MultiMarkerInitializer();
00078
00094 template <class M>
00095 void MeasurementsAdd(const std::vector<M, Eigen::aligned_allocator<M> > *markers) {
00096 MarkerIteratorImpl<M> begin(markers->begin());
00097 MarkerIteratorImpl<M> end(markers->end());
00098 MeasurementsAdd(begin, end);
00099 }
00100
00104 void MeasurementsReset();
00105
00111 int Initialize(Camera* cam);
00112
00113 int getMeasurementCount() { return measurements.size(); }
00114
00115 const std::vector<MarkerMeasurement, Eigen::aligned_allocator<MarkerMeasurement> >& getMeasurementMarkers(int measurement) {
00116 return measurements[measurement];
00117 }
00118
00119 double getMeasurementPose(int measurement, Camera *cam, Pose &pose) {
00120 MarkerIteratorImpl<MarkerMeasurement> m_begin(measurements[measurement].begin());
00121 MarkerIteratorImpl<MarkerMeasurement> m_end(measurements[measurement].end());
00122 return _GetPose(m_begin, m_end, cam, pose, NULL);
00123 }
00124 };
00125
00126 }
00127
00128 #endif