12 #include <Eigen/StdVector> 22 Image(
const unsigned w,
const unsigned h) : width_(w), height_(h), data_(width_ * height_)
24 assert(width_ > 0 && height_ > 0);
27 Image(
const unsigned w,
const unsigned h,
const T& val) : width_(w), height_(h)
29 assert(width_ > 0 && height_ > 0);
30 data_.resize(width_ * height_, val);
44 return data_[x + y * width_];
48 return data_[x + y * width_];
53 return width_ * height_;
76 std::vector<T, Eigen::aligned_allocator<T>> data_;
80 static_assert(!std::is_same<T, bool>::value,
81 "Use char/uint8_t instead of bool to avoid the std::vector<bool> specialization");
87 uint32_t* output_rgba_img_data)
89 memcpy(output_rgba_img_data,
90 input_rgba_img.
data(),
91 input_rgba_img.
width() * input_rgba_img.
height() *
sizeof(uint32_t));
97 uint32_t* output_depth_img_data)
100 input_depth_img.
data(),
101 Eigen::Vector2i(input_depth_img.
width(), input_depth_img.
height()),
103 std::numeric_limits<float>::max());
109 const float min_depth,
110 const float max_depth,
111 uint32_t* output_depth_img_data)
114 input_depth_img.
data(),
115 Eigen::Vector2i(input_depth_img.
width(), input_depth_img.
height()),
124 #endif // SE_IMAGE_HPP const T & operator()(const int x, const int y) const
Definition: image.hpp:46
int width() const
Definition: image.hpp:55
std::size_t size() const
Definition: image.hpp:51
static void convert_to_output_rgba_img(const se::Image< uint32_t > &input_rgba_img, uint32_t *output_rgba_img_data)
Definition: image.hpp:86
int height() const
Definition: image.hpp:59
Image(const unsigned w, const unsigned h, const T &val)
Definition: image.hpp:27
const T & operator[](std::size_t idx) const
Definition: image.hpp:37
T & operator[](std::size_t idx)
Definition: image.hpp:33
const T * data() const
Definition: image.hpp:68
static void convert_to_output_depth_img(const se::Image< float > &input_depth_img, uint32_t *output_depth_img_data)
Definition: image.hpp:96
void depth_to_rgba(uint32_t *depth_RGBA_image_data, const float *depth_image_data, const Eigen::Vector2i &depth_image_res, const float min_depth, const float max_depth)
Convert a depth image to an RGBA image to allow visualizing it.
Image(const unsigned w, const unsigned h)
Definition: image.hpp:22
T & operator()(const int x, const int y)
Definition: image.hpp:42
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
T * data()
Definition: image.hpp:64