编解码
PointCompress3D - 智能交通系统中用于路侧的激光雷达的点云压缩框架
20240325更新:
点云压缩/编解码技术:
G-PCC更适合用在存储空间有限且高保真度要求的情况下,Draco更能应对实时性要求高的任务;
MPEGGroup/mpeg-pcc-tmc13: Geometry based point cloud compression (G-PCC) test model (github.com)
RobotWebTools/depthcloud_encoder: Point Cloud Encoder for Web-Based Streaming (github.com)
发送端
Base64编码
接收端
TCP:
谷歌魔镜:WEB-RTC(todo)
视频推流(todo)
ROS的点云传输路线:
发送
sensor_msgs::PointCloud2 msg; //<sensor_msgs/PointCloud2.h>
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PCLPointCloud2 pcl_pc2;
pcl::toPCLPointCloud2(*cloud, pcl_pc2); //<pcl/PCLPointCloud2.h>,pcl库里的
//https://github.com/ros-perception/perception_pcl/blob/ros2/pcl_conversions/include/pcl_conversions/pcl_conversions.h
pcl_conversions::fromPCL(pcl_pc2, msg);
// publish
pub.publish(msg);
其中转换二进制点云是pcl::toPCLPointCloud2
/** \brief Convert a pcl::PointCloud<T> object to a PCLPointCloud2 binary data blob.
* \param[in] cloud the input pcl::PointCloud<T>
* \param[out] msg the resultant PCLPointCloud2 binary blob
*/
template<typename PointT> void
toPCLPointCloud2 (const pcl::PointCloud<PointT>& cloud, pcl::PCLPointCloud2& msg)
{
// Ease the user's burden on specifying width/height for unorganized datasets
if (cloud.width == 0 && cloud.height == 0)
{
msg.width = static_cast<std::uint32_t>(cloud.points.size ());
msg.height = 1;
}
else
{
assert (cloud.points.size () == cloud.width * cloud.height);
msg.height = cloud.height;
msg.width = cloud.width;
}
// Fill point cloud binary data (padding and all)
std::size_t data_size = sizeof (PointT) * cloud.points.size ();
msg.data.resize (data_size);
if (data_size)
{
memcpy(&msg.data[0], &cloud.points[0], data_size);
}
// Fill fields metadata
msg.fields.clear ();
for_each_type<typename traits::fieldList<PointT>::type> (detail::FieldAdder<PointT>(msg.fields));
msg.header = cloud.header;
msg.point_step = sizeof (PointT);
msg.row_step = static_cast<std::uint32_t> (sizeof (PointT) * msg.width);
msg.is_dense = cloud.is_dense;
/// @todo msg.is_bigendian = ?;
}
接收
sensor_msgs::PointCloud2ConstPtr &cloud;
pcl::PointCloud<pcl::PointXYZ>::Ptr temp_cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PCLPointCloud2 pcl_pc2;
pcl_conversions::toPCL(*cloud, pcl_pc2);
pcl::fromPCLPointCloud2(pcl_pc2, *temp_cloud);
数据类型
深度图
深度用uint16_t,像素用uint8_t
点云转极坐标系
为什么点云的size是这么算的?