Open3D (C++ API)  0.12.0
RGBDImage.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 
31 
32 namespace open3d {
33 namespace t {
34 namespace geometry {
35 
40 class RGBDImage : public Geometry {
41 public:
50  RGBDImage(const Image &color, const Image &depth, bool aligned = true)
52  color_(color),
53  depth_(depth),
54  aligned_(aligned) {
55  if (color.GetRows() != depth.GetRows() ||
56  color.GetCols() != depth.GetCols()) {
57  aligned_ = false;
59  "Aligned image pair must have the same resolution.");
60  }
61  }
62 
63  ~RGBDImage() override{};
64 
66  RGBDImage &Clear() override;
67 
69  bool IsEmpty() const override;
70 
72  bool AreAligned() const { return aligned_; }
73 
77  };
78 
81  return core::Tensor(
82  std::vector<int64_t>{color_.GetCols() + depth_.GetCols(),
83  color_.GetRows()},
84  {2}, core::Dtype::Int64);
85  };
86 
91  }
92 
94  std::string ToString() const;
95 
96 public:
102  bool aligned_ = true;
103 };
104 
105 } // namespace geometry
106 } // namespace t
107 } // namespace open3d
RGBDImage()
Default Comnstructor.
Definition: RGBDImage.h:43
bool AreAligned() const
Are the depth and color images aligned (same viewpoint and resolution)?
Definition: RGBDImage.h:72
int64_t GetRows() const
Get the number of rows of the image.
Definition: Image.h:93
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:43
void LogWarning(const char *format, const Args &... args)
Definition: Console.h:181
bool IsEmpty() const override
Is any data stored?
Definition: RGBDImage.cpp:39
core::Tensor GetMaxBound() const
Compute max 2D coordinates for the data.
Definition: RGBDImage.h:80
The Image class stores image with customizable rols, cols, channels, dtype and device.
Definition: Image.h:45
math::float4 color
Definition: LineSetBuffers.cpp:64
core::Tensor GetMinBound() const
Compute min 2D coordinates for the data (always {0,0}).
Definition: RGBDImage.h:75
bool aligned_
Are the depth and color images aligned (same viewpoint and resolution)?
Definition: RGBDImage.h:102
open3d::geometry::Image ToLegacyImage() const
Convert to legacy Image type.
Definition: Image.cpp:101
int64_t GetCols() const
Get the number of columns of the image.
Definition: Image.h:96
RGBDImage is for a pair of registered color and depth images,.
Definition: RGBDImage.h:46
RGBDImage(const Image &color, const Image &depth, bool aligned=true)
Parameterized Constructor.
Definition: RGBDImage.h:50
std::string ToString() const
Text description.
Definition: RGBDImage.cpp:41
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Definition: Tensor.cpp:182
open3d::geometry::RGBDImage ToLegacyRGBDImage() const
Convert to the legacy RGBDImage format.
Definition: RGBDImage.h:88
The base geometry class.
Definition: Geometry.h:38
static const Dtype Int64
Definition: Dtype.h:45
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Tensor.h:48
RGBDImage A pair of color and depth images.
Definition: RGBDImage.h:40
Image color_
The color image.
Definition: RGBDImage.h:98
~RGBDImage() override
Definition: RGBDImage.h:63
RGBDImage & Clear() override
Clear stored data.
Definition: RGBDImage.cpp:33
Image depth_
The depth image.
Definition: RGBDImage.h:100