mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
Fixed build with pcl > 1.11.1 (#641)
This commit is contained in:
@@ -109,7 +109,7 @@ public:
|
||||
cv::Mat load2DMap(float & xMin, float & yMin, float & cellSize) const;
|
||||
void saveOptimizedMesh(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(), // Textures -> polygons -> vertices
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons = std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > >(), // Textures -> polygons -> vertices
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords = std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > >(), // Textures -> uv coords for each vertex of the polygons
|
||||
#else
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
#endif
|
||||
const cv::Mat & textures = cv::Mat()) const; // concatenated textures (assuming square textures with all same size);
|
||||
cv::Mat loadOptimizedMesh(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons = 0,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords = 0,
|
||||
#else
|
||||
@@ -247,7 +247,7 @@ protected:
|
||||
virtual cv::Mat load2DMapQuery(float & xMin, float & yMin, float & cellSize) const = 0;
|
||||
virtual void saveOptimizedMeshQuery(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -255,7 +255,7 @@ protected:
|
||||
#endif
|
||||
const cv::Mat & textures) const = 0;
|
||||
virtual cv::Mat loadOptimizedMeshQuery(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
|
||||
#else
|
||||
|
||||
@@ -113,7 +113,7 @@ protected:
|
||||
virtual cv::Mat load2DMapQuery(float & xMin, float & yMin, float & cellSize) const;
|
||||
virtual void saveOptimizedMeshQuery(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -121,7 +121,7 @@ protected:
|
||||
#endif
|
||||
const cv::Mat & textures) const;
|
||||
virtual cv::Mat loadOptimizedMeshQuery(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
|
||||
#else
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
cv::Mat load2DMap(float & xMin, float & yMin, float & cellSize) const;
|
||||
void saveOptimizedMesh(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(), // Textures -> polygons -> vertices
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons = std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > >(), // Textures -> polygons -> vertices
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords = std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > >(), // Textures -> uv coords for each vertex of the polygons
|
||||
#else
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
#endif
|
||||
const cv::Mat & textures = cv::Mat()) const; // concatenated textures (assuming square textures with all same size)
|
||||
cv::Mat loadOptimizedMesh(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons = 0,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords = 0,
|
||||
#else
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define CORELIB_INCLUDE_RTABMAP_CORE_IMPL_UTIL3D_SURFACE_HPP_
|
||||
|
||||
#include <pcl/search/kdtree.h>
|
||||
#include <pcl/conversions.h>
|
||||
#include <rtabmap/utilite/UConversion.h>
|
||||
|
||||
namespace rtabmap {
|
||||
|
||||
@@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/core/CameraModel.h>
|
||||
#include <rtabmap/core/ProgressState.h>
|
||||
#include <rtabmap/core/LaserScan.h>
|
||||
#include <rtabmap/core/Version.h>
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
@@ -177,18 +178,18 @@ pcl::TextureMesh::Ptr RTABMAP_EXP concatenateTextureMeshes(
|
||||
void RTABMAP_EXP concatenateTextureMaterials(
|
||||
pcl::TextureMesh & mesh, const cv::Size & imageSize, int textureSize, int maxTextures, float & scale, std::vector<bool> * materialsKept=0);
|
||||
|
||||
std::vector<std::vector<unsigned int> > RTABMAP_EXP convertPolygonsFromPCL(
|
||||
std::vector<std::vector<RTABMAP_PCL_INDEX> > RTABMAP_EXP convertPolygonsFromPCL(
|
||||
const std::vector<pcl::Vertices> & polygons);
|
||||
std::vector<std::vector<std::vector<unsigned int> > > RTABMAP_EXP convertPolygonsFromPCL(
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > RTABMAP_EXP convertPolygonsFromPCL(
|
||||
const std::vector<std::vector<pcl::Vertices> > & polygons);
|
||||
std::vector<pcl::Vertices> RTABMAP_EXP convertPolygonsToPCL(
|
||||
const std::vector<std::vector<unsigned int> > & polygons);
|
||||
const std::vector<std::vector<RTABMAP_PCL_INDEX> > & polygons);
|
||||
std::vector<std::vector<pcl::Vertices> > RTABMAP_EXP convertPolygonsToPCL(
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & tex_polygons);
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & tex_polygons);
|
||||
|
||||
pcl::TextureMesh::Ptr RTABMAP_EXP assembleTextureMesh(
|
||||
const cv::Mat & cloudMat,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -199,7 +200,7 @@ pcl::TextureMesh::Ptr RTABMAP_EXP assembleTextureMesh(
|
||||
|
||||
pcl::PolygonMesh::Ptr RTABMAP_EXP assemblePolygonMesh(
|
||||
const cv::Mat & cloudMat,
|
||||
const std::vector<std::vector<unsigned int> > & polygons);
|
||||
const std::vector<std::vector<RTABMAP_PCL_INDEX> > & polygons);
|
||||
|
||||
/**
|
||||
* Merge all textures in the mesh into "textureCount" textures of size "textureSize".
|
||||
|
||||
@@ -1209,7 +1209,7 @@ cv::Mat DBDriver::load2DMap(float & xMin, float & yMin, float & cellSize) const
|
||||
|
||||
void DBDriver::saveOptimizedMesh(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -1223,7 +1223,7 @@ void DBDriver::saveOptimizedMesh(
|
||||
}
|
||||
|
||||
cv::Mat DBDriver::loadOptimizedMesh(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
|
||||
#else
|
||||
|
||||
@@ -5057,7 +5057,7 @@ cv::Mat DBDriverSqlite3::load2DMapQuery(float & xMin, float & yMin, float & cell
|
||||
|
||||
void DBDriverSqlite3::saveOptimizedMeshQuery(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -5252,7 +5252,7 @@ void DBDriverSqlite3::saveOptimizedMeshQuery(
|
||||
}
|
||||
|
||||
cv::Mat DBDriverSqlite3::loadOptimizedMeshQuery(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
|
||||
#else
|
||||
@@ -5314,7 +5314,7 @@ cv::Mat DBDriverSqlite3::loadOptimizedMeshQuery(
|
||||
for(int t=0; t<serializedPolygons.cols; ++t)
|
||||
{
|
||||
UASSERT(serializedPolygons.at<int>(t) > 0);
|
||||
std::vector<std::vector<unsigned int> > materialPolygons(serializedPolygons.at<int>(t), std::vector<unsigned int>(polygonSize));
|
||||
std::vector<std::vector<RTABMAP_PCL_INDEX> > materialPolygons(serializedPolygons.at<int>(t), std::vector<RTABMAP_PCL_INDEX>(polygonSize));
|
||||
++t;
|
||||
UASSERT(t < serializedPolygons.cols);
|
||||
UDEBUG("materialPolygons=%d", (int)materialPolygons.size());
|
||||
|
||||
@@ -2083,7 +2083,7 @@ cv::Mat Memory::load2DMap(float & xMin, float & yMin, float & cellSize) const
|
||||
|
||||
void Memory::saveOptimizedMesh(
|
||||
const cv::Mat & cloud,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -2098,7 +2098,7 @@ void Memory::saveOptimizedMesh(
|
||||
}
|
||||
|
||||
cv::Mat Memory::loadOptimizedMesh(
|
||||
std::vector<std::vector<std::vector<unsigned int> > > * polygons,
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > * polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
|
||||
#else
|
||||
|
||||
@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/UTimer.h>
|
||||
#include <pcl/conversions.h>
|
||||
#include <pcl/common/pca.h>
|
||||
#include <pcl/common/io.h>
|
||||
|
||||
#ifdef RTABMAP_POINTMATCHER
|
||||
#include <fstream>
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <pcl/surface/reconstruction.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/TextureMesh.h>
|
||||
#include <pcl/octree/octree.h>
|
||||
#include <rtabmap/core/ProgressState.h>
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <rtabmap/utilite/UStl.h>
|
||||
|
||||
@@ -1389,7 +1389,7 @@ LaserScan laserScanFromPointCloud(const pcl::PCLPointCloud2 & cloud, bool filter
|
||||
}
|
||||
}
|
||||
|
||||
UASSERT(cloud.data.size()/cloud.point_step == cloud.height*cloud.width);
|
||||
UASSERT(cloud.data.size()/cloud.point_step == (uint32_t)cloud.height*cloud.width);
|
||||
cv::Mat laserScan = cv::Mat(1, (int)cloud.data.size()/cloud.point_step, CV_32FC(LaserScan::channels(format)));
|
||||
|
||||
bool transformValid = !transform.isNull() && !transform.isIdentity();
|
||||
@@ -1399,10 +1399,10 @@ LaserScan laserScanFromPointCloud(const pcl::PCLPointCloud2 & cloud, bool filter
|
||||
transformRot = transform.rotation();
|
||||
}
|
||||
int oi=0;
|
||||
for (uint32_t row = 0; row < cloud.height; ++row)
|
||||
for (uint32_t row = 0; row < (uint32_t)cloud.height; ++row)
|
||||
{
|
||||
const uint8_t* row_data = &cloud.data[row * cloud.row_step];
|
||||
for (uint32_t col = 0; col < cloud.width; ++col)
|
||||
for (uint32_t col = 0; col < (uint32_t)cloud.width; ++col)
|
||||
{
|
||||
const uint8_t* msg_data = row_data + col * cloud.point_step;
|
||||
|
||||
@@ -2918,10 +2918,10 @@ cv::Mat projectCloudToCamera(
|
||||
int count = 0;
|
||||
if(field_map.size() == 1)
|
||||
{
|
||||
for (uint32_t row = 0; row < laserScan->height; ++row)
|
||||
for (uint32_t row = 0; row < (uint32_t)laserScan->height; ++row)
|
||||
{
|
||||
const uint8_t* row_data = &laserScan->data[row * laserScan->row_step];
|
||||
for (uint32_t col = 0; col < laserScan->width; ++col)
|
||||
for (uint32_t col = 0; col < (uint32_t)laserScan->width; ++col)
|
||||
{
|
||||
const uint8_t* msg_data = row_data + col * laserScan->point_step;
|
||||
pcl::PointXYZ ptScan;
|
||||
|
||||
@@ -62,6 +62,9 @@ using namespace aliceVision;
|
||||
#include <pcl/surface/vtk_smoothing/vtk_mesh_quadric_decimation.h>
|
||||
#endif
|
||||
|
||||
#if PCL_VERSION_COMPARE(>, 1, 11, 1)
|
||||
#include <pcl/types.h>
|
||||
#endif
|
||||
#if PCL_VERSION_COMPARE(<, 1, 8, 0)
|
||||
#include "pcl18/surface/organized_fast_mesh.h"
|
||||
#else
|
||||
@@ -1217,18 +1220,18 @@ void concatenateTextureMaterials(pcl::TextureMesh & mesh, const cv::Size & image
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::vector<unsigned int> > convertPolygonsFromPCL(const std::vector<pcl::Vertices> & polygons)
|
||||
std::vector<std::vector<RTABMAP_PCL_INDEX> > convertPolygonsFromPCL(const std::vector<pcl::Vertices> & polygons)
|
||||
{
|
||||
std::vector<std::vector<unsigned int> > polygonsOut(polygons.size());
|
||||
std::vector<std::vector<RTABMAP_PCL_INDEX> > polygonsOut(polygons.size());
|
||||
for(unsigned int p=0; p<polygons.size(); ++p)
|
||||
{
|
||||
polygonsOut[p] = polygons[p].vertices;
|
||||
}
|
||||
return polygonsOut;
|
||||
}
|
||||
std::vector<std::vector<std::vector<unsigned int> > > convertPolygonsFromPCL(const std::vector<std::vector<pcl::Vertices> > & tex_polygons)
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > convertPolygonsFromPCL(const std::vector<std::vector<pcl::Vertices> > & tex_polygons)
|
||||
{
|
||||
std::vector<std::vector<std::vector<unsigned int> > > polygonsOut(tex_polygons.size());
|
||||
std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > polygonsOut(tex_polygons.size());
|
||||
for(unsigned int t=0; t<tex_polygons.size(); ++t)
|
||||
{
|
||||
polygonsOut[t].resize(tex_polygons[t].size());
|
||||
@@ -1239,7 +1242,7 @@ std::vector<std::vector<std::vector<unsigned int> > > convertPolygonsFromPCL(con
|
||||
}
|
||||
return polygonsOut;
|
||||
}
|
||||
std::vector<pcl::Vertices> convertPolygonsToPCL(const std::vector<std::vector<unsigned int> > & polygons)
|
||||
std::vector<pcl::Vertices> convertPolygonsToPCL(const std::vector<std::vector<RTABMAP_PCL_INDEX> > & polygons)
|
||||
{
|
||||
std::vector<pcl::Vertices> polygonsOut(polygons.size());
|
||||
for(unsigned int p=0; p<polygons.size(); ++p)
|
||||
@@ -1248,7 +1251,7 @@ std::vector<pcl::Vertices> convertPolygonsToPCL(const std::vector<std::vector<un
|
||||
}
|
||||
return polygonsOut;
|
||||
}
|
||||
std::vector<std::vector<pcl::Vertices> > convertPolygonsToPCL(const std::vector<std::vector<std::vector<unsigned int> > > & tex_polygons)
|
||||
std::vector<std::vector<pcl::Vertices> > convertPolygonsToPCL(const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & tex_polygons)
|
||||
{
|
||||
std::vector<std::vector<pcl::Vertices> > polygonsOut(tex_polygons.size());
|
||||
for(unsigned int t=0; t<tex_polygons.size(); ++t)
|
||||
@@ -1264,7 +1267,7 @@ std::vector<std::vector<pcl::Vertices> > convertPolygonsToPCL(const std::vector<
|
||||
|
||||
pcl::TextureMesh::Ptr assembleTextureMesh(
|
||||
const cv::Mat & cloudMat,
|
||||
const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
|
||||
const std::vector<std::vector<std::vector<RTABMAP_PCL_INDEX> > > & polygons,
|
||||
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
|
||||
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
|
||||
#else
|
||||
@@ -1387,7 +1390,7 @@ pcl::TextureMesh::Ptr assembleTextureMesh(
|
||||
|
||||
pcl::PolygonMesh::Ptr assemblePolygonMesh(
|
||||
const cv::Mat & cloudMat,
|
||||
const std::vector<std::vector<unsigned int> > & polygons)
|
||||
const std::vector<std::vector<RTABMAP_PCL_INDEX> > & polygons)
|
||||
{
|
||||
pcl::PolygonMesh::Ptr polygonMesh(new pcl::PolygonMesh);
|
||||
|
||||
@@ -2197,7 +2200,7 @@ void fixTextureMeshForVisualization(pcl::TextureMesh & textureMesh)
|
||||
for(unsigned int j=0; j<vertices.vertices.size(); ++j)
|
||||
{
|
||||
UASSERT(oi < newCloud->size());
|
||||
UASSERT_MSG(vertices.vertices[j] < originalCloud->size(), uFormat("%d vs %d", vertices.vertices[j], (int)originalCloud->size()).c_str());
|
||||
UASSERT_MSG((size_t)vertices.vertices[j] < originalCloud->size(), uFormat("%d vs %d", vertices.vertices[j], (int)originalCloud->size()).c_str());
|
||||
newCloud->at(oi) = originalCloud->at(vertices.vertices[j]);
|
||||
vertices.vertices[j] = oi; // new vertex index
|
||||
++oi;
|
||||
|
||||
Reference in New Issue
Block a user