forked from PointCloudLibrary/pcl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the depth first iterator for outofcore octree
added examples after the depth first iterator was written modified the example to add data only to leaves; added octants.pcd for testing refactoring: don't use num_children_ in outofcore --> getNumChildren () git-svn-id: svn+ssh://svn.pointclouds.org/pcl/trunk@7346 a9d63959-f2ad-4865-b262-bf0e56cfafb6
- Loading branch information
Showing
33 changed files
with
2,381 additions
and
701 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if (BUILD_outofcore) | ||
|
||
PCL_SUBSYS_DEPEND (build ${SUBSYS_NAME} DEPS outofcore io common octree filters) | ||
|
||
PCL_ADD_EXAMPLE (pcl_example_outofcore_with_lod FILES pcl_example_outofcore_with_lod.cpp LINK_WITH pcl_outofcore pcl_common pcl_io pcl_octree pcl_filters) | ||
|
||
PCL_ADD_EXAMPLE (pcl_example_outofcore FILES pcl_example_outofcore.cpp LINK_WITH pcl_outofcore pcl_common pcl_io pcl_octree pcl_filters) | ||
|
||
endif (BUILD_outofcore) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2010-2012, Willow Garage, Inc. | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* $Id$ | ||
*/ | ||
|
||
#include <pcl/io/pcd_io.h> | ||
#include <pcl/console/print.h> | ||
|
||
#include <pcl/outofcore/outofcore.h> | ||
#include <pcl/outofcore/outofcore_impl.h> | ||
|
||
#include <pcl/outofcore/OutofcoreIteratorBase.h> | ||
|
||
#include <pcl/outofcore/OutofcoreDepthFirstIterator.h> | ||
#include <pcl/outofcore/impl/OutofcoreDepthFirstIterator.hpp> | ||
|
||
using namespace pcl::outofcore; | ||
|
||
typedef OutofcoreOctreeBase<OutofcoreOctreeDiskContainer<pcl::PointXYZ>, pcl::PointXYZ> OctreeDisk; | ||
typedef OutofcoreOctreeBaseNode<OutofcoreOctreeDiskContainer<pcl::PointXY>, pcl::PointXYZ> OctreeDiskNode; | ||
|
||
int main (int argc, char** argv) | ||
{ | ||
// pcl::console::setVerbosityLevel (pcl::console::L_VERBOSE); | ||
|
||
int depth = 3; | ||
Eigen::Vector3d min (-10.0, -10.0, -10.0); | ||
Eigen::Vector3d max (10.0, 10.0, 10.0); | ||
boost::filesystem::path file_location ("tree/tree.oct_idx"); | ||
|
||
OctreeDisk* octree; | ||
|
||
octree = new OctreeDisk (depth, min, max, file_location, "ECEF"); | ||
|
||
sensor_msgs::PointCloud2::Ptr cloud (new sensor_msgs::PointCloud2 ()); | ||
|
||
pcl::io::loadPCDFile (argv[1], *cloud); | ||
|
||
octree->addPointCloud (cloud, false); | ||
|
||
delete octree; | ||
|
||
OctreeDisk octree2 (file_location, true); | ||
|
||
//iterate over the octree, depth first | ||
OutofcoreDepthFirstIterator<pcl::PointXYZ, pcl::outofcore::OutofcoreOctreeDiskContainer<pcl::PointXYZ> > it (octree2); | ||
OctreeDisk::Iterator myit (octree2); | ||
|
||
while ( *myit !=0 ) | ||
{ | ||
octree2.printBoundingBox (**myit); | ||
myit++; | ||
} | ||
|
||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2010-2012, Willow Garage, Inc. | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* $Id$ | ||
*/ | ||
|
||
int main (int argc, char** argv) | ||
{ | ||
|
||
//Find all PCD files located in argv[1] directory | ||
|
||
// | ||
|
||
|
||
|
||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
outofcore/include/pcl/outofcore/OutofcoreBreadthFirstIterator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2010-2012, Willow Garage, Inc. | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* $Id: OutofcoreBreadthFirstIterator.h -1M 2012-08-24 19:37:13Z (local) $ | ||
*/ | ||
|
||
#ifndef PCL_OUTOFCORE_BFS_ITERATOR_BASE_H_ | ||
#define PCL_OUTOFCORE_ITERATOR_BASE_H_ | ||
|
||
#include <pcl/outofcore/OutofcoreIteratorBase.h> | ||
|
||
namespace pcl | ||
{ | ||
namespace outofcore | ||
{ | ||
class OutofcoreBFSIterator : public OutofcoreIteratorBase | ||
{ | ||
public: | ||
OutofcoreBFSIterator (OutofcoreOctreeBase& outofcore_octree_arg) : | ||
OutofcoreIteratorBase (outofcore_octree_arg) | ||
{ | ||
} | ||
|
||
~OutofcoreBFSIteratorBase () | ||
{ | ||
} | ||
|
||
OutofcoreBFSIterator& | ||
operator++(const OutofcoreBFSIterator &src); | ||
|
||
}; | ||
} | ||
} | ||
|
||
|
||
|
||
|
84 changes: 84 additions & 0 deletions
84
outofcore/include/pcl/outofcore/OutofcoreDepthFirstIterator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Point Cloud Library (PCL) - www.pointclouds.org | ||
* Copyright (c) 2010-2012, Willow Garage, Inc. | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage, Inc. nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* $Id$ | ||
*/ | ||
|
||
#ifndef PCL_OUTOFCORE_DEPTH_FIRST_ITERATOR_H_ | ||
#define PCL_OUTOFCORE_DEPTH_FIRST_ITERATOR_H_ | ||
|
||
#include <pcl/outofcore/OutofcoreIteratorBase.h> | ||
namespace pcl | ||
{ | ||
namespace outofcore | ||
{ | ||
template<typename PointT, typename ContainerT> | ||
class OutofcoreDepthFirstIterator : public OutofcoreIteratorBase<PointT, ContainerT> | ||
{ | ||
public: | ||
typedef typename pcl::outofcore::OutofcoreOctreeBase<ContainerT, PointT> OctreeDisk; | ||
typedef typename pcl::outofcore::OutofcoreOctreeBaseNode<ContainerT, PointT> OctreeDiskNode; | ||
|
||
typedef typename pcl::outofcore::OutofcoreOctreeBaseNode<ContainerT, PointT> LeafNode; | ||
typedef typename pcl::outofcore::OutofcoreOctreeBaseNode<ContainerT, PointT> BranchNode; | ||
|
||
explicit | ||
OutofcoreDepthFirstIterator (OctreeDisk& octree_arg); | ||
|
||
virtual | ||
~OutofcoreDepthFirstIterator (); | ||
|
||
OutofcoreDepthFirstIterator& | ||
operator++ (); | ||
|
||
inline OutofcoreDepthFirstIterator | ||
operator++ (int) | ||
{ | ||
OutofcoreDepthFirstIterator _Tmp = *this; | ||
++*this; | ||
return (_Tmp); | ||
} | ||
|
||
void | ||
skipChildVoxels (); | ||
|
||
protected: | ||
unsigned char currentChildIdx_; | ||
std::vector<std::pair<OctreeDiskNode*, unsigned char> > stack_; | ||
}; | ||
} | ||
} | ||
|
||
#endif //PCL_OUTOFCORE_DEPTH_FIRST_ITERATOR_H_ |
Oops, something went wrong.