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,
378 const cv::Mat & depth,
379 const std::vector<CameraModel> & cameraModels,
381 cv::Mat * depthBelow = 0);
387 std::vector<std::pair< std::pair<int, int>, pcl::PointXY> > RTABMAP_CORE_EXPORT
projectCloudToCameras (
388 const pcl::PointCloud<pcl::PointXYZRGBNormal> & cloud,
389 const std::map<int, Transform> & cameraPoses,
390 const std::map<
int, std::vector<CameraModel> > & cameraModels,
391 float maxDistance = 0.0f,
392 float maxAngle = 0.0f,
393 const std::vector<float> & roiRatios = std::vector<float>(),
394 const cv::Mat & projMask = cv::Mat(),
395 bool distanceToCamPolicy =
false,
396 const ProgressState *
state = 0);
401 std::vector<std::pair< std::pair<int, int>, pcl::PointXY> > RTABMAP_CORE_EXPORT
projectCloudToCameras (
402 const pcl::PointCloud<pcl::PointXYZINormal> & cloud,
403 const std::map<int, Transform> & cameraPoses,
404 const std::map<
int, std::vector<CameraModel> > & cameraModels,
405 float maxDistance = 0.0f,
406 float maxAngle = 0.0f,
407 const std::vector<float> & roiRatios = std::vector<float>(),
408 const cv::Mat & projMask = cv::Mat(),
409 bool distanceToCamPolicy =
false,
410 const ProgressState *
state = 0);
412 bool RTABMAP_CORE_EXPORT
isFinite(
const cv::Point3f & pt);
415 const std::list<pcl::PointCloud<pcl::PointXYZ>::Ptr> & clouds);
417 const std::list<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds);
429 const std::vector<pcl::IndicesPtr> & indices);
442 const pcl::IndicesPtr & indicesA,
443 const pcl::IndicesPtr & indicesB);
446 const std::string & fileName,
447 const std::multimap<int, pcl::PointXYZ> & words,
451 const std::string & fileName,
452 const std::multimap<int, cv::Point3f> & words,
459 cv::Mat RTABMAP_CORE_EXPORT
loadBINScan(
const std::string & fileName);
460 pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_CORE_EXPORT
loadBINCloud(
const std::string & fileName);
465 LaserScan RTABMAP_CORE_EXPORT
loadScan(
const std::string & path);
469 const std::string & path,
471 int downsampleStep = 1,
472 float voxelSize = 0.0f);
482 LaserScan RTABMAP_CORE_EXPORT
deskew(
483 const LaserScan & input,