MultiMarkerInitializer.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of ALVAR, A Library for Virtual and Augmented Reality.
00003  *
00004  * Copyright 2007-2012 VTT Technical Research Centre of Finland
00005  *
00006  * Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
00007  *          <http://www.vtt.fi/multimedia/alvar.html>
00008  *
00009  * ALVAR is free software; you can redistribute it and/or modify it under the
00010  * terms of the GNU Lesser General Public License as published by the Free
00011  * Software Foundation; either version 2.1 of the License, or (at your option)
00012  * any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful, but WITHOUT
00015  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00016  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00017  * for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with ALVAR; if not, see
00021  * <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
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 } // namespace alvar
00126 
00127 #endif


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Sun Oct 5 2014 22:16:26