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;
84 typedef boost::shared_ptr<OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT> >
Ptr;
85 typedef boost::shared_ptr<const OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT> >
ConstPtr;
105 bool showStatistics_arg =
false,
106 const double pointResolution_arg = 0.001,
107 const double octreeResolution_arg = 0.01,
108 bool doVoxelGridDownDownSampling_arg =
false,
109 const unsigned int iFrameRate_arg = 30,
110 bool doColorEncoding_arg =
true,
111 const unsigned char colorBitResolution_arg = 6) :
114 binary_tree_data_vector_ (),
115 binary_color_tree_vector_ (),
116 point_count_data_vector_ (),
117 point_count_data_vector_iterator_ (),
121 do_voxel_grid_enDecoding_ (doVoxelGridDownDownSampling_arg), i_frame_rate_ (iFrameRate_arg),
122 i_frame_counter_ (0), frame_ID_ (0), point_count_ (0), i_frame_ (true),
123 do_color_encoding_ (doColorEncoding_arg), cloud_with_color_ (false), data_with_color_ (false),
124 point_color_offset_ (0), b_show_statistics_ (showStatistics_arg),
125 compressed_point_data_len_ (), compressed_color_data_len_ (), selected_profile_(compressionProfile_arg),
126 point_resolution_(pointResolution_arg), octree_resolution_(octreeResolution_arg),
127 color_bit_resolution_(colorBitResolution_arg),
152 point_coder_.setPrecision (static_cast<float> (selectedProfile.
pointResolution));
160 point_coder_.setPrecision (static_cast<float> (point_resolution_));
161 color_coder_.setBitDepth (color_bit_resolution_);
164 if (point_coder_.getPrecision () == this->getResolution ())
166 do_voxel_grid_enDecoding_ =
true;
186 if (output_ != cloud_arg)
206 encodePointCloud (
const PointCloudConstPtr &cloud_arg, std::ostream& compressed_tree_data_out_arg);
213 decodePointCloud (std::istream& compressed_tree_data_in_arg, PointCloudPtr &cloud_arg);
221 writeFrameHeader (std::ostream& compressed_tree_data_out_arg);
227 readFrameHeader (std::istream& compressed_tree_data_in_arg);
233 syncToHeader (std::istream& compressed_tree_data_in_arg);
239 entropyEncoding (std::ostream& compressed_tree_data_out_arg);
245 entropyDecoding (std::istream& compressed_tree_data_in_arg);
252 serializeTreeCallback (LeafT &leaf_arg,
const OctreeKey& key_arg);
259 deserializeTreeCallback (LeafT&,
const OctreeKey& key_arg);
316 template<
typename Po
intT,
typename LeafT,
typename BranchT,
typename OctreeT>