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>
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_
This file defines compatibility wrappers for low level I/O functions.
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_
Iterator on binary tree structure vector.
bool doVoxelGridDownSampling
PointCloudPtr output_
Pointer to output point cloud dataset.
uint64_t compressed_point_data_len_
boost::shared_ptr< OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeT > > Ptr
StaticRangeCoder compression class
OctreeT::BranchNode BranchNode
uint64_t compressed_color_data_len_
std::vector< unsigned int >::const_iterator point_count_data_vector_iterator_
Iterator on points per voxel vector.
Octree double buffer class
const struct configurationProfile_t compressionProfiles_[COMPRESSION_PROFILE_COUNT]
OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloud PointCloud
boost::shared_ptr< const OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeT > > ConstPtr
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.