Program Listing for File IOUtils.hpp

Return to documentation for file (include/lvr2/util/IOUtils.hpp)

#ifndef IOUTILS_HPP
#define IOUTILS_HPP

#include "lvr2/types/Model.hpp"
#include "lvr2/types/MatrixTypes.hpp"
#include "lvr2/types/ScanTypes.hpp"
#include "lvr2/util/TransformUtils.hpp"
#include "lvr2/util/CoordinateTransform.hpp"
#include "lvr2/util/Timestamp.hpp"

#include <boost/filesystem.hpp>

#include <Eigen/Dense>

#include <fstream>
#include <vector>

namespace lvr2
{


void getPoseFromFile(BaseVector<float>& position, BaseVector<float>& angles, const boost::filesystem::path file);

void transformPointCloudAndAppend(PointBufferPtr& buffer,
        boost::filesystem::path& transfromFile,
        std::vector<float>& pts,
        std::vector<float>& nrm);


template<typename T>
Transform<T> getTransformationFromFile(const boost::filesystem::path& file);

template<typename T>
Transform<T> getTransformationFromFrames(const boost::filesystem::path& frames);

template<typename T>
Transform<T> getTransformationFromPose(const boost::filesystem::path& pose);

template<typename T>
Transform<T> getTransformationFromDat(const boost::filesystem::path& frames);

template<typename T>
Transform<T> loadFromFile(const boost::filesystem::path& file);


size_t countPointsInFile(const boost::filesystem::path& inFile);

template<typename T>
void writeFrame(const Transform<T>& transform, const boost::filesystem::path& framesOut);

template<typename T>
void writePose(const BaseVector<T>& position, const BaseVector<T>& angles, const boost::filesystem::path& out);

template<typename T>
void writePose(const Vector3<T>& position, const Vector3<T>& angles, const boost::filesystem::path& out);

template<typename T>
void writePose(const Transform<T>& transform, const boost::filesystem::path& poseOut);

size_t writeModel( ModelPtr model, const  boost::filesystem::path& outfile);



size_t getReductionFactor(ModelPtr model, size_t targetSize);

size_t getReductionFactor(boost::filesystem::path& inFile, size_t targetSize);

void writePointsAndNormals(std::vector<float>& p, std::vector<float>& n, std::string outfile);

size_t writePointsToStream(ModelPtr model, std::ofstream& out, bool nocolor = false);

size_t getNumberOfPointsInPLY(const std::string& filename);

PointBufferPtr subSamplePointBuffer(PointBufferPtr src, const size_t& n);


PointBufferPtr subSamplePointBuffer(PointBufferPtr src, const std::vector<size_t>& indices);

void slamToLVRInPlace(PointBufferPtr src);

void parseSLAMDirectory(std::string dir, vector<ScanPtr>& scans);

} // namespace lvr2

#include "IOUtils.tcc"

#endif // IOUTILS_HPP