Open3D (C++ API)  0.18.0+252c867
Frame.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "open3d/core/Tensor.h"
13 
14 namespace open3d {
15 namespace t {
16 namespace pipelines {
17 namespace slam {
18 
21 class Frame {
22 public:
24  int width,
25  const core::Tensor& intrinsics,
26  const core::Device& device)
27  : height_(height),
28  width_(width),
29  intrinsics_(intrinsics),
30  device_(device) {}
31 
32  int GetHeight() const { return height_; }
33  int GetWidth() const { return width_; }
34 
35  void SetIntrinsics(const core::Tensor& intrinsics) {
36  intrinsics_ = intrinsics;
37  }
38  core::Tensor GetIntrinsics() const { return intrinsics_; }
39 
40  void SetData(const std::string& name, const core::Tensor& data) {
41  data_[name] = data.To(device_);
42  }
43  core::Tensor GetData(const std::string& name) const {
44  if (data_.count(name) == 0) {
46  "Property not found for {}, return an empty tensor!", name);
47  return core::Tensor();
48  }
49  return data_.at(name);
50  }
51 
52  // Convenient interface for images
53  void SetDataFromImage(const std::string& name,
54  const t::geometry::Image& data) {
55  SetData(name, data.AsTensor());
56  }
57 
58  t::geometry::Image GetDataAsImage(const std::string& name) const {
60  }
61 
62 private:
63  int height_;
64  int width_;
65 
66  // (3, 3) intrinsic matrix for a pinhole camera
67  core::Tensor intrinsics_;
68  core::Device device_;
69 
70  // Maintained maps, including:
71  // depth_map: (H, W, 1), Float32 AFTER preprocessing
72  // vertex_map: (H, W, 3), Float32,
73  // color_map: (H, W, 3), Float32
74  // normal_map: (H, W, 3), Float32
75  std::unordered_map<std::string, core::Tensor> data_;
76 };
77 
78 } // namespace slam
79 } // namespace pipelines
80 } // namespace t
81 } // namespace open3d
#define LogWarning(...)
Definition: Logging.h:60
Definition: Device.h:18
Definition: Tensor.h:32
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
Frame is a container class storing an intrinsic matrix and several 2D tensors, from depth map,...
Definition: Frame.h:21
void SetDataFromImage(const std::string &name, const t::geometry::Image &data)
Definition: Frame.h:53
void SetData(const std::string &name, const core::Tensor &data)
Definition: Frame.h:40
int GetHeight() const
Definition: Frame.h:32
t::geometry::Image GetDataAsImage(const std::string &name) const
Definition: Frame.h:58
int GetWidth() const
Definition: Frame.h:33
core::Tensor GetData(const std::string &name) const
Definition: Frame.h:43
void SetIntrinsics(const core::Tensor &intrinsics)
Definition: Frame.h:35
core::Tensor GetIntrinsics() const
Definition: Frame.h:38
Frame(int height, int width, const core::Tensor &intrinsics, const core::Device &device)
Definition: Frame.h:23
int width
Definition: FilePCD.cpp:52
std::string name
Definition: FilePCD.cpp:39
int height
Definition: FilePCD.cpp:53
const char const char value recording_handle imu_sample recording_handle uint8_t data
Definition: K4aPlugin.cpp:269
Definition: PinholeCameraIntrinsic.cpp:16