41 #include <pcl/common/io.h>
42 #include <pcl/octree/octree2buf_base.h>
43 #include <pcl/octree/octree_pointcloud.h>
44 #include "entropy_range_coder.h"
45 #include "color_coding.h"
46 #include "point_coding.h"
48 #include "compression_profiles.h"
81 using Ptr = shared_ptr<OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT> >;
82 using ConstPtr = shared_ptr<const OctreePointCloudCompression<PointT, LeafT, BranchT, OctreeT> >;
102 bool showStatistics_arg =
false,
103 const double pointResolution_arg = 0.001,
104 const double octreeResolution_arg = 0.01,
105 bool doVoxelGridDownDownSampling_arg =
false,
106 const unsigned int iFrameRate_arg = 30,
107 bool doColorEncoding_arg =
true,
108 const unsigned char colorBitResolution_arg = 6) :
113 do_voxel_grid_enDecoding_ (doVoxelGridDownDownSampling_arg), i_frame_rate_ (iFrameRate_arg),
114 i_frame_counter_ (0), frame_ID_ (0), point_count_ (0), i_frame_ (true),
115 do_color_encoding_ (doColorEncoding_arg), cloud_with_color_ (false), data_with_color_ (false),
116 point_color_offset_ (0), b_show_statistics_ (showStatistics_arg),
117 compressed_point_data_len_ (), compressed_color_data_len_ (), selected_profile_(compressionProfile_arg),
118 point_resolution_(pointResolution_arg), octree_resolution_(octreeResolution_arg),
119 color_bit_resolution_(colorBitResolution_arg),
144 point_coder_.setPrecision (
static_cast<float> (selectedProfile.
pointResolution));
152 point_coder_.setPrecision (
static_cast<float> (point_resolution_));
153 color_coder_.setBitDepth (color_bit_resolution_);
156 if (point_coder_.getPrecision () == this->getResolution ())
158 do_voxel_grid_enDecoding_ =
true;
178 if (output_ != cloud_arg)
198 encodePointCloud (
const PointCloudConstPtr &cloud_arg, std::ostream& compressed_tree_data_out_arg);
205 decodePointCloud (std::istream& compressed_tree_data_in_arg, PointCloudPtr &cloud_arg);
213 writeFrameHeader (std::ostream& compressed_tree_data_out_arg);
219 readFrameHeader (std::istream& compressed_tree_data_in_arg);
225 syncToHeader (std::istream& compressed_tree_data_in_arg);
231 entropyEncoding (std::ostream& compressed_tree_data_out_arg);
237 entropyDecoding (std::istream& compressed_tree_data_in_arg);
244 serializeTreeCallback (LeafT &leaf_arg,
const OctreeKey& key_arg)
override;
251 deserializeTreeCallback (LeafT&,
const OctreeKey& key_arg)
override;
308 template<
typename Po
intT,
typename LeafT,
typename BranchT,
typename OctreeT>
PointCloud represents the base class in PCL for storing collections of 3D points.
StaticRangeCoder compression class
Octree pointcloud compression class
std::uint64_t compressed_point_data_len_
std::size_t object_count_
shared_ptr< OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeT > > Ptr
std::uint64_t point_count_
ColorCoding< PointT > color_coder_
Color coding instance.
const compression_Profiles_e selected_profile_
static const char * frame_header_identifier_
void addPointIdx(const int pointIdx_arg) override
Add point at index from input pointcloud dataset to octree.
std::vector< unsigned int >::const_iterator point_count_data_vector_iterator_
Iterator on points per voxel vector.
PointCoding< PointT > point_coder_
Point coding instance.
typename OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloud PointCloud
std::vector< char > binary_color_tree_vector_
Iterator on binary tree structure vector.
typename OctreeT::LeafNode LeafNode
StaticRangeCoder entropy_coder_
Static range coder instance.
typename OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloudConstPtr PointCloudConstPtr
void setOutputCloud(const PointCloudPtr &cloud_arg)
Provide a pointer to the output data set.
const double point_resolution_
PointCloudPtr getOutputCloud() const
Get a pointer to the output point cloud dataset.
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.
std::vector< char > binary_tree_data_vector_
Vector for storing binary tree structure.
const unsigned char color_bit_resolution_
void initialization()
Initialize globals.
std::uint64_t compressed_color_data_len_
std::uint32_t i_frame_counter_
shared_ptr< const OctreePointCloudCompression< PointT, LeafT, BranchT, OctreeT > > ConstPtr
PointCloudPtr output_
Pointer to output point cloud dataset.
std::vector< unsigned int > point_count_data_vector_
Vector for storing points per voxel information
std::uint32_t i_frame_rate_
bool do_voxel_grid_enDecoding_
unsigned char point_color_offset_
typename OctreePointCloud< PointT, LeafT, BranchT, OctreeT >::PointCloudPtr PointCloudPtr
const double octree_resolution_
~OctreePointCloudCompression()
Empty deconstructor.
typename OctreeT::BranchNode BranchNode
Octree double buffer class
Octree container class that does not store any information.
Octree container class that does store a vector of point indices.
Abstract octree leaf class
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
virtual void addPointIdx(const int point_idx_arg)
Add point at index from input pointcloud dataset to octree.
Define standard C methods and C++ classes that are common to all methods.
const struct configurationProfile_t compressionProfiles_[COMPRESSION_PROFILE_COUNT]
A point structure representing Euclidean xyz coordinates, and the RGB color.
bool doVoxelGridDownSampling
const double octreeResolution
const unsigned char colorBitResolution