forked from alibaba/yalantinglibs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
114 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "zpointcloud.hpp" | ||
|
||
#include <pcl/compression/octree_pointcloud_compression.h> | ||
#include <pcl/octree/octree_pointcloud.h> | ||
|
||
#include <pcl/io/impl/octree_pointcloud_compression.hpp> | ||
#include <pcl/octree/impl/octree_pointcloud.hpp> | ||
|
||
namespace converter { | ||
// StructToClass declaration | ||
|
||
// static pcl::io::OctreePointCloudCompression<pcl::PointXYZIT> s_compress( | ||
// {pcl::io::compression_Profiles_e::MED_RES_ONLINE_COMPRESSION_WITH_COLOR}, true); | ||
static pcl::io::OctreePointCloudCompression<pcl::PointXYZIT> s_compress; | ||
|
||
::inner_class::ZPointCloudXYZIT StructToClass(inner_struct::sp_cZPointCloudXYZIT const& in) { | ||
::inner_class::ZPointCloudXYZIT result; | ||
*result.mutable_header() = StructToClass(*(std::shared_ptr<inner_struct::ZFrame const>)in); | ||
// 压缩点云 | ||
std::stringstream compressed_pcl_pointcloud; | ||
s_compress.encodePointCloud(in, compressed_pcl_pointcloud); | ||
result.set_pcl_compressed_pc(compressed_pcl_pointcloud.str()); | ||
// std::cout <<" compress size = " << compressed_pcl_pointcloud.str().size() <<"\n"; | ||
return result; | ||
} | ||
|
||
// ClassToStruct declaration | ||
inner_struct::spZPointCloudXYZIT ClassToStruct(::inner_class::ZPointCloudXYZIT const& in) { | ||
::inner_struct::spZPointCloudXYZIT result = std::make_shared<inner_struct::ZPointCloudXYZIT>(); | ||
pcl::PointCloud<pcl::PointXYZIT>::Ptr pc_result = result; // stupid code , need solve | ||
*(std::shared_ptr<::inner_struct::ZFrame>)result = ClassToStruct(in.header()); | ||
// 解压点云 | ||
std::stringstream compressed_pcl_pointcloud(in.pcl_compressed_pc()); | ||
s_compress.decodePointCloud(compressed_pcl_pointcloud, pc_result); | ||
|
||
return result; | ||
} | ||
|
||
} // namespace converter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
#include <pcl/point_cloud.h> | ||
|
||
#include "base.struct_pb.h" | ||
#include "pointcloud.pb.h" | ||
#include "xyzit_points.hpp" | ||
|
||
// save to file | ||
#include <pcl/io/pcd_io.h> | ||
#include <pcl/io/impl/pcd_io.hpp> | ||
|
||
namespace inner_struct { | ||
|
||
template <typename _PointType> | ||
struct ZPointCloud : public ZFrame, public pcl::PointCloud<_PointType> { | ||
|
||
}; | ||
|
||
using ZPointCloudXYZIT = ::inner_struct::ZPointCloud<pcl::PointXYZIT>; | ||
using spZPointCloudXYZIT = std::shared_ptr<::inner_struct::ZPointCloudXYZIT>; | ||
using sp_cZPointCloudXYZIT = std::shared_ptr<::inner_struct::ZPointCloudXYZIT const>; | ||
|
||
|
||
template <typename _PointType> | ||
inline std::ostream& operator<<(std::ostream& os,::inner_struct::ZPointCloud<_PointType> const& in) | ||
{ | ||
os << (ZFrame&)in << std::endl; | ||
os << (pcl::PointCloud<_PointType>&)in << std::endl; | ||
return os; | ||
} | ||
|
||
} // namespace inner_struct | ||
|
||
|
||
namespace converter { | ||
// StructToClass declaration | ||
|
||
::inner_class::ZPointCloudXYZIT StructToClass(inner_struct::sp_cZPointCloudXYZIT const& in); | ||
// enum | ||
|
||
// ClassToStruct declaration | ||
::inner_struct::spZPointCloudXYZIT ClassToStruct(::inner_class::ZPointCloudXYZIT const& in); | ||
|
||
} // namespace converter |