supereight
image_utils.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2019-2021 Smart Robotics Lab, Imperial College London, Technical University of Munich
3  * SPDX-FileCopyrightText: 2019-2021 Nils Funk
4  * SPDX-FileCopyrightText: 2019-2021 Sotiris Papatheodorou
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef SE_IMAGE_UTILS_HPP
9 #define SE_IMAGE_UTILS_HPP
10 
11 #include <Eigen/Dense>
12 #include <cstdint>
13 #include <string>
14 
15 
16 
17 namespace se {
32 int save_depth_png(const float* depth_image_data,
33  const Eigen::Vector2i& depth_image_res,
34  const std::string& filename,
35  const float scale = 1000.0f);
36 
37 
38 
48 int save_depth_png(const uint16_t* depth_image_data,
49  const Eigen::Vector2i& depth_image_res,
50  const std::string& filename);
51 
52 
53 
72 int load_depth_png(float** depth_image_data,
73  Eigen::Vector2i& depth_image_res,
74  const std::string& filename,
75  const float inverse_scale = 1.0f / 1000.0f);
76 
77 
78 
92 int load_depth_png(uint16_t** depth_image_data,
93  Eigen::Vector2i& depth_image_res,
94  const std::string& filename);
95 
96 
97 
115 int save_depth_pgm(const float* depth_image_data,
116  const Eigen::Vector2i& depth_image_res,
117  const std::string& filename,
118  const float scale = 1000.0f);
119 
120 
121 
134 int save_depth_pgm(const uint16_t* depth_image_data,
135  const Eigen::Vector2i& depth_image_res,
136  const std::string& filename);
137 
138 
139 
158 int load_depth_pgm(float** depth_image_data,
159  Eigen::Vector2i& depth_image_res,
160  const std::string& filename,
161  const float inverse_scale = 1.0f / 1000.0f);
162 
163 
164 
178 int load_depth_pgm(uint16_t** depth_image_data,
179  Eigen::Vector2i& depth_image_res,
180  const std::string& filename);
181 
182 
183 
184 static inline Eigen::Vector2i round_pixel(const Eigen::Vector2f& pixel_f);
185 
186 } // namespace se
187 
188 #include "impl/image_utils_impl.hpp"
189 
190 #endif // SE_IMAGE_UTILS_HPP
int load_depth_pgm(float **depth_image_data, Eigen::Vector2i &depth_image_res, const std::string &filename, const float inverse_scale=1.0f/1000.0f)
Load a P2 PGM depth image into a buffer with depth values in metres.
int save_depth_pgm(const float *depth_image_data, const Eigen::Vector2i &depth_image_res, const std::string &filename, const float scale=1000.0f)
Save a depth image with depth values in metres to a P2 PGM.
static Eigen::Vector2i round_pixel(const Eigen::Vector2f &pixel_f)
int save_depth_png(const float *depth_image_data, const Eigen::Vector2i &depth_image_res, const std::string &filename, const float scale=1000.0f)
Save a depth image with depth values in metres to a PNG.
int load_depth_png(float **depth_image_data, Eigen::Vector2i &depth_image_res, const std::string &filename, const float inverse_scale=1.0f/1000.0f)
Load a PNG depth image into a buffer with depth values in metres.
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
static const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > scale
The colours used for the various integration scales.
Definition: colour_utils.hpp:22