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
00036 namespace alvar {
00037
00049 class ALVAR_EXPORT MultiMarkerInitializer : public MultiMarker
00050 {
00051 public:
00055 class MarkerMeasurement : public Marker {
00056 long _id;
00057 public:
00058 MarkerMeasurement() : globalPose(false) {}
00059 bool globalPose;
00060 unsigned long GetId() const { return _id; }
00061 void SetId(unsigned long _id) { this->_id = _id; }
00062 };
00063
00064 protected:
00065 std::vector<bool> marker_detected;
00066 std::vector<std::vector<MarkerMeasurement> > measurements;
00067 typedef std::vector<std::vector<MarkerMeasurement> >::iterator MeasurementIterator;
00068 FilterMedian *pointcloud_filtered;
00069 int filter_buffer_min;
00070
00071 bool updateMarkerPoses(std::vector<MarkerMeasurement> &markers, const Pose &pose);
00072 void MeasurementsAdd(MarkerIterator &begin, MarkerIterator &end);
00073
00074 public:
00075 MultiMarkerInitializer(std::vector<int>& indices, int filter_buffer_min = 4, int filter_buffer_max = 15);
00076 ~MultiMarkerInitializer();
00077
00093 template <class M>
00094 void MeasurementsAdd(const std::vector<M> *markers) {
00095 MarkerIteratorImpl<M> begin(markers->begin());
00096 MarkerIteratorImpl<M> end(markers->end());
00097 MeasurementsAdd(begin, end);
00098 }
00099
00103 void MeasurementsReset();
00104
00110 int Initialize(Camera* cam);
00111
00112 int getMeasurementCount() { return measurements.size(); }
00113
00114 const std::vector<MarkerMeasurement>& getMeasurementMarkers(int measurement) {
00115 return measurements[measurement];
00116 }
00117
00118 double getMeasurementPose(int measurement, Camera *cam, Pose &pose) {
00119 MarkerIteratorImpl<MarkerMeasurement> m_begin(measurements[measurement].begin());
00120 MarkerIteratorImpl<MarkerMeasurement> m_end(measurements[measurement].end());
00121 return _GetPose(m_begin, m_end, cam, pose, NULL);
00122 }
00123 };
00124
00125 }
00126
00127 #endif