supereight2
Loading...
Searching...
No Matches
volume_carver.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020-2021 Smart Robotics Lab, Imperial College London, Technical University of Munich
3 * SPDX-FileCopyrightText: 2020-2021 Nils Funk
4 * SPDX-FileCopyrightText: 2021 Sotiris Papatheodorou
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef SE_VOLUME_CARVER_HPP
9#define SE_VOLUME_CARVER_HPP
10
11#include <Eigen/Geometry>
13#include <se/map/map.hpp>
14
15namespace se {
16
17
18
20
22 std::vector<se::OctantBase*> node_list;
23 std::vector<se::OctantBase*> block_list;
24 std::vector<se::VarianceState> variance_state_list;
25 std::vector<bool> projects_inside_list;
26};
27
28
29
31template<typename MapT, typename SensorT>
33 public:
34 VolumeCarver(MapT& /* map */,
35 const SensorT& /* sensor */,
36 const se::Image<float>& /* depth_img */,
37 const Eigen::Isometry3f& /* T_WS */,
38 const timestamp_t /* timestamp */);
39};
40
41
42
51template<se::Colour ColB, se::Id IdB, int BlockSize, typename SensorT>
53 public:
55 typedef typename MapType::OctreeType OctreeType;
56 typedef typename OctreeType::NodeType NodeType;
57 typedef typename OctreeType::BlockType BlockType;
58
64 struct VolumeCarverConfig {
66 sigma_min(map.getDataConfig().field.sigma_min_factor * map.getRes()),
67 sigma_max(map.getDataConfig().field.sigma_max_factor * map.getRes()),
68 tau_min(map.getDataConfig().field.tau_min_factor * map.getRes()),
69 tau_max(map.getDataConfig().field.tau_max_factor * map.getRes())
70 {
71 }
72
73 const float sigma_min;
74 const float sigma_max;
75 const float tau_min;
76 const float tau_max;
77 };
78
79
91 const SensorT& sensor,
94 const Eigen::Isometry3f& T_WS,
95 const timestamp_t timestamp);
96
101
102 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
103
104
105
106 private:
114 bool crossesFrustum(std::vector<srl::projection::ProjectionStatus>& proj_corner_stati);
115
125 bool cameraInNode(const Eigen::Vector3i& node_coord,
126 const int node_size,
127 const Eigen::Isometry3f& T_WS);
128
141 se::VarianceState computeVariance(const float depth_value_min,
142 const float depth_value_max,
143 const float node_dist_min_m,
144 const float node_dist_max_m,
145 const float std_dev_max);
146
158 template<class SensorTDummy = SensorT>
159 typename std::enable_if_t<std::is_same<SensorTDummy, se::PinholeCamera>::value, void>
160 operator()(const Eigen::Vector3i& octant_coord,
161 const int octant_size,
162 const int octant_depth,
164
176 template<class SensorTDummy = SensorT>
177 typename std::enable_if_t<std::is_same<SensorTDummy, se::OusterLidar>::value, void>
178 operator()(const Eigen::Vector3i& octant_coord,
179 const int octant_size,
180 const int octant_depth,
182
183 MapType& map_;
184 OctreeType& octree_;
185 const SensorT& sensor_;
186 const se::DensePoolingImage<SensorT> depth_pooling_img_;
187 // XXX: the sigma pooling image isn't strictly necessary, we only need the sigma corresponding
188 // to the maximum depth at each depth pooling image lookup. Find a way to avoid it or combine
189 // both pooling images into one. One way to avoid it would be to also store the pixel
190 // coordinates corresponding to se::Pixel::min and se::Pixel::max in se::Pixel. Then, getting
191 // the sigma corresponding to the maximum depth would be just an image lookup.
192 const se::DensePoolingImage<SensorT> sigma_pooling_img_;
193 const Eigen::Isometry3f T_SW_;
194 const float map_res_;
195 VolumeCarverConfig config_;
196 const float max_depth_value_;
197 const float zero_depth_band_;
198 const float size_to_radius_;
199 VolumeCarverAllocation allocation_list_;
200};
201
202
203
204} // namespace se
205
206#include "impl/volume_carver_impl.hpp"
207
208#endif // SE_VOLUME_CARVER_HPP
Definition image.hpp:19
Definition map.hpp:27
The base class of all octants (se::Node and se::Block) in an se::Octree.
Definition octant.hpp:19
VolumeCarverAllocation operator()()
Allocate the frustum using a map-to-camera volume carving approach.
VolumeCarver(MapType &map, const SensorT &sensor, const se::Image< float > &depth_img, const se::Image< float > &depth_sigma_img, const Eigen::Isometry3f &T_WS, const timestamp_t timestamp)
Setup the volume carver.
Map< Data< se::Field::Occupancy, ColB, IdB >, se::Res::Multi, BlockSize > MapType
Definition volume_carver.hpp:54
Unimplemented on purpose so that the template specialization is used.
Definition volume_carver.hpp:32
VolumeCarver(MapT &, const SensorT &, const se::Image< float > &, const Eigen::Isometry3f &, const timestamp_t)
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
VarianceState
Definition volume_carver.hpp:19
Definition data.hpp:19
Definition volume_carver.hpp:21
std::vector< se::OctantBase * > block_list
Definition volume_carver.hpp:23
std::vector< bool > projects_inside_list
Definition volume_carver.hpp:25
std::vector< se::OctantBase * > node_list
Definition volume_carver.hpp:22
std::vector< se::VarianceState > variance_state_list
Definition volume_carver.hpp:24