Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef STANNPOINTCLOUDMANAGER_H_
00009 #define STANNPOINTCLOUDMANAGER_H_
00010
00011
00012 #include "PointCloudManager.hpp"
00013 #include "../io/Progress.hpp"
00014 #include "../io/Timestamp.hpp"
00015 #include "../io/PLYIO.hpp"
00016 #include "../io/AsciiIO.hpp"
00017 #include "../io/UosIO.hpp"
00018
00019
00020 #include "../stann/sfcnn.hpp"
00021 #include "../Eigen/Dense"
00022 using namespace Eigen;
00023
00024
00025 #include <iostream>
00026 #include <fstream>
00027 #include <string>
00028 #include <cassert>
00029 using std::cout;
00030 using std::endl;
00031 using std::string;
00032 using std::ifstream;
00033 using std::ofstream;
00034
00035
00036 #include <boost/filesystem.hpp>
00037
00038 namespace lssr
00039 {
00040
00045 template<typename VertexT, typename NormalT>
00046 struct Plane{
00047 float a, b, c;
00048 NormalT n;
00049 VertexT p;
00050 };
00051
00058 template<typename VertexT, typename NormalT>
00059 class StannPointCloudManager : public PointCloudManager<VertexT, NormalT>
00060 {
00061 public:
00062
00076 StannPointCloudManager(float** points,
00077 NormalT *normals,
00078 size_t n,
00079 const int &kn = 10,
00080 const int &ki = 10,
00081 const int &kd = 10);
00082
00092 StannPointCloudManager(string filename,
00093 const int &kn = 10,
00094 const int &ki = 10,
00095 const int &kd = 10);
00096
00100 virtual ~StannPointCloudManager() {};
00101
00109 virtual void getkClosestVertices(const VertexT &v,
00110 const size_t &k, vector<VertexT> &nb)
00111 {
00113 }
00114
00122 virtual void getkClosestNormals(const VertexT &n,
00123 const size_t &k, vector<NormalT> &nb)
00124 {
00126 }
00127
00139 void save(string filename);
00140
00141
00145 virtual float distance(VertexT v);
00146
00147
00148 private:
00149
00153 void init();
00154
00159 void savePLY(string filename);
00160
00164 void savePointsAndNormals(string filename);
00165
00169 void savePoints(string filename);
00170
00175 void estimateSurfaceNormals();
00176
00180 void interpolateSurfaceNormals();
00181
00193 bool boundingBoxOK(const float &dx, const float &dy, const float &dz);
00194
00203 float meanDistance(const Plane<VertexT, NormalT> &p, const vector<unsigned long> &id, const int &k);
00204
00212 VertexT fromID(int i);
00213
00217 float distance(VertexT v, Plane<VertexT, NormalT> p);
00218
00227 Plane<VertexT, NormalT> calcPlane(const VertexT &queryPoint,
00228 const int &k,
00229 const vector<unsigned long> &id);
00230
00232 sfcnn< float*, 3, float> m_pointTree;
00233
00235 int m_kn;
00236
00238 int m_ki;
00239
00241 int m_kd;
00242
00244 VertexT m_centroid;
00245 };
00246
00247 }
00248
00249
00250 #include "StannPointCloudManager.tcc"
00251
00252 #endif