gtsam_points
Loading...
Searching...
No Matches
gaussian_voxelmap.hpp
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2021 Kenji Koide (k.koide@aist.go.jp)
3
4#pragma once
5
6#include <gtsam_points/types/point_cloud.hpp>
7
8// forward declaration
9struct CUstream_st;
10
11namespace gtsam_points {
12
17public:
18 using Ptr = std::shared_ptr<GaussianVoxelMap>;
19 using ConstPtr = std::shared_ptr<const GaussianVoxelMap>;
20
22 virtual ~GaussianVoxelMap() {}
23
26 virtual void save_compact(const std::string& path) const = 0;
27
29 virtual double voxel_resolution() const = 0;
30
32 virtual void insert(const PointCloud& frame) = 0;
33};
34
42double overlap(const GaussianVoxelMap::ConstPtr& target, const PointCloud::ConstPtr& source, const Eigen::Isometry3d& T_target_source);
43
51double overlap(
52 const std::vector<GaussianVoxelMap::ConstPtr>& targets,
53 const PointCloud::ConstPtr& source,
54 const std::vector<Eigen::Isometry3d>& Ts_target_source);
55
57template <typename VoxelMapPtr>
58std::enable_if_t<!std::is_same_v<VoxelMapPtr, GaussianVoxelMap::ConstPtr>, double>
59overlap(const std::vector<VoxelMapPtr>& targets, const PointCloud::ConstPtr& source, const std::vector<Eigen::Isometry3d>& Ts_target_source) {
60 const std::vector<GaussianVoxelMap::ConstPtr> targets_(targets.begin(), targets.end());
61 return overlap(targets_, source, Ts_target_source);
62}
63
72double overlap_gpu(
73 const GaussianVoxelMap::ConstPtr& target,
74 const PointCloud::ConstPtr& source,
75 const Eigen::Isometry3f* T_target_source_gpu,
76 CUstream_st* stream = 0);
77
86double overlap_gpu(
87 const GaussianVoxelMap::ConstPtr& target,
88 const PointCloud::ConstPtr& source,
89 const Eigen::Isometry3d& T_target_source,
90 CUstream_st* stream = 0);
91
93double overlap_gpu(
94 const PointCloud::ConstPtr& target,
95 const PointCloud::ConstPtr& source,
96 const Eigen::Isometry3d& T_target_source,
97 CUstream_st* stream = 0);
98
107double overlap_gpu(
108 const std::vector<GaussianVoxelMap::ConstPtr>& targets,
109 const PointCloud::ConstPtr& source,
110 const std::vector<Eigen::Isometry3d>& Ts_target_source,
111 CUstream_st* stream = 0);
112
121std::vector<double> overlap_gpu(
122 const std::vector<GaussianVoxelMap::ConstPtr>& targets,
123 const std::vector<PointCloud::ConstPtr>& sources,
124 const std::vector<Eigen::Isometry3d>& Ts_target_source,
125 CUstream_st* stream = 0);
126
128template <typename VoxelMapPtr>
129std::enable_if_t<!std::is_same_v<VoxelMapPtr, GaussianVoxelMap::ConstPtr>, double> overlap_gpu(
130 const std::vector<VoxelMapPtr>& targets,
131 const PointCloud::ConstPtr& source,
132 const std::vector<Eigen::Isometry3d>& Ts_target_source,
133 CUstream_st* stream = 0) {
134 const std::vector<GaussianVoxelMap::ConstPtr> targets_(targets.begin(), targets.end());
135 return overlap_gpu(targets_, source, Ts_target_source, stream);
136}
137
139template <typename VoxelMapPtr, typename PointCloudPtr>
140std::
141 enable_if_t<!std::is_same_v<VoxelMapPtr, GaussianVoxelMap::ConstPtr> || !std::is_same_v<PointCloudPtr, PointCloud::ConstPtr>, std::vector<double>>
142 overlap_gpu(
143 const std::vector<VoxelMapPtr>& targets,
144 const std::vector<PointCloudPtr>& sources,
145 const std::vector<Eigen::Isometry3d>& Ts_target_source,
146 CUstream_st* stream = 0) {
147 const std::vector<GaussianVoxelMap::ConstPtr> targets_(targets.begin(), targets.end());
148 const std::vector<PointCloud::ConstPtr> sources_(sources.begin(), sources.end());
149 return overlap_gpu(targets_, sources_, Ts_target_source, stream);
150}
151
152// Automatically select CPU or GPU method
153double overlap_auto(const GaussianVoxelMap::ConstPtr& target, const PointCloud::ConstPtr& source, const Eigen::Isometry3d& T_target_source);
154
155double overlap_auto(
156 const std::vector<GaussianVoxelMap::ConstPtr>& targets,
157 const PointCloud::ConstPtr& source,
158 const std::vector<Eigen::Isometry3d>& Ts_target_source);
159
160template <typename VoxelMapPtr>
161std::enable_if_t<!std::is_same_v<VoxelMapPtr, GaussianVoxelMap::ConstPtr>, double>
162overlap_auto(const std::vector<VoxelMapPtr>& targets, const PointCloud::ConstPtr& source, const std::vector<Eigen::Isometry3d>& Ts_target_source) {
163 const std::vector<GaussianVoxelMap::ConstPtr> targets_(targets.begin(), targets.end());
164 return overlap_auto(targets_, source, Ts_target_source);
165}
166
167} // namespace gtsam_points
Gaussian distribution voxelmap.
Definition gaussian_voxelmap.hpp:16
virtual void insert(const PointCloud &frame)=0
Insert a point cloud frame into the voxelmap.
virtual void save_compact(const std::string &path) const =0
Save the voxelmap.
virtual double voxel_resolution() const =0
Voxel resolution.
Standard point cloud class that holds only pointers to point attributes.
Definition point_cloud.hpp:19