Open3D (C++ API)  0.11.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 
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 
46 class RGBDImage : public Geometry2D {
47 public:
54  RGBDImage(const Image &color, const Image &depth)
56  color_(color),
57  depth_(depth) {}
58 
59  ~RGBDImage() override {
60  color_.Clear();
61  depth_.Clear();
62  };
63 
64  RGBDImage &Clear() override;
65  bool IsEmpty() const override;
66  Eigen::Vector2d GetMinBound() const override;
67  Eigen::Vector2d GetMaxBound() const override;
68 
79  static std::shared_ptr<RGBDImage> CreateFromColorAndDepth(
80  const Image &color,
81  const Image &depth,
82  double depth_scale = 1000.0,
83  double depth_trunc = 3.0,
84  bool convert_rgb_to_intensity = true);
85 
92  static std::shared_ptr<RGBDImage> CreateFromRedwoodFormat(
93  const Image &color,
94  const Image &depth,
95  bool convert_rgb_to_intensity = true);
96 
103  static std::shared_ptr<RGBDImage> CreateFromTUMFormat(
104  const Image &color,
105  const Image &depth,
106  bool convert_rgb_to_intensity = true);
107 
114  static std::shared_ptr<RGBDImage> CreateFromSUNFormat(
115  const Image &color,
116  const Image &depth,
117  bool convert_rgb_to_intensity = true);
118 
125  static std::shared_ptr<RGBDImage> CreateFromNYUFormat(
126  const Image &color,
127  const Image &depth,
128  bool convert_rgb_to_intensity = true);
129 
130  static RGBDImagePyramid FilterPyramid(
131  const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type);
132 
133  RGBDImagePyramid CreatePyramid(
134  size_t num_of_levels,
135  bool with_gaussian_filter_for_color = true,
136  bool with_gaussian_filter_for_depth = false) const;
137 
138 public:
143 };
144 
145 } // namespace geometry
146 } // 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()
Default Comnstructor.
Definition: RGBDImage.h:49
The base geometry class.
Definition: Geometry.h:37
Image depth_
The depth image.
Definition: RGBDImage.h:142
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
math::float4 color
Definition: LineSetBuffers.cpp:63
RGBDImage(const Image &color, const Image &depth)
Parameterized Constructor.
Definition: RGBDImage.h:54
The base geometry class for 2D geometries.
Definition: Geometry2D.h:41
RGBDImage is for a pair of registered color and depth images,.
Definition: RGBDImage.h:46
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:60
Image color_
The color image.
Definition: RGBDImage.h:140
FilterType
Specifies the Image filter type.
Definition: Image.h:72
Definition: PinholeCameraIntrinsic.cpp:35
Image & Clear() override
Clear all elements in the geometry.
Definition: Image.cpp:43
~RGBDImage() override
Definition: RGBDImage.h:59
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:42
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