Addapted PointCloud to both Lidars
This commit is contained in:
parent
e93f9d328d
commit
4f2fec1f64
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "carla/pointcloud/PointCloudIO.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
namespace carla {
|
||||
namespace pointcloud {
|
||||
|
||||
void PointCloudIO::WriteHeader(std::ostream &out, size_t number_of_points) {
|
||||
out << "ply\n"
|
||||
"format ascii 1.0\n"
|
||||
"element vertex " << std::to_string(number_of_points) << "\n"
|
||||
"property float32 x\n"
|
||||
"property float32 y\n"
|
||||
"property float32 z\n"
|
||||
"property float32 I\n"
|
||||
// "property uchar diffuse_red\n"
|
||||
// "property uchar diffuse_green\n"
|
||||
// "property uchar diffuse_blue\n"
|
||||
"end_header\n";
|
||||
out << std::fixed << std::setprecision(4u);
|
||||
}
|
||||
|
||||
} // namespace pointcloud
|
||||
} // namespace carla
|
|
@ -10,19 +10,20 @@
|
|||
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
|
||||
namespace carla {
|
||||
namespace pointcloud {
|
||||
|
||||
class PointCloudIO {
|
||||
public:
|
||||
|
||||
public:
|
||||
template <typename PointIt>
|
||||
static void Dump(std::ostream &out, PointIt begin, PointIt end) {
|
||||
DEBUG_ASSERT(std::distance(begin, end) >= 0);
|
||||
WriteHeader(out, static_cast<size_t>(std::distance(begin, end)));
|
||||
WriteHeader(out, begin, end);
|
||||
for (; begin != end; ++begin) {
|
||||
out << begin->point.x << ' ' << begin->point.y << ' ' << begin->point.z << ' ' << begin->intensity << '\n';
|
||||
begin->WriteDetection(out);
|
||||
out << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +36,15 @@ namespace pointcloud {
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
static void WriteHeader(std::ostream &out, size_t number_of_points);
|
||||
template <typename PointIt> static void WriteHeader(std::ostream &out, PointIt begin, PointIt end) {
|
||||
DEBUG_ASSERT(std::distance(begin, end) >= 0);
|
||||
out << "ply\n"
|
||||
"format ascii 1.0\n"
|
||||
"element vertex " << std::to_string(static_cast<size_t>(std::distance(begin, end))) << "\n";
|
||||
begin->WritePlyHeaderInfo(out);
|
||||
out << "end_header\n";
|
||||
out << std::fixed << std::setprecision(4u);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace pointcloud
|
||||
|
|
Loading…
Reference in New Issue