24 #pragma warning(disable: 4267 4244)
27 #include <pcl/search/impl/search.hpp>
28 #include <pcl/features/normal_3d.h>
29 #include <pcl/kdtree/kdtree_flann.h>
35 vector<Eigen::Vector3f> res;
36 std::cout<<
"reading file : "<<filepath<<std::endl<<std::endl;
37 std::ifstream fin(filepath);
41 std::getline ( fin, test,
'\n' );
44 for(
size_t i =0; i<test.size(); ++i)
52 while (std::getline ( fin, test,
',' ))
56 std::getline ( fin, test,
',' );
58 std::getline ( fin, test,
'\n' );
67 while (std::getline ( fin, test,
',' ))
71 std::getline ( fin, test,
',' );
73 std::getline ( fin, test,
',' );
75 std::getline ( fin, test,
'\n' );
82 pointcloud_ =
new Eigen::Matrix<float, Eigen::Dynamic, 3>(res.size(), 3);
83 for(
size_t i = 0; i<res.size(); ++i)
88 std::cout<<
"did not find file"<<std::endl<<std::endl;
90 std::cout<<
"number of points : "<<n<<std::endl<<std::endl;
100 std::vector<float> pc(pc_size * dim);
101 flann::Matrix<float> flann_mat(&pc[0], pc_size, dim);
105 for (
int i =0; i < pc_size; ++i)
107 for (
int j =0; j < dim; ++j)
109 pc[n] = (*pointcloud_)(i,j);
114 tree_ =
new flann::Index<flann::L2<float>>(flann_mat, flann::KDTreeSingleIndexParams(15));
133 std::cout<<
"current resolution : "<<resolution<<std::endl<<std::endl;
140 std::vector<float> dis;
141 std::vector<int> neigh;
153 Eigen::Vector3f& input,
154 std::vector<int>& indices,
155 std::vector<float>& dists,
158 int dim = input.size();
160 std::vector<float> query;
162 for (
int i = 0; i < dim; i++)
164 flann::Matrix<float> query_mat(&query[0], 1, dim);
168 flann::Matrix<int> indices_mat(&indices[0], 1, nn);
169 flann::Matrix<float> dists_mat(&dists[0], 1, nn);
171 index->knnSearch(query_mat, indices_mat, dists_mat, nn, flann::SearchParams(128));