38#ifndef ORGANIZED_COMPRESSION_HPP
39#define ORGANIZED_COMPRESSION_HPP
41#include <pcl/compression/organized_pointcloud_compression.h>
44#include <pcl/point_cloud.h>
46#include <pcl/compression/libpng_wrapper.h>
47#include <pcl/compression/organized_pointcloud_conversion.h>
57 template<
typename Po
intT>
void
137 PCL_INFO(
"*** POINTCLOUD ENCODING ***\n");
138 PCL_INFO(
"Number of encoded points: %ld\n",
pointCount);
141 PCL_INFO(
"Total bytes per point: %.4f bytes\n",
static_cast<float> (bytesPerPoint));
151 template<
typename Po
intT>
void
157 bool doColorEncoding,
200 for (std::size_t i = 0; i < cloud_size; ++i, ++
depth_ptr,
color_ptr +=
sizeof(std::uint8_t) * 3)
226 for (std::size_t i = 0; i < size; ++i)
253 PCL_INFO(
"*** POINTCLOUD ENCODING ***\n");
254 PCL_INFO(
"Number of encoded points: %ld\n",
pointCount);
255 PCL_INFO(
"Size of uncompressed disparity map+color image: %.2f kBytes\n", (
static_cast<float> (
pointCount) * (
sizeof(std::uint8_t)*3+
sizeof(std::uint16_t))) / 1024.0f);
257 PCL_INFO(
"Total bytes per point: %.4f bytes\n",
static_cast<float> (bytesPerPoint));
258 PCL_INFO(
"Total compression percentage: %.4f%%\n", (bytesPerPoint) / (
sizeof(std::uint8_t)*3+
sizeof(std::uint16_t)) * 100.0f);
267 template<
typename Po
intT>
bool
359 if (!sd_converter_.isInitialized())
360 sd_converter_.generateLookupTable();
363 for (std::size_t i=0; i<size; ++i)
381 PCL_INFO(
"*** POINTCLOUD DECODING ***\n");
382 PCL_INFO(
"Number of encoded points: %ld\n",
pointCount);
385 PCL_INFO(
"Total bytes per point: %.4f bytes\n",
static_cast<float> (bytesPerPoint));
394 template<
typename Po
intT>
void
403 int centerX =
static_cast<int> (width / 2);
404 int centerY =
static_cast<int> (height / 2);
407 assert((width>1) && (height>1));
417 const PointT& point = (*cloud_arg)[
it++];
421 if (maxDepth < point.z)
427 focalLength = 2.0f / (point.x / (
static_cast<float> (x) * point.z) + point.y / (
static_cast<float> (y) * point.z));
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
typename PointCloud::Ptr PointCloudPtr
void encodePointCloud(const PointCloudConstPtr &cloud_arg, std::ostream &compressedDataOut_arg, bool doColorEncoding=false, bool convertToMono=false, bool bShowStatistics_arg=true, int pngLevel_arg=-1)
Encode point cloud to output stream.
bool decodePointCloud(std::istream &compressedDataIn_arg, PointCloudPtr &cloud_arg, bool bShowStatistics_arg=true)
Decode point cloud from input stream.
void analyzeOrganizedCloud(PointCloudConstPtr cloud_arg, float &maxDepth_arg, float &focalLength_arg) const
Analyze input point cloud and calculate the maximum depth and focal length.
typename PointCloud::ConstPtr PointCloudConstPtr
void encodeRawDisparityMapWithColorImage(std::vector< std::uint16_t > &disparityMap_arg, std::vector< std::uint8_t > &colorImage_arg, std::uint32_t width_arg, std::uint32_t height_arg, std::ostream &compressedDataOut_arg, bool doColorEncoding=false, bool convertToMono=false, bool bShowStatistics_arg=true, int pngLevel_arg=-1, float focalLength_arg=525.0f, float disparityShift_arg=174.825f, float disparityScale_arg=-0.161175f)
Encode raw disparity map and color image.
PCL_EXPORTS void decodePNGToImage(std::vector< std::uint8_t > &pngData_arg, std::vector< std::uint8_t > &imageData_arg, std::size_t &width_arg, std::size_t &heigh_argt, unsigned int &channels_arg)
Decode compressed PNG to 8-bit image.
PCL_EXPORTS void encodeRGBImageToPNG(std::vector< std::uint8_t > &image_arg, std::size_t width_arg, std::size_t height_arg, std::vector< std::uint8_t > &pngData_arg, int png_level_arg=-1)
Encodes 8-bit RGB image to PNG format.
PCL_EXPORTS void encodeMonoImageToPNG(std::vector< std::uint8_t > &image_arg, std::size_t width_arg, std::size_t height_arg, std::vector< std::uint8_t > &pngData_arg, int png_level_arg=-1)
Encodes 8-bit mono image to PNG format.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
Defines all the PCL and non-PCL macros used.
A point structure representing Euclidean xyz coordinates, and the RGB color.