Open3D (C++ API)
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 
30 #include "Open3D/Geometry/Image.h"
31 
32 namespace open3d {
33 namespace geometry {
34 
35 class RGBDImage;
36 
38 typedef std::vector<std::shared_ptr<RGBDImage>> RGBDImagePyramid;
39 
43 class RGBDImage : public Geometry2D {
44 public:
46  RGBDImage(const Image &color, const Image &depth)
48  color_(color),
49  depth_(depth) {}
50 
51  ~RGBDImage() override {
52  color_.Clear();
53  depth_.Clear();
54  };
55 
56  RGBDImage &Clear() override;
57  bool IsEmpty() const override;
58  Eigen::Vector2d GetMinBound() const override;
59  Eigen::Vector2d GetMaxBound() const override;
60 
62  static std::shared_ptr<RGBDImage> CreateFromColorAndDepth(
63  const Image &color,
64  const Image &depth,
65  double depth_scale = 1000.0,
66  double depth_trunc = 3.0,
67  bool convert_rgb_to_intensity = true);
68 
70  static std::shared_ptr<RGBDImage> CreateFromRedwoodFormat(
71  const Image &color,
72  const Image &depth,
73  bool convert_rgb_to_intensity = true);
74 
76  static std::shared_ptr<RGBDImage> CreateFromTUMFormat(
77  const Image &color,
78  const Image &depth,
79  bool convert_rgb_to_intensity = true);
80 
82  static std::shared_ptr<RGBDImage> CreateFromSUNFormat(
83  const Image &color,
84  const Image &depth,
85  bool convert_rgb_to_intensity = true);
86 
88  static std::shared_ptr<RGBDImage> CreateFromNYUFormat(
89  const Image &color,
90  const Image &depth,
91  bool convert_rgb_to_intensity = true);
92 
93  static RGBDImagePyramid FilterPyramid(
94  const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type);
95 
96  RGBDImagePyramid CreatePyramid(
97  size_t num_of_levels,
98  bool with_gaussian_filter_for_color = true,
99  bool with_gaussian_filter_for_depth = false) const;
100 
101 public:
104 };
105 
106 } // namespace geometry
107 } // namespace open3d
static std::shared_ptr< RGBDImage > CreateFromSUNFormat(const Image &color, const Image &depth, bool convert_rgb_to_intensity=true)
Factory function to create an RGBD Image from SUN3D dataset.
Definition: RGBDImageFactory.cpp:73
static std::shared_ptr< RGBDImage > CreateFromRedwoodFormat(const Image &color, const Image &depth, bool convert_rgb_to_intensity=true)
Factory function to create an RGBD Image from Redwood dataset.
Definition: RGBDImageFactory.cpp:53
static RGBDImagePyramid FilterPyramid(const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type)
Definition: RGBDImage.cpp:50
RGBDImage()
Definition: RGBDImage.h:45
The base geometry class.
Definition: Geometry.h:35
Image depth_
Definition: RGBDImage.h:103
static std::shared_ptr< RGBDImage > CreateFromTUMFormat(const Image &color, const Image &depth, bool convert_rgb_to_intensity=true)
Factory function to create an RGBD Image from TUM dataset.
Definition: RGBDImageFactory.cpp:63
Eigen::Vector2d GetMinBound() const override
Returns min bounds for geometry coordinates.
Definition: RGBDImage.cpp:42
bool IsEmpty() const override
Returns true iff the geometry is empty.
Definition: RGBDImage.cpp:38
RGBDImage(const Image &color, const Image &depth)
Definition: RGBDImage.h:46
The base geometry class for 2D geometries.
Definition: Geometry2D.h:41
Definition: RGBDImage.h:43
static std::shared_ptr< RGBDImage > CreateFromNYUFormat(const Image &color, const Image &depth, bool convert_rgb_to_intensity=true)
Factory function to create an RGBD Image from NYU dataset.
Definition: RGBDImageFactory.cpp:94
char type
Definition: FilePCD.cpp:57
Image color_
Definition: RGBDImage.h:102
FilterType
Specifies the Image filter type.
Definition: Image.h:72
Definition: PinholeCameraIntrinsic.cpp:34
Image & Clear() override
Clear all elements in the geometry.
Definition: Image.cpp:43
~RGBDImage() override
Definition: RGBDImage.h:51
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:40
RGBDImagePyramid CreatePyramid(size_t num_of_levels, bool with_gaussian_filter_for_color=true, bool with_gaussian_filter_for_depth=false) const
Definition: RGBDImage.cpp:67
Eigen::Vector2d GetMaxBound() const override
Returns max bounds for geometry coordinates.
Definition: RGBDImage.cpp:46
static std::shared_ptr< RGBDImage > CreateFromColorAndDepth(const Image &color, const Image &depth, double depth_scale=1000.0, double depth_trunc=3.0, bool convert_rgb_to_intensity=true)
Factory function to create an RGBD Image from color and depth Images.
Definition: RGBDImageFactory.cpp:32
RGBDImage & Clear() override
Clear all elements in the geometry.
Definition: RGBDImage.cpp:32
std::vector< std::shared_ptr< RGBDImage > > RGBDImagePyramid
Typedef and functions for RGBDImagePyramid.
Definition: RGBDImage.h:35
The Image class stores image with customizable width, height, num of channels and bytes per channel...
Definition: Image.h:53