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"
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) :
113 output_ (PointCloudPtr ()),
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>
void setOutputCloud(const PointCloudPtr &cloud_arg)
Provide a pointer to the output data set.
const double point_resolution_
PointCoding< PointT > point_coder_
Point coding instance.
Octree double buffer class
unsigned char point_color_offset_
const compression_Profiles_e selected_profile_
static const char * frame_header_identifier_
Octree container class that does not store any information.
OctreePointCloudCompression< PointT, LeafT, BranchT, Octree2BufBase< LeafT, BranchT > > RealTimeStreamCompression
const unsigned char color_bit_resolution_
ColorCoding< PointT > color_coder_
Color coding instance.
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloud PointCloud
virtual void addPointIdx(const int pointIdx_arg)
Add point at index from input pointcloud dataset to octree.
std::vector< char > binary_tree_data_vector_
Vector for storing binary tree structure.
uint64_t compressed_point_data_len_
const struct configurationProfile_t compressionProfiles_[COMPRESSION_PROFILE_COUNT]
OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeBase< LeafT, BranchT > > SinglePointCloudCompressionLowMemory
StaticRangeCoder entropy_coder_
Static range coder instance.
const double octree_resolution_
std::vector< char > binary_color_tree_vector_
Interator on binary tree structure vector.
std::size_t object_count_
Octree pointcloud compression class
OctreeT::BranchNode BranchNode
std::vector< unsigned int > point_count_data_vector_
Vector for storing points per voxel information.
const unsigned char colorBitResolution
OctreeT::LeafNode LeafNode
PointCloudPtr output_
Pointer to output point cloud dataset.
uint32_t i_frame_counter_
virtual void addPointIdx(const int point_idx_arg)
Add point at index from input pointcloud dataset to octree.
Octree container class that does store a vector of point indices.
bool do_voxel_grid_enDecoding_
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.
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloudConstPtr PointCloudConstPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
std::vector< unsigned int >::const_iterator point_count_data_vector_iterator_
Interator on points per voxel vector.
bool doVoxelGridDownSampling
const double octreeResolution
StaticRangeCoder compression class
boost::shared_ptr< OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeT > > Ptr
PointCloudPtr getOutputCloud() const
Get a pointer to the output point cloud dataset.
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloudPtr PointCloudPtr
virtual ~OctreePointCloudCompression()
Empty deconstructor.
uint64_t compressed_color_data_len_
boost::shared_ptr< const OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeT > > ConstPtr
void initialization()
Initialize globals.