Loading [MathJax]/extensions/TeX/AMSsymbols.js
Open3D (C++ API)  0.15.1
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,
49  int block_count,
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 
71  void SynthesizeModelFrame(Frame& raycast_frame,
72  float depth_scale,
73  float depth_min,
74  float depth_max,
75  float trunc_voxel_multiplier = 8.0,
76  bool enable_color = true);
77 
86  const Frame& raycast_frame,
87  float depth_scale,
88  float depth_max,
89  float depth_diff);
90 
96  void Integrate(const Frame& input_frame,
97  float depth_scale,
98  float depth_max,
99  float trunc_voxel_multiplier = 8.0f);
100 
107  t::geometry::PointCloud ExtractPointCloud(float weight_threshold = 3.0f,
108  int estimated_number = -1);
109 
116  t::geometry::TriangleMesh ExtractTriangleMesh(float weight_threshold = 3.0f,
117  int estimated_number = -1);
118 
121 
122 public:
126 
130 
131  int frame_id_ = -1;
132 };
133 } // namespace slam
134 } // namespace pipelines
135 } // namespace t
136 } // namespace open3d
core::Tensor frustum_block_coords_
Definition: Model.h:125
t::geometry::TriangleMesh ExtractTriangleMesh(float weight_threshold=3.0f, int estimated_number=-1)
Definition: Model.cpp:123
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:106
Model()
Definition: Model.h:46
Definition: Model.h:44
core::HashMap GetHashMap()
Get block hashmap int the VoxelBlockGrid.
Definition: Model.cpp:128
int frame_id_
Definition: Model.h:131
#define LogWarning(...)
Definition: Logging.h:79
core::Tensor T_frame_to_world_
Definition: Model.h:129
void SynthesizeModelFrame(Frame &raycast_frame, float depth_scale, float depth_min, float depth_max, float trunc_voxel_multiplier=8.0, bool enable_color=true)
Definition: Model.cpp:57
Tensor Contiguous() const
Definition: Tensor.cpp:746
Definition: Device.h:39
A point cloud contains a list of 3D points.
Definition: PointCloud.h:95
t::geometry::VoxelBlockGrid voxel_grid_
Maintained volumetric map.
Definition: Model.h:124
odometry::OdometryResult TrackFrameToModel(const Frame &input_frame, const Frame &raycast_frame, float depth_scale, float depth_max, float depth_diff)
Definition: Model.cpp:81
Definition: HashMap.h:40
Definition: PinholeCameraIntrinsic.cpp:35
core::Tensor GetCurrentFramePose()
Definition: Model.h:55
Definition: VoxelBlockGrid.h:45
void Integrate(const Frame &input_frame, float depth_scale, float depth_max, float trunc_voxel_multiplier=8.0f)
Definition: Model.cpp:101
void UpdateFramePose(int frame_id, const core::Tensor &T_frame_to_world)
Definition: Model.h:56
const Dtype Float64
Definition: Dtype.cpp:62
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:392
t::geometry::PointCloud ExtractPointCloud(float weight_threshold=3.0f, int estimated_number=-1)
Definition: Model.cpp:118
Frame is a container class storing an intrinsic matrix and several 2D tensors, from depth map...
Definition: Frame.h:40