|
|
|
|
@@ -61,7 +61,7 @@ void PointsAlgos::Load(PointKernel &points, const char *FileName)
|
|
|
|
|
if (File.extension() == "asc" ||File.extension() == "ASC")
|
|
|
|
|
LoadAscii(points,FileName);
|
|
|
|
|
else
|
|
|
|
|
throw Base::Exception("Unknown ending");
|
|
|
|
|
throw Base::RuntimeError("Unknown ending");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PointsAlgos::LoadAscii(PointKernel &points, const char *FileName)
|
|
|
|
|
@@ -109,7 +109,7 @@ void PointsAlgos::LoadAscii(PointKernel &points, const char *FileName)
|
|
|
|
|
}
|
|
|
|
|
catch (...) {
|
|
|
|
|
points.clear();
|
|
|
|
|
throw Base::Exception("Reading in points failed.");
|
|
|
|
|
throw Base::BadFormatError("Reading in points failed.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// now remove the last points from the kernel
|
|
|
|
|
@@ -228,36 +228,36 @@ void PlyReader::read(const std::string& filename)
|
|
|
|
|
Eigen::Vector4f origin;
|
|
|
|
|
Eigen::Quaternionf orientation;
|
|
|
|
|
int ply_version;
|
|
|
|
|
int data_type;
|
|
|
|
|
unsigned int data_idx;
|
|
|
|
|
pcl::PLYReader ply;
|
|
|
|
|
ply.readHeader(filename, cloud2, origin, orientation, ply_version, data_type, data_idx);
|
|
|
|
|
|
|
|
|
|
bool hasIntensity = false;
|
|
|
|
|
bool hasColors = false;
|
|
|
|
|
bool hasNormals = false;
|
|
|
|
|
for (size_t i = 0; i < cloud2.fields.size (); ++i) {
|
|
|
|
|
if (cloud2.fields[i].name == "intensity")
|
|
|
|
|
hasIntensity = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_x" || cloud2.fields[i].name == "nx")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_y" || cloud2.fields[i].name == "ny")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_z" || cloud2.fields[i].name == "nz")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "red")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "green")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "blue")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgb")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgba")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
int data_type;
|
|
|
|
|
unsigned int data_idx;
|
|
|
|
|
pcl::PLYReader ply;
|
|
|
|
|
ply.readHeader(filename, cloud2, origin, orientation, ply_version, data_type, data_idx);
|
|
|
|
|
|
|
|
|
|
bool hasIntensity = false;
|
|
|
|
|
bool hasColors = false;
|
|
|
|
|
bool hasNormals = false;
|
|
|
|
|
for (size_t i = 0; i < cloud2.fields.size (); ++i) {
|
|
|
|
|
if (cloud2.fields[i].name == "intensity")
|
|
|
|
|
hasIntensity = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_x" || cloud2.fields[i].name == "nx")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_y" || cloud2.fields[i].name == "ny")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_z" || cloud2.fields[i].name == "nz")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "red")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "green")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "blue")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgb")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgba")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBNormal> cloud_in;
|
|
|
|
|
pcl::io::loadPLYFile<pcl::PointXYZRGBNormal>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -268,8 +268,8 @@ void PlyReader::read(const std::string& filename)
|
|
|
|
|
colors.push_back(App::Color(it->r/255.0f,it->g/255.0f,it->b/255.0f));
|
|
|
|
|
normals.push_back(Base::Vector3f(it->normal_x,it->normal_y,it->normal_z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZINormal> cloud_in;
|
|
|
|
|
pcl::io::loadPLYFile<pcl::PointXYZINormal>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -280,8 +280,8 @@ void PlyReader::read(const std::string& filename)
|
|
|
|
|
intensity.push_back(it->intensity);
|
|
|
|
|
normals.push_back(Base::Vector3f(it->normal_x,it->normal_y,it->normal_z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBA> cloud_in;
|
|
|
|
|
pcl::io::loadPLYFile<pcl::PointXYZRGBA>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -290,8 +290,8 @@ void PlyReader::read(const std::string& filename)
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
colors.push_back(App::Color(it->r/255.0f,it->g/255.0f,it->b/255.0f,it->a/255.0f));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZI> cloud_in;
|
|
|
|
|
pcl::io::loadPLYFile<pcl::PointXYZI>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -300,8 +300,8 @@ void PlyReader::read(const std::string& filename)
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
intensity.push_back(it->intensity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
pcl::PointCloud<pcl::PointNormal> cloud_in;
|
|
|
|
|
pcl::io::loadPLYFile<pcl::PointNormal>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -310,15 +310,15 @@ void PlyReader::read(const std::string& filename)
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
normals.push_back(Base::Vector3f(it->normal_x,it->normal_y,it->normal_z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZ> cloud_in;
|
|
|
|
|
pcl::io::loadPLYFile<pcl::PointXYZ>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
for (pcl::PointCloud<pcl::PointXYZ>::const_iterator it = cloud_in.begin();it!=cloud_in.end();++it) {
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
@@ -340,39 +340,39 @@ void PcdReader::read(const std::string& filename)
|
|
|
|
|
Eigen::Vector4f origin;
|
|
|
|
|
Eigen::Quaternionf orientation;
|
|
|
|
|
int ply_version;
|
|
|
|
|
int data_type;
|
|
|
|
|
unsigned int data_idx;
|
|
|
|
|
pcl::PCDReader pcd;
|
|
|
|
|
pcd.readHeader(filename, cloud2, origin, orientation, ply_version, data_type, data_idx);
|
|
|
|
|
|
|
|
|
|
bool hasIntensity = false;
|
|
|
|
|
bool hasColors = false;
|
|
|
|
|
bool hasNormals = false;
|
|
|
|
|
for (size_t i = 0; i < cloud2.fields.size (); ++i) {
|
|
|
|
|
if (cloud2.fields[i].name == "intensity")
|
|
|
|
|
hasIntensity = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_x" || cloud2.fields[i].name == "nx")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_y" || cloud2.fields[i].name == "ny")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_z" || cloud2.fields[i].name == "nz")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "red")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "green")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "blue")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgb")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgba")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
width = cloud2.width;
|
|
|
|
|
height = cloud2.height;
|
|
|
|
|
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
int data_type;
|
|
|
|
|
unsigned int data_idx;
|
|
|
|
|
pcl::PCDReader pcd;
|
|
|
|
|
pcd.readHeader(filename, cloud2, origin, orientation, ply_version, data_type, data_idx);
|
|
|
|
|
|
|
|
|
|
bool hasIntensity = false;
|
|
|
|
|
bool hasColors = false;
|
|
|
|
|
bool hasNormals = false;
|
|
|
|
|
for (size_t i = 0; i < cloud2.fields.size (); ++i) {
|
|
|
|
|
if (cloud2.fields[i].name == "intensity")
|
|
|
|
|
hasIntensity = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_x" || cloud2.fields[i].name == "nx")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_y" || cloud2.fields[i].name == "ny")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "normal_z" || cloud2.fields[i].name == "nz")
|
|
|
|
|
hasNormals = true;
|
|
|
|
|
if (cloud2.fields[i].name == "red")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "green")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "blue")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgb")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
if (cloud2.fields[i].name == "rgba")
|
|
|
|
|
hasColors = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
width = cloud2.width;
|
|
|
|
|
height = cloud2.height;
|
|
|
|
|
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBNormal> cloud_in;
|
|
|
|
|
pcl::io::loadPCDFile<pcl::PointXYZRGBNormal>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -383,8 +383,8 @@ void PcdReader::read(const std::string& filename)
|
|
|
|
|
colors.push_back(App::Color(it->r/255.0f,it->g/255.0f,it->b/255.0f));
|
|
|
|
|
normals.push_back(Base::Vector3f(it->normal_x,it->normal_y,it->normal_z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZINormal> cloud_in;
|
|
|
|
|
pcl::io::loadPCDFile<pcl::PointXYZINormal>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -395,8 +395,8 @@ void PcdReader::read(const std::string& filename)
|
|
|
|
|
intensity.push_back(it->intensity);
|
|
|
|
|
normals.push_back(Base::Vector3f(it->normal_x,it->normal_y,it->normal_z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBA> cloud_in;
|
|
|
|
|
pcl::io::loadPCDFile<pcl::PointXYZRGBA>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -405,8 +405,8 @@ void PcdReader::read(const std::string& filename)
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
colors.push_back(App::Color(it->r/255.0f,it->g/255.0f,it->b/255.0f,it->a/255.0f));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZI> cloud_in;
|
|
|
|
|
pcl::io::loadPCDFile<pcl::PointXYZI>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -415,8 +415,8 @@ void PcdReader::read(const std::string& filename)
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
intensity.push_back(it->intensity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
pcl::PointCloud<pcl::PointNormal> cloud_in;
|
|
|
|
|
pcl::io::loadPCDFile<pcl::PointNormal>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
@@ -425,15 +425,15 @@ void PcdReader::read(const std::string& filename)
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
normals.push_back(Base::Vector3f(it->normal_x,it->normal_y,it->normal_z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZ> cloud_in;
|
|
|
|
|
pcl::io::loadPCDFile<pcl::PointXYZ>(filename, cloud_in);
|
|
|
|
|
points.reserve(cloud_in.size());
|
|
|
|
|
for (pcl::PointCloud<pcl::PointXYZ>::const_iterator it = cloud_in.begin();it!=cloud_in.end();++it) {
|
|
|
|
|
points.push_back(Base::Vector3d(it->x,it->y,it->z));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
@@ -503,11 +503,11 @@ PlyWriter::~PlyWriter()
|
|
|
|
|
|
|
|
|
|
void PlyWriter::write(const std::string& filename)
|
|
|
|
|
{
|
|
|
|
|
bool hasIntensity = (intensity.size() == points.size());
|
|
|
|
|
bool hasColors = (colors.size() == points.size());
|
|
|
|
|
bool hasNormals = (normals.size() == points.size());
|
|
|
|
|
bool hasIntensity = (intensity.size() == points.size());
|
|
|
|
|
bool hasColors = (colors.size() == points.size());
|
|
|
|
|
bool hasNormals = (normals.size() == points.size());
|
|
|
|
|
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBNormal> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -533,8 +533,8 @@ void PlyWriter::write(const std::string& filename)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcl::io::savePLYFile<pcl::PointXYZRGBNormal>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZINormal> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -557,8 +557,8 @@ void PlyWriter::write(const std::string& filename)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcl::io::savePLYFile<pcl::PointXYZINormal>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBA> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -580,8 +580,8 @@ void PlyWriter::write(const std::string& filename)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcl::io::savePLYFile<pcl::PointXYZRGBA>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZI> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -600,8 +600,8 @@ void PlyWriter::write(const std::string& filename)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcl::io::savePLYFile<pcl::PointXYZI>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
pcl::PointCloud<pcl::PointNormal> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -620,11 +620,11 @@ void PlyWriter::write(const std::string& filename)
|
|
|
|
|
pn.normal_z = n.z;
|
|
|
|
|
cloud_out.push_back(pn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcl::io::savePLYFile<pcl::PointNormal>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZ> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
for (Points::PointKernel::const_iterator it = points.begin(); it != points.end(); ++it) {
|
|
|
|
|
@@ -634,7 +634,7 @@ void PlyWriter::write(const std::string& filename)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pcl::io::savePLYFile<pcl::PointXYZ>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
@@ -649,11 +649,11 @@ PcdWriter::~PcdWriter()
|
|
|
|
|
|
|
|
|
|
void PcdWriter::write(const std::string& filename)
|
|
|
|
|
{
|
|
|
|
|
bool hasIntensity = (intensity.size() == points.size());
|
|
|
|
|
bool hasColors = (colors.size() == points.size());
|
|
|
|
|
bool hasNormals = (normals.size() == points.size());
|
|
|
|
|
bool hasIntensity = (intensity.size() == points.size());
|
|
|
|
|
bool hasColors = (colors.size() == points.size());
|
|
|
|
|
bool hasNormals = (normals.size() == points.size());
|
|
|
|
|
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
if (hasNormals && hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBNormal> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -675,13 +675,13 @@ void PcdWriter::write(const std::string& filename)
|
|
|
|
|
pn.b = c.b * 255.0f;
|
|
|
|
|
cloud_out.push_back(pn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
pcl::io::savePCDFile<pcl::PointXYZRGBNormal>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals && hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZINormal> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -700,13 +700,13 @@ void PcdWriter::write(const std::string& filename)
|
|
|
|
|
pn.intensity = intensity[index];
|
|
|
|
|
cloud_out.push_back(pn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
pcl::io::savePCDFile<pcl::PointXYZINormal>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasColors) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZRGBA> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -724,13 +724,13 @@ void PcdWriter::write(const std::string& filename)
|
|
|
|
|
pc.b = c.b * 255.0f;
|
|
|
|
|
cloud_out.push_back(pc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
pcl::io::savePCDFile<pcl::PointXYZRGBA>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasIntensity) {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZI> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -745,13 +745,13 @@ void PcdWriter::write(const std::string& filename)
|
|
|
|
|
pi.intensity = intensity[index];
|
|
|
|
|
cloud_out.push_back(pi);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
pcl::io::savePCDFile<pcl::PointXYZI>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
}
|
|
|
|
|
else if (hasNormals) {
|
|
|
|
|
pcl::PointCloud<pcl::PointNormal> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
|
|
|
|
|
@@ -769,23 +769,23 @@ void PcdWriter::write(const std::string& filename)
|
|
|
|
|
pn.normal_z = n.z;
|
|
|
|
|
cloud_out.push_back(pn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
pcl::io::savePCDFile<pcl::PointNormal>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pcl::PointCloud<pcl::PointXYZ> cloud_out;
|
|
|
|
|
cloud_out.reserve(points.size());
|
|
|
|
|
for (Points::PointKernel::const_iterator it = points.begin(); it != points.end(); ++it) {
|
|
|
|
|
cloud_out.push_back(pcl::PointXYZ(it->x, it->y, it->z));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
cloud_out.width = width;
|
|
|
|
|
cloud_out.height = height;
|
|
|
|
|
|
|
|
|
|
pcl::io::savePCDFile<pcl::PointXYZ>(filename, cloud_out);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|