MultiMarkerBundle.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 MULTIMARKERBUNDLE_H
00025 #define MULTIMARKERBUNDLE_H
00026 
00034 #include "MultiMarker.h"
00035 #include "Optimization.h"
00036 #include <Eigen/StdVector>
00037 
00038 namespace alvar {
00039 
00045 class ALVAR_EXPORT MultiMarkerBundle : public MultiMarker
00046 {
00047 protected:
00048         int optimization_keyframes;
00049         int optimization_markers;
00050         double optimization_error;
00051         bool optimizing;
00052         std::vector<Pose> camera_poses; // Estimated camera pose for every frame
00053         std::map<int, PointDouble> measurements; //
00054         int measurements_index(int frame, int marker_id, int marker_corner) {
00055                 // hop return (int) (frame*marker_indices.size()*4)+(marker_id*4)+marker_corner;
00056                 return (int) (frame*marker_indices.size()*4)+(get_id_index(marker_id)*4)+marker_corner;
00057         }
00058 
00059         void _MeasurementsAdd(MarkerIterator &begin, MarkerIterator &end, const Pose& camera_pose);
00060 
00061 public:
00062 
00066         MultiMarkerBundle(std::vector<int>& indices);
00067 
00068         ~MultiMarkerBundle();
00069 
00073         void MeasurementsReset();
00074 
00075         double GetOptimizationError() { return optimization_error; }
00076         int GetOptimizationKeyframes() { return optimization_keyframes; }
00077         int GetOptimizationMarkers() { return optimization_markers; }
00078         bool GetOptimizing() { return optimizing; }
00079 
00084         template <class M>
00085         void MeasurementsAdd(const std::vector<M, Eigen::aligned_allocator<M> > *markers, const Pose& camera_pose) {
00086             MarkerIteratorImpl<M> begin(markers->begin());
00087             MarkerIteratorImpl<M> end(markers->end());
00088         _MeasurementsAdd(begin, end,
00089                      camera_pose);
00090         }
00091                                                                                                                                                                                                                         //LEVENBERGMARQUARDT
00098         bool Optimize(Camera *_cam, double stop, int max_iter, Optimization::OptimizeMethod method = Optimization::TUKEY_LM); //TUKEY_LM
00099 };
00100 
00101 } // namespace alvar
00102 
00103 #endif


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