Skip to content

Commit

Permalink
major revision of octree-base classes
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.pointclouds.org/pcl/trunk@8774 a9d63959-f2ad-4865-b262-bf0e56cfafb6
  • Loading branch information
jkammerl committed Mar 11, 2013
1 parent 1329f17 commit 1d38457
Show file tree
Hide file tree
Showing 30 changed files with 1,546 additions and 1,265 deletions.
217 changes: 213 additions & 4 deletions doc/tutorials/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,215 @@
.PHONY: html
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8

html:
-rm -rf html /tmp/doctrees
sphinx-build -b html -a -d /tmp/doctrees content html
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake

# The command to remove a file.
RM = /usr/bin/cmake -E remove -f

# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = /usr/bin/ccmake

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/kammerl/Documents/PCL/pcl/trunk

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /opt/PCL/pcl/trunk

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install

# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast

# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local

# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast

# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip

# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast

# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"doc\" \"pcl_2d\" \"pcl_apps\" \"pcl_common\" \"pcl_features\" \"pcl_filters\" \"pcl_geometry\" \"pcl_io\" \"pcl_kdtree\" \"pcl_keypoints\" \"pcl_ml\" \"pcl_octree\" \"pcl_outofcore\" \"pcl_recognition\" \"pcl_registration\" \"pcl_sample_consensus\" \"pcl_search\" \"pcl_segmentation\" \"pcl_stereo\" \"pcl_surface\" \"pcl_tools\" \"pcl_tracking\" \"pcl_visualization\" \"pclconfig\""
.PHONY : list_install_components

# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast

# Special rule for the target package
package: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
cd /opt/PCL/pcl/trunk && /usr/bin/cpack --config ./CPackConfig.cmake
.PHONY : package

# Special rule for the target package
package/fast: package
.PHONY : package/fast

# Special rule for the target package_source
package_source:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
cd /opt/PCL/pcl/trunk && /usr/bin/cpack --config ./CPackSourceConfig.cmake /opt/PCL/pcl/trunk/CPackSourceConfig.cmake
.PHONY : package_source

# Special rule for the target package_source
package_source/fast: package_source
.PHONY : package_source/fast

# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# Special rule for the target test
test:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
/usr/bin/ctest --force-new-ctest-process $(ARGS)
.PHONY : test

# Special rule for the target test
test/fast: test
.PHONY : test/fast

# The main all target
all: cmake_check_build_system
cd /opt/PCL/pcl/trunk && $(CMAKE_COMMAND) -E cmake_progress_start /opt/PCL/pcl/trunk/CMakeFiles /opt/PCL/pcl/trunk/doc/tutorials/CMakeFiles/progress.marks
cd /opt/PCL/pcl/trunk && $(MAKE) -f CMakeFiles/Makefile2 doc/tutorials/all
$(CMAKE_COMMAND) -E cmake_progress_start /opt/PCL/pcl/trunk/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
cd /opt/PCL/pcl/trunk && $(MAKE) -f CMakeFiles/Makefile2 doc/tutorials/clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
cd /opt/PCL/pcl/trunk && $(MAKE) -f CMakeFiles/Makefile2 doc/tutorials/preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
cd /opt/PCL/pcl/trunk && $(MAKE) -f CMakeFiles/Makefile2 doc/tutorials/preinstall
.PHONY : preinstall/fast

# clear depends
depend:
cd /opt/PCL/pcl/trunk && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

# Convenience name for target.
doc/tutorials/CMakeFiles/Tutorials.dir/rule:
cd /opt/PCL/pcl/trunk && $(MAKE) -f CMakeFiles/Makefile2 doc/tutorials/CMakeFiles/Tutorials.dir/rule
.PHONY : doc/tutorials/CMakeFiles/Tutorials.dir/rule

# Convenience name for target.
Tutorials: doc/tutorials/CMakeFiles/Tutorials.dir/rule
.PHONY : Tutorials

# fast build rule for target.
Tutorials/fast:
cd /opt/PCL/pcl/trunk && $(MAKE) -f doc/tutorials/CMakeFiles/Tutorials.dir/build.make doc/tutorials/CMakeFiles/Tutorials.dir/build
.PHONY : Tutorials/fast

# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... Tutorials"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... package"
@echo "... package_source"
@echo "... rebuild_cache"
@echo "... test"
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /opt/PCL/pcl/trunk && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ namespace pcl
// p-frame encoding - XOR encoded tree structure
this->serializeTree (binaryTreeDataVector_, true);


// write frame header information to stream
this->writeFrameHeader (compressedTreeDataOut_arg);

Expand All @@ -139,6 +140,9 @@ namespace pcl
this->switchBuffers ();
iFrame_ = false;

// reset object count
objectCount_ = 0;

if (bShowStatistics)
{
float bytesPerXYZ = static_cast<float> (compressedPointDataLen_) / static_cast<float> (pointCount_);
Expand Down Expand Up @@ -470,10 +474,10 @@ namespace pcl
//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafT, typename BranchT, typename OctreeT> void
OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT>::serializeTreeCallback (
LeafNode &leaf_arg, const OctreeKey & key_arg)
LeafT &leaf_arg, const OctreeKey & key_arg)
{
// reference to point indices vector stored within octree leaf
const std::vector<int>& leafIdx = leaf_arg.getDataTVector ();
const std::vector<int>& leafIdx = leaf_arg.getPointIndicesVector();

if (!doVoxelGridEnDecoding_)
{
Expand Down Expand Up @@ -504,7 +508,7 @@ namespace pcl

//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafT, typename BranchT, typename OctreeT> void
OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT>::deserializeTreeCallback (LeafNode&,
OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT>::deserializeTreeCallback (LeafT&,
const OctreeKey& key_arg)
{
double lowerVoxelCorner[3];
Expand Down
31 changes: 23 additions & 8 deletions io/include/pcl/compression/octree_pointcloud_compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include <pcl/common/common.h>
#include <pcl/common/io.h>
#include <pcl/octree/octree2buf_base.h>
#include <pcl/octree/octree_pointcloud.h>
#include "entropy_range_coder.h"
#include "color_coding.h"
Expand Down Expand Up @@ -67,9 +68,9 @@ namespace pcl
* \note typename: PointT: type of point used in pointcloud
* \author Julius Kammerl ([email protected])
*/
template<typename PointT, typename LeafT = OctreeContainerDataTVector<int>,
typename BranchT = OctreeContainerEmpty<int>,
typename OctreeT = Octree2BufBase<int, LeafT, BranchT> >
template<typename PointT, typename LeafT = OctreeContainerPointIndices,
typename BranchT = OctreeContainerEmpty,
typename OctreeT = Octree2BufBase<LeafT, BranchT> >
class OctreePointCloudCompression : public OctreePointCloud<PointT, LeafT,
BranchT, OctreeT>
{
Expand All @@ -82,8 +83,8 @@ namespace pcl
typedef typename OctreeT::LeafNode LeafNode;
typedef typename OctreeT::BranchNode BranchNode;

typedef OctreePointCloudCompression<PointT, LeafT, BranchT, Octree2BufBase<int, LeafT, BranchT> > RealTimeStreamCompression;
typedef OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeBase<int, LeafT, BranchT> > SinglePointCloudCompressionLowMemory;
typedef OctreePointCloudCompression<PointT, LeafT, BranchT, Octree2BufBase<LeafT, BranchT> > RealTimeStreamCompression;
typedef OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeBase<LeafT, BranchT> > SinglePointCloudCompressionLowMemory;


/** \brief Constructor
Expand Down Expand Up @@ -118,7 +119,9 @@ namespace pcl
doColorEncoding_ (doColorEncoding_arg), cloudWithColor_ (false), dataWithColor_ (false),
pointColorOffset_ (0), bShowStatistics (showStatistics_arg),
compressedPointDataLen_ (), compressedColorDataLen_ (), selectedProfile_(compressionProfile_arg),
pointResolution_(pointResolution_arg), octreeResolution_(octreeResolution_arg), colorBitResolution_(colorBitResolution_arg)
pointResolution_(pointResolution_arg), octreeResolution_(octreeResolution_arg),
colorBitResolution_(colorBitResolution_arg),
objectCount_(0)
{
initialization();
}
Expand Down Expand Up @@ -160,6 +163,16 @@ namespace pcl

}

/** \brief Add point at index from input pointcloud dataset to octree
* \param[in] pointIdx_arg the index representing the point in the dataset given by \a setInputCloud to be added
*/
virtual void
addPointIdx (const int pointIdx_arg)
{
++objectCount_;
OctreePointCloud<PointT, LeafT, BranchT, OctreeT>::addPointIdx(pointIdx_arg);
}

/** \brief Provide a pointer to the output data set.
* \param cloud_arg: the boost shared pointer to a PointCloud message
*/
Expand Down Expand Up @@ -232,14 +245,14 @@ namespace pcl
* \param key_arg: octree key of new leaf node
*/
virtual void
serializeTreeCallback (LeafNode &leaf_arg, const OctreeKey& key_arg);
serializeTreeCallback (LeafT &leaf_arg, const OctreeKey& key_arg);

/** \brief Decode leaf nodes information during deserialization
* \param leaf_arg: reference to new leaf node
* \param key_arg: octree key of new leaf node
*/
virtual void
deserializeTreeCallback (LeafNode&, const OctreeKey& key_arg);
deserializeTreeCallback (LeafT&, const OctreeKey& key_arg);


/** \brief Pointer to output point cloud dataset. */
Expand Down Expand Up @@ -291,6 +304,8 @@ namespace pcl
const double octreeResolution_;
const unsigned char colorBitResolution_;

std::size_t objectCount_;

};

// define frame identifier
Expand Down
5 changes: 2 additions & 3 deletions octree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ PCL_SUBSYS_DEPEND(build ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS})
PCL_ADD_DOC(${SUBSYS_NAME})

if(build)
set(srcs src/octree_impl.cpp
set(srcs src/octree_inst.cpp
)

set(incs
include/pcl/${SUBSYS_NAME}/boost.h
include/pcl/${SUBSYS_NAME}/octree_base.h
include/pcl/${SUBSYS_NAME}/octree_container.h
include/pcl/${SUBSYS_NAME}/octree_impl.h
include/pcl/${SUBSYS_NAME}/octree_nodes.h
include/pcl/${SUBSYS_NAME}/octree_node_pool.h
include/pcl/${SUBSYS_NAME}/octree_nodes.h
include/pcl/${SUBSYS_NAME}/octree_key.h
include/pcl/${SUBSYS_NAME}/octree_pointcloud_density.h
include/pcl/${SUBSYS_NAME}/octree_pointcloud_occupancy.h
Expand Down
Loading

0 comments on commit 1d38457

Please sign in to comment.