Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef PCL_OCTREE_POINTCLOUD_ADJACENCY_H_
00041 #define PCL_OCTREE_POINTCLOUD_ADJACENCY_H_
00042
00043 #include <pcl/common/geometry.h>
00044 #include <pcl/octree/boost.h>
00045 #include <pcl/octree/octree_base.h>
00046 #include <pcl/octree/octree_iterator.h>
00047 #include <pcl/octree/octree_pointcloud.h>
00048 #include <pcl/octree/octree_pointcloud_adjacency_container.h>
00049
00050 #include <set>
00051 #include <list>
00052
00053
00054 #include <pcl/common/time.h>
00055
00056
00057
00058 namespace pcl
00059 {
00060
00061 namespace octree
00062 {
00064
00079
00080 template< typename PointT,
00081 typename LeafContainerT = OctreePointCloudAdjacencyContainer <PointT>,
00082 typename BranchContainerT = OctreeContainerEmpty >
00083 class OctreePointCloudAdjacency : public OctreePointCloud< PointT, LeafContainerT, BranchContainerT>
00084
00085 {
00086
00087 public:
00088 typedef OctreeBase<LeafContainerT, BranchContainerT> OctreeBaseT;
00089
00090 typedef OctreePointCloudAdjacency<PointT, LeafContainerT, BranchContainerT > OctreeAdjacencyT;
00091 typedef boost::shared_ptr<OctreeAdjacencyT> Ptr;
00092 typedef boost::shared_ptr<const OctreeAdjacencyT> ConstPtr;
00093
00094 typedef OctreePointCloud<PointT, LeafContainerT, BranchContainerT,OctreeBaseT > OctreePointCloudT;
00095 typedef typename OctreePointCloudT::LeafNode LeafNode;
00096 typedef typename OctreePointCloudT::BranchNode BranchNode;
00097
00098 typedef pcl::PointCloud<PointT> CloudT;
00099
00100
00101 using OctreePointCloudT::input_;
00102 using OctreePointCloudT::resolution_;
00103
00104
00105 friend class OctreeIteratorBase<OctreeAdjacencyT> ;
00106 friend class OctreeDepthFirstIterator<OctreeAdjacencyT> ;
00107 friend class OctreeBreadthFirstIterator<OctreeAdjacencyT> ;
00108 friend class OctreeLeafNodeIterator<OctreeAdjacencyT> ;
00109
00110
00111 typedef OctreeDepthFirstIterator<OctreeAdjacencyT> Iterator;
00112 typedef const OctreeDepthFirstIterator<OctreeAdjacencyT> ConstIterator;
00113 Iterator depth_begin(unsigned int maxDepth_arg = 0) {return Iterator(this, maxDepth_arg);};
00114 const Iterator depth_end() {return Iterator();};
00115
00116
00117 typedef OctreeLeafNodeIterator<OctreeAdjacencyT> LeafNodeIterator;
00118 typedef const OctreeLeafNodeIterator< OctreeAdjacencyT> ConstLeafNodeIterator;
00119 LeafNodeIterator leaf_begin(unsigned int maxDepth_arg = 0) {return LeafNodeIterator(this, maxDepth_arg);};
00120 const LeafNodeIterator leaf_end() {return LeafNodeIterator();};
00121
00122 typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, PointT, float> VoxelAdjacencyList;
00123 typedef typename VoxelAdjacencyList::vertex_descriptor VoxelID;
00124 typedef typename VoxelAdjacencyList::edge_descriptor EdgeID;
00125
00126
00127 typedef std::vector <LeafContainerT*> LeafVectorT;
00128
00129 typedef typename LeafVectorT::iterator iterator;
00130 typedef typename LeafVectorT::const_iterator const_iterator;
00131 inline iterator begin () { return (leaf_vector_.begin ()); }
00132 inline iterator end () { return (leaf_vector_.end ()); }
00133
00134 inline size_t size () const { return leaf_vector_.size (); }
00135
00136
00140 OctreePointCloudAdjacency (const double resolution_arg);
00141
00142
00144 virtual ~OctreePointCloudAdjacency ()
00145 {
00146 }
00147
00151 void
00152 addPointsFromInputCloud ();
00153
00158 LeafContainerT *
00159 getLeafContainerAtPoint (const PointT& point_arg) const;
00160
00165 void
00166 computeVoxelAdjacencyGraph (VoxelAdjacencyList &voxel_adjacency_graph);
00167
00173 void
00174 setTransformFunction (boost::function<void (PointT &p)> transform_func)
00175 {
00176 transform_func_ = transform_func;
00177 }
00178
00184 bool
00185 testForOcclusion (const PointT& point_arg, const PointXYZ &camera_pos = PointXYZ (0,0,0));
00186
00187 protected:
00188
00193 virtual void
00194 addPointIdx (const int pointIdx_arg);
00195
00200 void
00201 computeNeighbors (OctreeKey &key_arg, LeafContainerT* leaf_container);
00202
00207 void
00208 genOctreeKeyforPoint (const PointT& point_arg,OctreeKey & key_arg) const;
00209
00210 private:
00211
00212 StopWatch timer_;
00213
00214
00215 LeafVectorT leaf_vector_;
00216
00217 boost::function<void (PointT &p)> transform_func_;
00218 };
00219
00220 }
00221
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 #include <pcl/octree/impl/octree_pointcloud_adjacency.hpp>
00234
00235
00236 #endif //PCL_OCTREE_POINTCLOUD_SUPER_VOXEL_H_
00237