Open3D (C++ API)  0.13.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 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"
36 
37 namespace open3d {
38 namespace t {
39 namespace pipelines {
40 namespace voxelhashing {
41 
45 class Model {
46 public:
47  Model() {}
48  Model(float voxel_size,
49  float sdf_trunc,
50  int block_resolution,
51  int block_count,
52  const core::Tensor& T_init = core::Tensor::Eye(4,
54  core::Device("CPU:0")),
55  const core::Device& device = core::Device("CUDA:0"));
56 
58  void UpdateFramePose(int frame_id, const core::Tensor& T_frame_to_world) {
59  if (frame_id != frame_id_ + 1) {
60  utility::LogWarning("Skipped {} frames in update T!",
61  frame_id - (frame_id_ + 1));
62  }
63  frame_id_ = frame_id;
64  T_frame_to_world_ = T_frame_to_world.Contiguous();
65  }
66 
73  void SynthesizeModelFrame(Frame& raycast_frame,
74  float depth_scale,
75  float depth_min,
76  float depth_max,
77  bool enable_color = true);
78 
87  const Frame& raycast_frame,
88  float depth_scale,
89  float depth_max,
90  float depth_diff);
91 
97  void Integrate(const Frame& input_frame,
98  float depth_scale,
99  float depth_max);
100 
107  t::geometry::PointCloud ExtractPointCloud(int estimated_number = -1,
108  float weight_threshold = 3.0f);
109 
117  int estimated_number = -1, float weight_threshold = 3.0f);
118 
121 
122 public:
125 
129 
130  int frame_id_ = -1;
131 };
132 } // namespace voxelhashing
133 } // namespace pipelines
134 } // namespace t
135 } // namespace open3d
void Integrate(const Frame &input_frame, float depth_scale, float depth_max)
Definition: Model.cpp:100
int frame_id_
Definition: Model.h:130
#define LogWarning(...)
Definition: Console.h:95
A TriangleMesh contains vertices and triangles.
Definition: TriangleMesh.h:106
void SynthesizeModelFrame(Frame &raycast_frame, float depth_scale, float depth_min, float depth_max, bool enable_color=true)
Definition: Model.cpp:58
Tensor Contiguous() const
Definition: Tensor.cpp:571
Definition: Device.h:39
A pointcloud contains a set of 3D points.
Definition: PointCloud.h:95
void UpdateFramePose(int frame_id, const core::Tensor &T_frame_to_world)
Definition: Model.h:58
Definition: TSDFVoxelGrid.h:57
odometry::OdometryResult TrackFrameToModel(const Frame &input_frame, const Frame &raycast_frame, float depth_scale, float depth_max, float depth_diff)
Definition: Model.cpp:80
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Tensor.h:50
Frame is a container class storing an intrinsic matrix and several 2D tensors, from depth map...
Definition: Frame.h:41
Definition: Hashmap.h:40
static Tensor Eye(int64_t n, Dtype dtype, const Device &device)
Create an identity matrix of size n x n.
Definition: Tensor.cpp:252
core::Hashmap GetHashmap()
Get block hashmap int the TSDFVoxelGrid.
Definition: Model.cpp:120
core::Tensor GetCurrentFramePose()
Definition: Model.h:57
static const Dtype Float64
Definition: Dtype.h:43
t::geometry::TSDFVoxelGrid voxel_grid_
Maintained volumetric map.
Definition: Model.h:124
t::geometry::TriangleMesh ExtractTriangleMesh(int estimated_number=-1, float weight_threshold=3.0f)
Definition: Model.cpp:115
t::geometry::PointCloud ExtractPointCloud(int estimated_number=-1, float weight_threshold=3.0f)
Definition: Model.cpp:110
core::Tensor T_frame_to_world_
Definition: Model.h:128