31 #include "rtabmap/core/rtabmap_core_export.h"
33 #include <pcl/point_cloud.h>
34 #include <pcl/point_types.h>
35 #include <pcl/pcl_base.h>
36 #include <pcl/TextureMesh.h>
40 #include <opencv2/core/core.hpp>
52 const pcl::PointCloud<pcl::PointXYZRGBA> & cloud,
53 bool bgrOrder =
true);
56 const pcl::PointCloud<pcl::PointXYZRGBA> & cloud,
59 bool depth16U =
true);
62 const pcl::PointCloud<pcl::PointXYZRGBA> & cloud,
68 bool depth16U =
true);
71 const cv::Mat & depthImage,
76 float depthErrorRatio = 0.02f);
79 const cv::Size & imageSize,
86 const cv::Mat & imageDepth,
90 float maxDepth = 0.0f,
91 float minDepth = 0.0f,
92 std::vector<int> * validIndices = 0);
93 pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_CORE_EXPORT
cloudFromDepth(
94 const cv::Mat & imageDepth,
95 const CameraModel &
model,
97 float maxDepth = 0.0f,
98 float minDepth = 0.0f,
99 std::vector<int> * validIndices = 0);
103 const cv::Mat & imageRgb,
104 const cv::Mat & imageDepth,
108 float maxDepth = 0.0f,
109 float minDepth = 0.0f,
110 std::vector<int> * validIndices = 0);
112 const cv::Mat & imageRgb,
113 const cv::Mat & imageDepth,
114 const CameraModel &
model,
116 float maxDepth = 0.0f,
117 float minDepth = 0.0f,
118 std::vector<int> * validIndices = 0);
121 const cv::Mat & imageDisparity,
122 const StereoCameraModel &
model,
124 float maxDepth = 0.0f,
125 float minDepth = 0.0f,
126 std::vector<int> * validIndices = 0);
129 const cv::Mat & imageRgb,
130 const cv::Mat & imageDisparity,
131 const StereoCameraModel &
model,
133 float maxDepth = 0.0f,
134 float minDepth = 0.0f,
135 std::vector<int> * validIndices = 0);
138 const cv::Mat & imageLeft,
139 const cv::Mat & imageRight,
140 const StereoCameraModel &
model,
142 float maxDepth = 0.0f,
143 float minDepth = 0.0f,
144 std::vector<int> * validIndices = 0,
161 const SensorData & sensorData,
163 float maxDepth = 0.0f,
164 float minDepth = 0.0f,
165 std::vector<pcl::IndicesPtr> * validIndices = 0,
167 const std::vector<float> & roiRatios = std::vector<float>());
185 const SensorData & sensorData,
187 float maxDepth = 0.0f,
188 float minDepth = 0.0f,
189 std::vector<int> * validIndices = 0,
191 const std::vector<float> & roiRatios = std::vector<float>());
207 const SensorData & sensorData,
209 float maxDepth = 0.0f,
210 float minDepth = 0.0f,
211 std::vector<pcl::IndicesPtr > * validIndices = 0,
213 const std::vector<float> & roiRatios = std::vector<float>());
231 const SensorData & sensorData,
233 float maxDepth = 0.0f,
234 float minDepth = 0.0f,
235 std::vector<int> * validIndices = 0,
237 const std::vector<float> & roiRatios = std::vector<float>());
243 const cv::Mat & depthImage,
257 const cv::Mat & depthImages,
258 const std::vector<CameraModel> & cameraModels,
262 template<
typename Po
intCloud2T>
263 LaserScan
laserScanFromPointCloud(
const PointCloud2T & cloud,
bool filterNaNs =
true,
bool is2D =
false,
const Transform & transform = Transform());
265 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
266 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const pcl::IndicesPtr & indices,
const Transform & transform = Transform(),
bool filterNaNs =
true);
268 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointNormal> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
269 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointNormal> & cloud,
const pcl::IndicesPtr & indices,
const Transform & transform = Transform(),
bool filterNaNs =
true);
270 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const pcl::PointCloud<pcl::Normal> & normals,
const Transform & transform = Transform(),
bool filterNaNs =
true);
272 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZRGB> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
273 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZRGB> & cloud,
const pcl::IndicesPtr & indices,
const Transform & transform = Transform(),
bool filterNaNs =
true);
275 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZI> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
276 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZI> & cloud,
const pcl::IndicesPtr & indices,
const Transform & transform = Transform(),
bool filterNaNs =
true);
278 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZRGB> & cloud,
const pcl::PointCloud<pcl::Normal> & normals,
const Transform & transform = Transform(),
bool filterNaNs =
true);
279 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZRGBNormal> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
280 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZRGBNormal> & cloud,
const pcl::IndicesPtr & indices,
const Transform & transform = Transform(),
bool filterNaNs =
true);
282 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZI> & cloud,
const pcl::PointCloud<pcl::Normal> & normals,
const Transform & transform = Transform(),
bool filterNaNs =
true);
283 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZINormal> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
284 LaserScan RTABMAP_CORE_EXPORT
laserScanFromPointCloud(
const pcl::PointCloud<pcl::PointXYZINormal> & cloud,
const pcl::IndicesPtr & indices,
const Transform & transform = Transform(),
bool filterNaNs =
true);
286 LaserScan RTABMAP_CORE_EXPORT
laserScan2dFromPointCloud(
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
288 LaserScan RTABMAP_CORE_EXPORT
laserScan2dFromPointCloud(
const pcl::PointCloud<pcl::PointXYZI> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
290 LaserScan RTABMAP_CORE_EXPORT
laserScan2dFromPointCloud(
const pcl::PointCloud<pcl::PointNormal> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
291 LaserScan RTABMAP_CORE_EXPORT
laserScan2dFromPointCloud(
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const pcl::PointCloud<pcl::Normal> & normals,
const Transform & transform = Transform(),
bool filterNaNs =
true);
293 LaserScan RTABMAP_CORE_EXPORT
laserScan2dFromPointCloud(
const pcl::PointCloud<pcl::PointXYZINormal> & cloud,
const Transform & transform = Transform(),
bool filterNaNs =
true);
294 LaserScan RTABMAP_CORE_EXPORT
laserScan2dFromPointCloud(
const pcl::PointCloud<pcl::PointXYZI> & cloud,
const pcl::PointCloud<pcl::Normal> & normals,
const Transform & transform = Transform(),
bool filterNaNs =
true);
296 pcl::PCLPointCloud2::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloud2(
const LaserScan & laserScan,
const Transform & transform = Transform());
298 pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloud(
const LaserScan & laserScan,
const Transform & transform = Transform());
300 pcl::PointCloud<pcl::PointNormal>::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloudNormal(
const LaserScan & laserScan,
const Transform & transform = Transform());
302 pcl::PointCloud<pcl::PointXYZRGB>::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloudRGB(
const LaserScan & laserScan,
const Transform & transform = Transform(),
unsigned char r = 100,
unsigned char g = 100,
unsigned char b = 100);
304 pcl::PointCloud<pcl::PointXYZI>::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloudI(
const LaserScan & laserScan,
const Transform & transform = Transform(),
float intensity = 0.0f);
307 pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloudRGBNormal(
const LaserScan & laserScan,
const Transform & transform = Transform(),
unsigned char r = 100,
unsigned char g = 100,
unsigned char b = 100);
310 pcl::PointCloud<pcl::PointXYZINormal>::Ptr RTABMAP_CORE_EXPORT
laserScanToPointCloudINormal(
const LaserScan & laserScan,
const Transform & transform = Transform(),
float intensity = 0.0f);
313 pcl::PointXYZ RTABMAP_CORE_EXPORT
laserScanToPoint(
const LaserScan & laserScan,
int index);
317 pcl::PointXYZRGB RTABMAP_CORE_EXPORT
laserScanToPointRGB(
const LaserScan & laserScan,
int index,
unsigned char r = 100,
unsigned char g = 100,
unsigned char b = 100);
319 pcl::PointXYZI RTABMAP_CORE_EXPORT
laserScanToPointI(
const LaserScan & laserScan,
int index,
float intensity);
322 pcl::PointXYZRGBNormal RTABMAP_CORE_EXPORT
laserScanToPointRGBNormal(
const LaserScan & laserScan,
int index,
unsigned char r,
unsigned char g,
unsigned char b);
325 pcl::PointXYZINormal RTABMAP_CORE_EXPORT
laserScanToPointINormal(
const LaserScan & laserScan,
int index,
float intensity);
327 void RTABMAP_CORE_EXPORT
getMinMax3D(
const cv::Mat & laserScan, cv::Point3f &
min, cv::Point3f &
max);
328 void RTABMAP_CORE_EXPORT
getMinMax3D(
const cv::Mat & laserScan, pcl::PointXYZ &
min, pcl::PointXYZ &
max);
331 const cv::Point2f & pt,
333 const StereoCameraModel &
model);
336 const cv::Point2f & pt,
337 const cv::Mat & disparity,
338 const StereoCameraModel &
model);
342 const cv::Size & imageSize,
343 const cv::Mat & cameraMatrixK,
344 const cv::Mat & laserScan,
349 const cv::Size & imageSize,
350 const cv::Mat & cameraMatrixK,
351 const pcl::PointCloud<pcl::PointXYZ>::Ptr laserScan,
356 const cv::Size & imageSize,
357 const cv::Mat & cameraMatrixK,
358 const pcl::PCLPointCloud2::Ptr laserScan,
363 cv::Mat & depthRegistered,
364 bool verticalDirection,
371 std::vector<std::pair< std::pair<int, int>, pcl::PointXY> > RTABMAP_CORE_EXPORT
projectCloudToCameras (
372 const pcl::PointCloud<pcl::PointXYZRGBNormal> & cloud,
373 const std::map<int, Transform> & cameraPoses,
374 const std::map<
int, std::vector<CameraModel> > & cameraModels,
375 float maxDistance = 0.0f,
376 float maxAngle = 0.0f,
377 const std::vector<float> & roiRatios = std::vector<float>(),
378 const cv::Mat & projMask = cv::Mat(),
379 bool distanceToCamPolicy =
false,
380 const ProgressState *
state = 0);
385 std::vector<std::pair< std::pair<int, int>, pcl::PointXY> > RTABMAP_CORE_EXPORT
projectCloudToCameras (
386 const pcl::PointCloud<pcl::PointXYZINormal> & cloud,
387 const std::map<int, Transform> & cameraPoses,
388 const std::map<
int, std::vector<CameraModel> > & cameraModels,
389 float maxDistance = 0.0f,
390 float maxAngle = 0.0f,
391 const std::vector<float> & roiRatios = std::vector<float>(),
392 const cv::Mat & projMask = cv::Mat(),
393 bool distanceToCamPolicy =
false,
394 const ProgressState *
state = 0);
396 bool RTABMAP_CORE_EXPORT
isFinite(
const cv::Point3f & pt);
399 const std::list<pcl::PointCloud<pcl::PointXYZ>::Ptr> & clouds);
401 const std::list<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds);
413 const std::vector<pcl::IndicesPtr> & indices);
426 const pcl::IndicesPtr & indicesA,
427 const pcl::IndicesPtr & indicesB);
430 const std::string & fileName,
431 const std::multimap<int, pcl::PointXYZ> & words,
435 const std::string & fileName,
436 const std::multimap<int, cv::Point3f> & words,
443 cv::Mat RTABMAP_CORE_EXPORT
loadBINScan(
const std::string & fileName);
444 pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_CORE_EXPORT
loadBINCloud(
const std::string & fileName);
449 LaserScan RTABMAP_CORE_EXPORT
loadScan(
const std::string & path);
453 const std::string & path,
455 int downsampleStep = 1,
456 float voxelSize = 0.0f);
466 LaserScan RTABMAP_CORE_EXPORT
deskew(
467 const LaserScan & input,