Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLGeom/src/ICLGeom/ICP.h ** 00010 ** Module : ICLGeom ** 00011 ** Authors: Christian Groszewski, Christof Elbrechter ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 #pragma once 00031 00032 #include <ICLUtils/Macros.h> 00033 #include <ICLUtils/Uncopyable.h> 00034 #include <ICLMath/DynMatrix.h> 00035 #include <ICLMath/KDTree.h> 00036 #include <ICLGeom/PoseEstimator.h> 00037 00038 namespace icl{ 00039 namespace geom{ 00040 00042 00045 class ICLGeom_API ICP : public utils::Uncopyable{ 00046 public: 00048 struct ICLGeom_API Result{ 00049 Result(); 00050 math::DynMatrix<icl64f> rotation; 00051 math::DynMatrix<icl64f> translation; 00052 double error; 00053 }; 00054 00055 private: 00057 Result m_result; 00058 00060 math::KDTree kdt; 00061 00063 math::DynMatrix<icl64f> *compute(const std::vector<math::DynMatrix<icl64f>* > &data, 00064 const std::vector<math::DynMatrix<icl64f>* > &model); 00065 public: 00066 00067 00068 00070 00071 ICP(std::vector<math::DynMatrix<icl64f> > &model); 00072 00074 00075 ICP(std::vector<math::DynMatrix<icl64f>* > &model); 00076 00078 ICP(); 00079 00081 ~ICP(); 00082 00083 00085 const Result &apply(const std::vector<math::DynMatrix<icl64f>* > &pointlist); 00086 00088 static double error(const std::vector<math::DynMatrix<icl64f>* > &dat, 00089 const std::vector<math::DynMatrix<icl64f>* > &mod); 00090 00091 #if 0 00092 // hope we dont need that anymore ... 00094 inline double getError(){ 00095 return m_result.error; 00096 } 00097 00099 inline const math::DynMatrix<icl64f>& getRotation() const{ 00100 return m_result.rotation; 00101 } 00102 00104 inline const math::DynMatrix<icl64f>& getTranslation() const{ 00105 return m_result.translation; 00106 } 00107 #endif 00108 }; 00109 } // namespace geom 00110 } 00111