40#ifndef PCL_IO_AUTO_IO_IMPL_H_
41#define PCL_IO_AUTO_IO_IMPL_H_
43#include <pcl/common/pcl_filesystem.h>
45#include <pcl/io/obj_io.h>
46#include <pcl/io/pcd_io.h>
47#include <pcl/io/ply_io.h>
48#include <pcl/io/ifs_io.h>
54 template<
typename Po
intT>
int
57 pcl_fs::path p (file_name.c_str ());
58 std::string extension = p.extension ().string ();
60 if (extension ==
".pcd")
61 result = pcl::io::loadPCDFile (file_name, cloud);
62 else if (extension ==
".ply")
63 result = pcl::io::loadPLYFile (file_name, cloud);
64 else if (extension ==
".ifs")
66 else if (extension ==
".obj")
67 result = pcl::io::loadOBJFile (file_name, cloud);
70 PCL_ERROR (
"[pcl::io::load] Don't know how to handle file with extension %s\n", extension.c_str ());
76 template<
typename Po
intT>
int
79 pcl_fs::path p (file_name.c_str ());
80 std::string extension = p.extension ().string ();
82 if (extension ==
".pcd")
83 result = pcl::io::savePCDFile (file_name, cloud,
true);
84 else if (extension ==
".ply")
85 result = pcl::io::savePLYFile (file_name, cloud,
true);
86 else if (extension ==
".ifs")
90 PCL_ERROR (
"[pcl::io::save] Don't know how to handle file with extension %s\n", extension.c_str ());
PointCloud represents the base class in PCL for storing collections of 3D points.
int loadIFSFile(const std::string &file_name, pcl::PCLPointCloud2 &cloud)
Load an IFS file into a PCLPointCloud2 blob type.
int saveIFSFile(const std::string &file_name, const pcl::PCLPointCloud2 &cloud)
Save point cloud data to an IFS file containing 3D points.
PCL_EXPORTS int load(const std::string &file_name, pcl::PCLPointCloud2 &blob)
Load a file into a PointCloud2 according to extension.
PCL_EXPORTS int save(const std::string &file_name, const pcl::PCLPointCloud2 &blob, unsigned precision=5)
Save point cloud data to a binary file when available else to ASCII.