38 #ifndef OCTREE_COMPRESSION_H
39 #define OCTREE_COMPRESSION_H
41 #include <pcl/common/common.h>
42 #include <pcl/common/io.h>
43 #include <pcl/octree/octree2buf_base.h>
44 #include <pcl/octree/octree_pointcloud.h>
45 #include "entropy_range_coder.h"
46 #include "color_coding.h"
47 #include "point_coding.h"
49 #include "compression_profiles.h"
59 using namespace pcl::octree;
101 bool showStatistics_arg =
false,
102 const double pointResolution_arg = 0.001,
103 const double octreeResolution_arg = 0.01,
104 bool doVoxelGridDownDownSampling_arg =
false,
105 const unsigned int iFrameRate_arg = 30,
106 bool doColorEncoding_arg =
true,
107 const unsigned char colorBitResolution_arg = 6) :
110 binary_tree_data_vector_ (),
111 binary_color_tree_vector_ (),
112 point_count_data_vector_ (),
113 point_count_data_vector_iterator_ (),
117 do_voxel_grid_enDecoding_ (doVoxelGridDownDownSampling_arg), i_frame_rate_ (iFrameRate_arg),
118 i_frame_counter_ (0), frame_ID_ (0), point_count_ (0), i_frame_ (true),
119 do_color_encoding_ (doColorEncoding_arg), cloud_with_color_ (false), data_with_color_ (false),
120 point_color_offset_ (0), b_show_statistics_ (showStatistics_arg),
121 compressed_point_data_len_ (), compressed_color_data_len_ (), selected_profile_(compressionProfile_arg),
122 point_resolution_(pointResolution_arg), octree_resolution_(octreeResolution_arg),
123 color_bit_resolution_(colorBitResolution_arg),
148 point_coder_.setPrecision (static_cast<float> (selectedProfile.
pointResolution));
156 point_coder_.setPrecision (static_cast<float> (point_resolution_));
157 color_coder_.setBitDepth (color_bit_resolution_);
160 if (point_coder_.getPrecision () == this->getResolution ())
162 do_voxel_grid_enDecoding_ =
true;
182 if (output_ != cloud_arg)
202 encodePointCloud (
const PointCloudConstPtr &cloud_arg, std::ostream& compressed_tree_data_out_arg);
209 decodePointCloud (std::istream& compressed_tree_data_in_arg, PointCloudPtr &cloud_arg);
217 writeFrameHeader (std::ostream& compressed_tree_data_out_arg);
223 readFrameHeader (std::istream& compressed_tree_data_in_arg);
229 syncToHeader (std::istream& compressed_tree_data_in_arg);
235 entropyEncoding (std::ostream& compressed_tree_data_out_arg);
241 entropyDecoding (std::istream& compressed_tree_data_in_arg);
248 serializeTreeCallback (LeafT &leaf_arg,
const OctreeKey& key_arg);
255 deserializeTreeCallback (LeafT&,
const OctreeKey& key_arg);
312 template<
typename Po
intT,
typename LeafT,
typename BranchT,
typename OctreeT>
struct configurationProfile_t compressionProfiles_[COMPRESSION_PROFILE_COUNT]
uint32_t i_frame_counter_
bool do_voxel_grid_enDecoding_
OctreePointCloudCompression< PointT, LeafT, BranchT, Octree2BufBase< LeafT, BranchT > > RealTimeStreamCompression
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloudPtr PointCloudPtr
const unsigned char colorBitResolution
unsigned char point_color_offset_
ColorCoding< PointT > color_coder_
Color coding instance.
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloudConstPtr PointCloudConstPtr
Octree pointcloud compression class
std::size_t object_count_
virtual void addPointIdx(const int point_idx_arg)
Add point at index from input pointcloud dataset to octree.
PointCloudPtr getOutputCloud() const
Get a pointer to the output point cloud dataset.
static const char * frame_header_identifier_
virtual ~OctreePointCloudCompression()
Empty deconstructor.
const unsigned char color_bit_resolution_
const compression_Profiles_e selected_profile_
PointCoding< PointT > point_coder_
Point coding instance.
void initialization()
Initialize globals.
Octree container class that does store a vector of point indices.
const double point_resolution_
virtual void addPointIdx(const int pointIdx_arg)
Add point at index from input pointcloud dataset to octree.
OctreeT::LeafNode LeafNode
std::vector< char > binary_color_tree_vector_
Interator on binary tree structure vector.
bool doVoxelGridDownSampling
PointCloudPtr output_
Pointer to output point cloud dataset.
uint64_t compressed_point_data_len_
StaticRangeCoder compression class
OctreeT::BranchNode BranchNode
uint64_t compressed_color_data_len_
std::vector< unsigned int >::const_iterator point_count_data_vector_iterator_
Interator on points per voxel vector.
Octree double buffer class
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloud PointCloud
A point structure representing Euclidean xyz coordinates, and the RGB color.
std::vector< unsigned int > point_count_data_vector_
Vector for storing points per voxel information.
const double octree_resolution_
OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeBase< LeafT, BranchT > > SinglePointCloudCompressionLowMemory
Octree container class that does not store any information.
OctreePointCloudCompression(compression_Profiles_e compressionProfile_arg=MED_RES_ONLINE_COMPRESSION_WITH_COLOR, bool showStatistics_arg=false, const double pointResolution_arg=0.001, const double octreeResolution_arg=0.01, bool doVoxelGridDownDownSampling_arg=false, const unsigned int iFrameRate_arg=30, bool doColorEncoding_arg=true, const unsigned char colorBitResolution_arg=6)
Constructor.
StaticRangeCoder entropy_coder_
Static range coder instance.
const double octreeResolution
std::vector< char > binary_tree_data_vector_
Vector for storing binary tree structure.
void setOutputCloud(const PointCloudPtr &cloud_arg)
Provide a pointer to the output data set.