Added LASWriter tests

This commit is contained in:
matlabbe
2026-05-17 14:58:35 -07:00
parent 057d385404
commit 7ccc41de12
4 changed files with 229 additions and 5 deletions
+45 -4
View File
@@ -28,16 +28,57 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef CORELIB_INCLUDE_RTABMAP_CORE_LASWRITER_H_
#define CORELIB_INCLUDE_RTABMAP_CORE_LASWRITER_H_
#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <string>
#include <vector>
namespace rtabmap {
int saveLASFile(const std::string & filePath, const pcl::PointCloud<pcl::PointXYZ> & cloud, const std::vector<int> & cameraIds = std::vector<int>());
int saveLASFile(const std::string & filePath, const pcl::PointCloud<pcl::PointXYZRGB> & cloud, const std::vector<int> & cameraIds = std::vector<int>(), const std::vector<float> & intensities = std::vector<float>());
int saveLASFile(const std::string & filePath, const pcl::PointCloud<pcl::PointXYZI> & cloud, const std::vector<int> & cameraIds = std::vector<int>());
/**
* @brief Writes a PCL point cloud to a LAS/LAZ file (requires RTAB-Map built with libLAS).
*
* Output uses 1 mm XYZ scale (`0.001`). The file extension (`.las` or `.laz`) selects
* uncompressed or compressed output when libLAS LAZ support is available.
*
* @param filePath Output path (`.las` or `.laz`).
* @param cloud Input point cloud.
* @param cameraIds Optional per-point camera/signature ids (stored as point source ID);
* must be empty or the same length as @p cloud.
* @return `0` on success, `1` on error (e.g. LAZ not supported).
*/
int RTABMAP_CORE_EXPORT saveLASFile(
const std::string & filePath,
const pcl::PointCloud<pcl::PointXYZ> & cloud,
const std::vector<int> & cameraIds = std::vector<int>());
}
/**
* @brief Writes a colored point cloud to LAS/LAZ, with optional intensity and camera ids.
* @param filePath Output path (`.las` or `.laz`).
* @param cloud RGB point cloud (8-bit channels mapped to 16-bit LAS color).
* @param cameraIds Optional per-point ids (same length as @p cloud or empty).
* @param intensities Optional per-point intensities (same length as @p cloud or empty).
* @return `0` on success, `1` on error.
*/
int RTABMAP_CORE_EXPORT saveLASFile(
const std::string & filePath,
const pcl::PointCloud<pcl::PointXYZRGB> & cloud,
const std::vector<int> & cameraIds = std::vector<int>(),
const std::vector<float> & intensities = std::vector<float>());
/**
* @brief Writes a point cloud with intensity channel to LAS/LAZ.
* @param filePath Output path (`.las` or `.laz`).
* @param cloud XYZI point cloud (coordinates and intensity written).
* @param cameraIds Optional per-point ids (same length as @p cloud or empty).
* @return `0` on success, `1` on error.
*/
int RTABMAP_CORE_EXPORT saveLASFile(
const std::string & filePath,
const pcl::PointCloud<pcl::PointXYZI> & cloud,
const std::vector<int> & cameraIds = std::vector<int>());
} // namespace rtabmap
#endif /* CORELIB_INCLUDE_RTABMAP_CORE_LASWRITER_H_ */