54 #ifdef LVR2_USE_RIVLIB 58 #include <boost/filesystem.hpp> 71 boost::filesystem::path selectedFile( filename );
72 std::string extension = selectedFile.extension().string();
76 if(extension ==
".ply")
80 else if(extension ==
".pts" || extension ==
".3d" || extension ==
".xyz" || extension ==
".txt")
84 #ifdef LVR2_USE_RIVLIB 85 else if(extension ==
".rxp")
90 else if (extension ==
".obj")
94 else if (extension ==
".las")
98 else if (extension ==
".dat")
102 else if (extension ==
".h5")
107 else if (extension ==
".pcd")
112 else if (extension ==
"")
114 bool found_3d =
false;
115 bool found_boctree =
false;
118 boost::filesystem::directory_iterator lastFile;
120 for(boost::filesystem::directory_iterator it(filename); it != lastFile; it++ )
122 boost::filesystem::path
p = it->path();
125 if(p.extension().string() ==
".3d")
129 if(sscanf(p.filename().string().c_str(),
"scan%3d", &num))
136 if(p.extension().string() ==
".oct")
140 if(sscanf(p.filename().string().c_str(),
"scan%3d", &num))
142 found_boctree =
true;
150 if(!found_boctree && found_3d)
154 else if(found_boctree && found_3d)
156 cout <<
timestamp <<
"Found 3d files and octrees. Loading octrees per default." << endl;
159 else if(found_boctree && !found_3d)
165 cout <<
timestamp <<
"Given directory does not contain " << endl;
172 m = io->
read( filename );
178 size_t n_points = points->numPoints();
179 size_t n_normals = 0;
183 floatArr n = points->getFloatArray(
"normals", n_normals, dummy);
188 assert(n_normals == n_points);
195 for(
size_t i = 0; i < n_points; i++)
203 p[3 * i + 1] = point[1];
204 p[3 * i + 2] = point[2];
211 n[3 * i] = normal[0];
212 n[3 * i + 1] = normal[1];
213 n[3 * i + 2] = normal[2];
228 boost::filesystem::path selectedFile(filename);
229 std::string extension = selectedFile.extension().string();
234 if(extension ==
".ply")
238 else if (extension ==
".pts" || extension ==
".3d" || extension ==
".xyz" || extension ==
".txt")
242 else if ( extension ==
".obj" )
246 else if (extension ==
".stl")
250 else if (extension ==
".h5")
255 else if (extension ==
".pcd")
264 io->
save( m, filename );
269 cout <<
timestamp <<
"File format " << extension
270 <<
" is currently not supported." << endl;
A class for input and output to ply files.
Interface class to read laser scan data in .las-Format.
static CoordinateTransform< float > m_transform
IO-Class to import compressed octrees from slam6d.
static Timestamp timestamp
A global time stamp object for program runtime measurement.
I/O support for PLY files.
static ModelPtr readModel(std::string filename)
std::shared_ptr< PointBuffer > PointBufferPtr
Read and write pointclouds from .pts and .3d files.
Interface specification for low-level io. All read elements are stored in linear arrays.
A import / export class for point cloud data in the PointCloudLibrary file format.
A import / export class for point cloud data in plain text formats. Currently the file extensions ...
BaseHDF5IO::AddFeatures< lvr2::hdf5features::ScanProjectIO, lvr2::hdf5features::ArrayIO > HDF5IO
boost::shared_array< float > floatArr
virtual ModelPtr read(std::string filename)=0
Parse the given file and load supported elements.
std::shared_ptr< Model > ModelPtr
An input class for laser scans in UOS 3d format.
virtual void save(std::string filename)=0
Save the loaded elements to the given file.
A basic implementation of the obj file format.
IO class for binary laser scans.
Read and write point clouds from PCD files.
static void saveModel(ModelPtr m, std::string file)