/******************************************************************** ** Image Component Library (ICL) ** ** ** ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** ** Neuroinformatics Group ** ** Website: www.iclcv.org and ** ** http://opensource.cit-ec.de/projects/icl ** ** ** ** File : ICLMath/demos/octree/octree.cpp ** ** Module : ICLMath ** ** Authors: Christof Elbrechter ** ** ** ** ** ** GNU LESSER GENERAL PUBLIC LICENSE ** ** This file may be used under the terms of the GNU Lesser General ** ** Public License version 3.0 as published by the ** ** ** ** Free Software Foundation and appearing in the file LICENSE.LGPL ** ** included in the packaging of this file. Please review the ** ** following information to ensure the license requirements will ** ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** ** ** ** The development of this software was supported by the ** ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** ** Forschungsgemeinschaft (DFG) in the context of the German ** ** Excellence Initiative. ** ** ** ********************************************************************/ #include #include #include #include #include #include #include #include #define TRY_PCL_OCTREE #ifdef TRY_PCL_OCTREE #include typedef pcl::search::Octree PCL_OT; //#include //typedef pcl::octree::OctreePointCloudSearch PCL_OT; #else #include typedef pcl::KdTreeFLANN PCL_OT; #endif typedef PCLPointCloudObject PCL_PC; GUI gui; PointCloudObject obj(500*1000,1,false); Scene scene; OctreeObject ot(-500,-500,-500,1000,1000,1000); void init(){ ot.setRenderPoints(true); GRandClip r(0,100,Range64f(-500,500)); DataSegment ps = obj.selectXYZ(); DataSegment cs = obj.selectRGBA32f(); std::vector > nn(1000),nnres(1000); for(int i=0;i(r,r,r); } } Time t = Time::now(); for(int i=0;i p = ps[i]; ot.insert(FixedColVector(p[0],p[1],p[2],1)); } t.showAge("insertion time"); std::vector > q = ot.query(0,-500,-500,500,1000,1000); static PointCloudObject res(q.size(),1,false); ps = res.selectXYZ(); cs = res.selectRGBA32f(); for(size_t i=0;i pcl_ps = pcl_pc.selectXYZ(); for(int i=0;i > ptr(&pcl_pc.pcl()); t = Time::now(); pcl_ot.setInputCloud(ptr); t.showAge("set input cloud to pcl tree"); // 3 times faster! t = Time::now(); for(size_t i=0;i dstIdx; std::vector dstDist; pcl_ot.nearestKSearch(pcl::PointXYZ(nn[i][0],nn[i][1],nn[i][2]), 1, dstIdx,dstDist); } t.showAge("pcl nn search"); t = Time::now(); for(size_t i=0;i