cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
toolbox::io Namespace Reference

< 用于列出目录下的文件/For listing files in a directory More...

Classes

class  base_file_data_t
 文件数据的基类 / Base class for data loaded from files More...
 
class  base_file_format_t
 文件格式读写器的基类 / Base class for file format readers/writers More...
 
class  dataloader_t
 通用数据加载器/Generic data loader More...
 
class  dataset_t
 数据集基类/Abstract base class for datasets More...
 
class  kitti_format_t
 KITTI 点云数据(.bin)文件格式处理器。/File format handler for KITTI Point Cloud Data (.bin) files. More...
 
class  kitti_pcd_dataset_t
 KITTI点云数据集类/KITTI point cloud dataset class. More...
 
class  kitti_pcd_pair_t
 KITTI点云对数据集类/KITTI point cloud pair dataset class. More...
 
class  pcd_format_t
 点云数据(.pcd)文件格式处理器。/File format handler for Point Cloud Data (.pcd) files. More...
 
class  sampler_t
 通用采样器/Generic sampler More...
 
struct  sequential_policy_t
 顺序采样策略/Sequential sampling policy More...
 
class  shuffle_policy_t
 随机打乱采样策略/Shuffle sampling policy More...
 

Functions

template<typename T >
CPP_TOOLBOX_EXPORT std::unique_ptr< toolbox::types::point_cloud_t< T > > read_point_cloud (const std::string &path)
 
template<typename T >
CPP_TOOLBOX_EXPORT bool write_point_cloud (const std::string &path, const toolbox::types::point_cloud_t< T > &cloud)
 
template<typename T >
CPP_TOOLBOX_EXPORT std::unique_ptr< toolbox::types::point_cloud_t< T > > read_kitti_bin (const std::string &path)
 从文件中读取 KITTI 点云数据的独立函数。/Standalone function to read KITTI point cloud data from a file.
 
template<typename T >
CPP_TOOLBOX_EXPORT bool write_kitti_bin (const std::string &path, const toolbox::types::point_cloud_t< T > &cloud)
 将点云数据写入 KITTI 点云文件的独立函数。/Standalone function to write point cloud data to a KITTI point cloud file.
 
template<typename T >
CPP_TOOLBOX_EXPORT std::unique_ptr< toolbox::types::point_cloud_t< T > > read_pcd (const std::string &path)
 从文件中读取 PCD 点云数据的独立函数。/Standalone function to read PCD point cloud data from a file.
 
template<typename T >
CPP_TOOLBOX_EXPORT bool write_pcd (const std::string &path, const toolbox::types::point_cloud_t< T > &cloud, bool binary)
 将点云数据写入 PCD 文件的独立函数。/Standalone function to write point cloud data to a PCD file.
 

Detailed Description

< 用于列出目录下的文件/For listing files in a directory

< 用于读取KITTI点云/For reading KITTI

Function Documentation

◆ read_kitti_bin()

template<typename T >
CPP_TOOLBOX_EXPORT std::unique_ptr< toolbox::types::point_cloud_t< T > > toolbox::io::read_kitti_bin ( const std::string &  path)

从文件中读取 KITTI 点云数据的独立函数。/Standalone function to read KITTI point cloud data from a file.

Template Parameters
T点云数据的存储类型(如 float 或 double)/Storage type for the point cloud data (e.g., float or double)
Parameters
pathKITTI 点云文件的路径/Path to the KITTI point cloud file
Returns
包含读取点云的唯一指针,如果读取失败则返回 nullptr/Unique pointer containing the read point cloud, or nullptr if reading fails
// 读取 float 类型的点云/Read a point cloud with float precision
auto cloud_float = toolbox::io::read_kitti_bin<float>("cloud.bin");
if (cloud_float) {
std::cout << "读取了 " << cloud_float->size() << " 个点/Read " <<
cloud_float->size() << " points" << std::endl;
}
// 读取 double 类型的点云/Read a point cloud with double precision
auto cloud_double =
toolbox::io::read_kitti_bin<double>("cloud.bin");

◆ read_pcd()

template<typename T >
CPP_TOOLBOX_EXPORT std::unique_ptr< toolbox::types::point_cloud_t< T > > toolbox::io::read_pcd ( const std::string &  path)

从文件中读取 PCD 点云数据的独立函数。/Standalone function to read PCD point cloud data from a file.

Template Parameters
T点云数据的存储类型(如 float 或 double)/Storage type for the point cloud data (e.g., float or double)
Parameters
pathPCD 文件的路径/Path to the PCD file
Returns
包含读取点云的唯一指针,如果读取失败则返回 nullptr/Unique pointer containing the read point cloud, or nullptr if reading fails
// 读取 float 类型的点云/Read a point cloud with float precision
auto cloud_float = toolbox::io::read_pcd<float>("cloud.pcd");
if (cloud_float) {
std::cout << "读取了 " << cloud_float->size() << " 个点/Read " <<
cloud_float->size() << " points" << std::endl;
}
// 读取 double 类型的点云/Read a point cloud with double precision
auto cloud_double = toolbox::io::read_pcd<double>("cloud.pcd");

◆ read_point_cloud()

template<typename T >
CPP_TOOLBOX_EXPORT std::unique_ptr< toolbox::types::point_cloud_t< T > > toolbox::io::read_point_cloud ( const std::string &  path)

◆ write_kitti_bin()

template<typename T >
CPP_TOOLBOX_EXPORT bool toolbox::io::write_kitti_bin ( const std::string &  path,
const toolbox::types::point_cloud_t< T > &  cloud 
)

将点云数据写入 KITTI 点云文件的独立函数。/Standalone function to write point cloud data to a KITTI point cloud file.

Template Parameters
T点云数据的存储类型(如 float 或 double)/Storage type for the point cloud data (e.g., float or double)
Parameters
path要写入的 KITTI 点云文件路径/Path to the KITTI point cloud file to write
cloud要保存的点云数据/The point cloud data to save
Returns
写入成功返回 true,失败返回 false/Returns true if writing was successful, false otherwise
// 创建一个点云并添加一些点/Create a point cloud and add some points
cloud.points = {{1.0f, 2.0f, 3.0f}, {4.0f, 5.0f, 6.0f}};
// 以二进制格式保存/Save in binary format
bool binary_success =
toolbox::io::write_kitti_bin("cloud_binary.bin", cloud);
包含点和相关数据的点云类 / A point cloud class containing points and associated data
Definition point.hpp:268
std::vector< point_t< T > > points
点坐标 / Point coordinates
Definition point.hpp:270
CPP_TOOLBOX_EXPORT bool write_kitti_bin(const std::string &path, const toolbox::types::point_cloud_t< T > &cloud)
将点云数据写入 KITTI 点云文件的独立函数。/Standalone function to write point cloud data to a KITTI point cloud file.
Definition kitti_impl.hpp:258

◆ write_pcd()

template<typename T >
CPP_TOOLBOX_EXPORT bool toolbox::io::write_pcd ( const std::string &  path,
const toolbox::types::point_cloud_t< T > &  cloud,
bool  binary 
)

将点云数据写入 PCD 文件的独立函数。/Standalone function to write point cloud data to a PCD file.

Template Parameters
T点云数据的存储类型(如 float 或 double)/Storage type for the point cloud data (e.g., float or double)
Parameters
path要写入的 PCD 文件路径/Path to the PCD file to write
cloud要保存的点云数据/The point cloud data to save
binary如果为 true,则以二进制格式写入;如果为 false,则以 ASCII 格式写入/If true, writes in binary format; if false, writes in ASCII format
Returns
写入成功返回 true,失败返回 false/Returns true if writing was successful, false otherwise
// 创建一个点云并添加一些点/Create a point cloud and add some points
cloud.points = {{1.0f, 2.0f, 3.0f}, {4.0f, 5.0f, 6.0f}};
// 以 ASCII 格式保存/Save in ASCII format
bool ascii_success = toolbox::io::write_pcd("cloud_ascii.pcd",
cloud, false);
// 以二进制格式保存/Save in binary format
bool binary_success = toolbox::io::write_pcd("cloud_binary.pcd",
cloud, true);
CPP_TOOLBOX_EXPORT bool write_pcd(const std::string &path, const toolbox::types::point_cloud_t< T > &cloud, bool binary)
将点云数据写入 PCD 文件的独立函数。/Standalone function to write point cloud data to a PCD file.
Definition pcd_impl.hpp:833

◆ write_point_cloud()

template<typename T >
CPP_TOOLBOX_EXPORT bool toolbox::io::write_point_cloud ( const std::string &  path,
const toolbox::types::point_cloud_t< T > &  cloud 
)