supereight
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::Semantics SemB, int BlockSize, typename SensorT>
53 SensorT> {
54 public:
56 typedef typename MapType::OctreeType OctreeType;
57 typedef typename OctreeType::NodeType NodeType;
58 typedef typename OctreeType::BlockType BlockType;
59
65 struct VolumeCarverConfig {
67 sigma_min(map.getDataConfig().field.sigma_min_factor * map.getRes()),
68 sigma_max(map.getDataConfig().field.sigma_max_factor * map.getRes()),
69 tau_min(map.getDataConfig().field.tau_min_factor * map.getRes()),
70 tau_max(map.getDataConfig().field.tau_max_factor * map.getRes())
71 {
72 }
73
74 const float sigma_min;
75 const float sigma_max;
76 const float tau_min;
77 const float tau_max;
78 };
79
80
92 const SensorT& sensor,
95 const Eigen::Isometry3f& T_WS,
96 const timestamp_t timestamp);
97
102
103 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
104
105
106
107 private:
115 bool crossesFrustum(std::vector<srl::projection::ProjectionStatus>& proj_corner_stati);
116
126 bool cameraInNode(const Eigen::Vector3i& node_coord,
127 const int node_size,
128 const Eigen::Isometry3f& T_WS);
129
142 se::VarianceState computeVariance(const float depth_value_min,
143 const float depth_value_max,
144 const float node_dist_min_m,
145 const float node_dist_max_m,
146 const float std_dev_max);
147
159 template<class SensorTDummy = SensorT>
160 typename std::enable_if_t<std::is_same<SensorTDummy, se::PinholeCamera>::value, void>
161 operator()(const Eigen::Vector3i& octant_coord,
162 const int octant_size,
163 const int octant_depth,
165
177 template<class SensorTDummy = SensorT>
178 typename std::enable_if_t<std::is_same<SensorTDummy, se::OusterLidar>::value, void>
179 operator()(const Eigen::Vector3i& octant_coord,
180 const int octant_size,
181 const int octant_depth,
183
184 MapType& map_;
185 OctreeType& octree_;
186 const SensorT& sensor_;
187 const se::DensePoolingImage<SensorT> depth_pooling_img_;
188 // XXX: the sigma pooling image isn't strictly necessary, we only need the sigma corresponding
189 // to the maximum depth at each depth pooling image lookup. Find a way to avoid it or combine
190 // both pooling images into one. One way to avoid it would be to also store the pixel
191 // coordinates corresponding to se::Pixel::min and se::Pixel::max in se::Pixel. Then, getting
192 // the sigma corresponding to the maximum depth would be just an image lookup.
193 const se::DensePoolingImage<SensorT> sigma_pooling_img_;
194 const Eigen::Isometry3f T_SW_;
195 const float map_res_;
196 VolumeCarverConfig config_;
197 const float max_depth_value_;
198 const float zero_depth_band_;
199 const float size_to_radius_;
200 VolumeCarverAllocation allocation_list_;
201};
202
203
204
205} // namespace se
206
207#include "impl/volume_carver_impl.hpp"
208
209#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
Map< Data< se::Field::Occupancy, ColB, SemB >, se::Res::Multi, BlockSize > MapType
Definition volume_carver.hpp:55
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.
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