13 #include <liblas/liblas.hpp>    14 #include <liblas/reader.hpp>    15 #include <liblas/writer.hpp>    64 template <
class POINTSMAP>
    66     const POINTSMAP& ptmap, 
const std::string& filename,
    74         std::cerr << 
"[saveLASFile] Couldn't write to file: " << filename
    82     const size_t nPts = ptmap.size();
    84     header.SetPointRecordsCount(nPts);
    88     liblas::Writer writer(ofs, 
header);
    90     const bool has_color = ptmap.hasColorPoints();
    91     const float col_fract = 255.0f;
    95     for (
size_t i = 0; i < nPts; i++)
    97         float x, y, z, 
R, 
G, B;
    98         ptmap.getPoint(i, x, y, z, 
R, 
G, B);
   106             col.SetRed(static_cast<uint16_t>(
R * col_fract));
   107             col.SetGreen(static_cast<uint16_t>(
G * col_fract));
   108             col.SetBlue(static_cast<uint16_t>(B * col_fract));
   112         if (!writer.WritePoint(pt))
   114             std::cerr << 
"[saveLASFile] liblas returned error writing point #"   115                       << i << 
" to file.\n";
   127 template <
class POINTSMAP>
   129     POINTSMAP& ptmap, 
const std::string& filename,
   137     ifs.open(filename.c_str(), std::ios::in | std::ios::binary);
   141         std::cerr << 
"[loadLASFile] Couldn't open file: " << filename
   148     liblas::Reader reader(ifs);
   152     liblas::Header 
const& 
header = reader.GetHeader();
   153     const size_t nPts = 
header.GetPointRecordsCount();
   159 #if LIBLAS_VERSION_NUM < 1800   163         boost::lexical_cast<std::string>(
header.GetProjectId());
   171     const bool has_color = ptmap.hasColorPoints();
   172     const float col_fract = 1.0f / 255.0f;
   173     while (reader.ReadNextPoint())
   175         liblas::Point 
const& p = reader.GetPoint();
   179             liblas::Color 
const& col = p.GetColor();
   180             ptmap.insertPointRGB(
   181                 p.GetX(), p.GetY(), p.GetZ(), col.GetRed() * col_fract,
   182                 col.GetGreen() * col_fract, col.GetBlue() * col_fract);
   186             ptmap.insertPoint(p.GetX(), p.GetY(), p.GetZ());
   190     if (ptmap.size() != nPts)
   191         cerr << 
"[loadLASFile] Header says point count is " << nPts
   192              << 
" but only " << ptmap.size() << 
" were really parsed in.\n";
   194     ptmap.mark_as_modified();
 Optional settings for loadLASFile() 
 
mrpt::vision::TStereoCalibParams params
 
bool saveLASFile(const POINTSMAP &ptmap, const std::string &filename, const LAS_WriteParams ¶ms=LAS_WriteParams())
Save the point cloud as an ASPRS LAS binary file (requires MRPT built against liblas). 
 
nv_oem6_header_t header
Novatel frame: NV_OEM6_BESTPOS. 
 
bool loadLASFile(POINTSMAP &ptmap, const std::string &filename, LAS_HeaderInfo &out_headerInfo, const LAS_LoadParams ¶ms=LAS_LoadParams())
Load the point cloud from an ASPRS LAS binary file (requires MRPT built against liblas). 
 
Optional settings for saveLASFile() 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
mrpt::vision::TStereoCalibResults out