19 #include <pcl/io/io.h> 20 #include <pcl/io/pcd_io.h> 34 globalMapPtr( new pcl::PointCloud<pcl::PointXYZRGBA>() ),
35 edgeCloudPtr(new pcl::PointCloud<pcl::PointXYZRGBA>),
36 outEdgeCloudPtr(new pcl::PointCloud<pcl::PointXYZRGBA>)
102 void PbMap::savePbMap(
string filePath)
109 serialize_pbmap << *
this;
110 serialize_pbmap.close();
114 pcl::io::savePCDFile(filePath +
"/cloud.pcd", *this->globalMapPtr);
120 pcl::PCDReader reader;
121 string PbMapFile = filePath;
122 reader.read (PbMapFile.append(
"/cloud.pcd"), *(this->globalMapPtr));
126 PbMapFile = filePath;
128 if (serialized_pbmap.
open(PbMapFile.append(
"/planes.pbmap")))
130 serialized_pbmap >> *
this;
133 cout <<
"Error: cannot open " << PbMapFile <<
"\n";
134 serialized_pbmap.
close();
141 void PbMap::MergeWith(
PbMap &pbm, Eigen::Matrix4f &T)
144 for(
size_t i = 0; i < pbm.
vPlanes.size(); i++)
161 plane.
id = vPlanes.size();
163 vPlanes.push_back(plane);
167 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr alignedPointCloud(
new pcl::PointCloud<pcl::PointXYZRGBA>);
168 pcl::transformPointCloud(*pbm.
globalMapPtr,*alignedPointCloud,T);
170 *globalMapPtr += *alignedPointCloud;
176 void PbMap::printPbMap(
string txtFilePbm)
178 cout <<
"PbMap 0.2\n\n";
181 pbm.open(txtFilePbm.c_str());
182 pbm <<
"PbMap 0.2\n\n";
183 pbm <<
"MapPlanes " << vPlanes.size() << endl;
184 for(
unsigned i=0; i < vPlanes.size(); i++)
186 pbm <<
" ID " << vPlanes[i].id <<
" obs " << vPlanes[i].numObservations;
187 pbm <<
" areaVoxels " << vPlanes[i].areaVoxels <<
" areaHull " << vPlanes[i].areaHull;
188 pbm <<
" ratioXY " << vPlanes[i].elongation <<
" structure " << vPlanes[i].bFromStructure <<
" label " << vPlanes[i].label;
189 pbm <<
"\n normal\n" << vPlanes[i].v3normal <<
"\n center\n" << vPlanes[i].v3center;
190 pbm <<
"\n PpalComp\n" << vPlanes[i].v3PpalDir <<
"\n RGB\n" << vPlanes[i].v3colorNrgb;
191 pbm <<
"\n Neighbors (" << vPlanes[i].neighborPlanes.size() <<
"): ";
193 pbm << it->first <<
" ";
194 pbm <<
"\n CommonObservations: ";
196 pbm << it->second <<
" ";
197 pbm <<
"\n ConvexHull (" << vPlanes[i].polygonContourPtr->size() <<
"): \n";
198 for(
unsigned j=0; j < vPlanes[i].polygonContourPtr->size(); j++)
199 pbm <<
"\t" << vPlanes[i].polygonContourPtr->points[j].x <<
" " << vPlanes[i].polygonContourPtr->points[j].y <<
" " << vPlanes[i].polygonContourPtr->points[j].z << endl;
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr polygonContourPtr
The virtual base class which provides a unified interface for all persistent objects in MRPT...
A class used to store a planar feature (Plane for short).
Eigen::Vector3f v3PpalDir
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr planePointCloudPtr
GLsizei const GLchar ** string
pcl::PointCloud< PointT >::Ptr globalMapPtr
#define CFileGZOutputStream
Saves data to a file and transparently compress the data using the given compression level...
unsigned id
! Parameters to allow the plane-based representation of the map by a graph
Eigen::Vector3f v3center
! Geometric description
std::vector< Plane > vPlanes
unsigned __int32 uint32_t
A class used to store a Plane-based Map (PbMap).