#include<pcl/point_cloud.h>
#include<pcl/point_types.h>
#include<pcl/visualization/pcl_visualizer.h> //cout endl
#include <pcl/common/file_io.h>
typedef pcl::PointXYZ PointT;
int main()
{
//(1)查找目录下所有 *.pcd 文件并排序返回
//void pcl::getAllPcdFilesInDirectory(const std::string &directory, std::vector< std::string > &file_names)
std::vector<std::string> file_names;
pcl::getAllPcdFilesInDirectory("./", file_names);
//(2)从给定字符串中删除路径,只返回文件名(后面的剩余字符串最后一个'/')
//std::string pcl::getFilenameWithoutPath(const std::string &input)
std::string path = "D://source//PLC_TestDemo_PalletHole_V1.0_new//bunny.pcd";
std::string newPath = pcl::getFilenameWithoutPath(path);
//(3)从给定字符串中删除扩展名并仅返回文件名(最后一个'.'之前的所有内容)
//std::string pcl::getFilenameWithoutExtension (const std::string &input)
std::string newPathWithoutExtension = pcl::getFilenameWithoutExtension(newPath);
//(4)从给定的字符串中获取文件扩展名(最后一个'.'之后的剩余字符串)
//std::string pcl::getFileExtension (const std::string &input)
std::string newFileExtension = pcl::getFileExtension(path);
system("pause");
return 0;
}
参考文章:
http://pointclouds.org/documentation/common_2include_2pcl_2common_2file__io_8h.html
http://pointclouds.org/documentation/common_2include_2pcl_2common_2file__io_8h_source.html
网友评论