Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Model.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018-2021 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include "open3d/core/Tensor.h"
35 
36 namespace open3d {
37 namespace t {
38 namespace pipelines {
39 namespace slam {
40 
44 class Model {
45 public:
46  Model() {}
47  Model(float voxel_size,
48  int block_resolution = 16,
49  int block_count = 1000,
50  const core::Tensor& T_init = core::Tensor::Eye(4,
52  core::Device("CPU:0")),
53  const core::Device& device = core::Device("CUDA:0"));
54 
56  void UpdateFramePose(int frame_id, const core::Tensor& T_frame_to_world) {
57  if (frame_id != frame_id_ + 1) {
58  utility::LogWarning("Skipped {} frames in update T!",
59  frame_id - (frame_id_ + 1));
60  }
61  frame_id_ = frame_id;
62  T_frame_to_world_ = T_frame_to_world.Contiguous();
63  }
64 
77  void SynthesizeModelFrame(Frame& raycast_frame,
78  float depth_scale = 1000.0,
79  float depth_min = 0.1,
80  float depth_max = 3.0,
81  float trunc_voxel_multiplier = 8.0,
82  bool enable_color = true,
83  float weight_threshold = -1.0);
84 
96  const Frame& input_frame,
97  const Frame& raycast_frame,
98  float depth_scale = 1000.0,
99  float depth_max = 3.0,
100  float depth_diff = 0.07,
102  const std::vector<odometry::OdometryConvergenceCriteria>& criteria =
103  {6, 3, 1});
104 
113  void Integrate(const Frame& input_frame,
114  float depth_scale = 1000.0,
115  float depth_max = 3.0,
116  float trunc_voxel_multiplier = 8.0f);
117 
124  t::geometry::PointCloud ExtractPointCloud(float weight_threshold = 3.0f,
125  int estimated_number = -1);
126 
133  t::geometry::TriangleMesh ExtractTriangleMesh(float weight_threshold = 3.0f,
134  int estimated_number = -1);
135 
138 
139 public:
142 
145 
149 
150  int frame_id_ = -1;
151 };
152 
153 } // namespace slam
154 } // namespace pipelines
155 } // namespace t
156 } // namespace open3d
core::Tensor GetCurrentFramePose() const
Definition: Model.h:55
core::Tensor frustum_block_coords_
Active block coordinates from prior integration.
Definition: Model.h:144
void Integrate(const Frame &input_frame, float depth_scale=1000.0, float depth_max=3.0, float trunc_voxel_multiplier=8.0f)
Definition: Model.cpp:110
t::geometry::TriangleMesh ExtractTriangleMesh(float weight_threshold=3.0f, int estimated_number=-1)
Definition: Model.cpp:132
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:111
Model()
Definition: Model.h:46
Definition: Model.h:44
core::HashMap GetHashMap()
Get block hashmap int the VoxelBlockGrid.
Definition: Model.cpp:137
int frame_id_
Definition: Model.h:150
#define LogWarning(...)
Definition: Logging.h:79
core::Tensor T_frame_to_world_
Definition: Model.h:148
Tensor Contiguous() const
Definition: Tensor.cpp:758
Definition: Device.h:37
A point cloud contains a list of 3D points.
Definition: PointCloud.h:99
t::geometry::VoxelBlockGrid voxel_grid_
Maintained volumetric map.
Definition: Model.h:141
odometry::OdometryResult TrackFrameToModel(const Frame &input_frame, const Frame &raycast_frame, float depth_scale=1000.0, float depth_max=3.0, float depth_diff=0.07, odometry::Method method=odometry::Method::PointToPlane, const std::vector< odometry::OdometryConvergenceCriteria > &criteria={6, 3, 1})
Definition: Model.cpp:87
Definition: HashMap.h:41
Definition: PinholeCameraIntrinsic.cpp:35
Definition: VoxelBlockGrid.h:45
void UpdateFramePose(int frame_id, const core::Tensor &T_frame_to_world)
Definition: Model.h:56
const Dtype Float64
Definition: Dtype.cpp:62
void SynthesizeModelFrame(Frame &raycast_frame, float depth_scale=1000.0, float depth_min=0.1, float depth_max=3.0, float trunc_voxel_multiplier=8.0, bool enable_color=true, float weight_threshold=-1.0)
Definition: Model.cpp:57
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:404
Method
Definition: RGBDOdometry.h:42
t::geometry::PointCloud ExtractPointCloud(float weight_threshold=3.0f, int estimated_number=-1)
Definition: Model.cpp:127
Frame is a container class storing an intrinsic matrix and several 2D tensors, from depth map...
Definition: Frame.h:40