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 #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 } // namespace alvar
00127 
00128 #endif


ar_track_alvar
Author(s): Scott Niekum
autogenerated on Thu Feb 16 2017 03:23:02