Skip to content
Snippets Groups Projects
Verified Commit 0a0c4e9b authored by Thibault Payet's avatar Thibault Payet
Browse files

Merge branch 'feat-fixup-parsing-when-rgb-is-float'

parents ae3e4393 88c238b8
No related branches found
No related tags found
1 merge request!2use atoi and atof to convert extracted data to integer and float
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <ios>
......@@ -51,15 +52,31 @@ void txt2pcd( std::filesystem::path input, std::filesystem::path output )
{
pcl::PointXYZRGB point;
inputFile >> point.x;
inputFile >> point.y;
inputFile >> point.z;
std::string buf;
inputFile >> buf;
point.x = std::atof( buf.c_str() );
buf.clear();
inputFile >> buf;
point.y = std::atof( buf.c_str() );
buf.clear();
inputFile >> buf;
point.z = std::atof( buf.c_str() );
buf.clear();
int r, g, b;
inputFile >> r;
inputFile >> g;
inputFile >> b;
inputFile >> buf;
r = std::atoi( buf.c_str() );
buf.clear();
inputFile >> buf;
g = std::atoi( buf.c_str() );
buf.clear();
inputFile >> buf;
b = std::atoi( buf.c_str() );
buf.clear();
point.r = static_cast<char>( r );
point.g = static_cast<char>( g );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment