ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
RGBDImage.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include "Image.h"
11 #include "ecvHObject.h"
12 
13 namespace cloudViewer {
14 namespace geometry {
15 
16 class RGBDImage;
17 
19 typedef std::vector<std::shared_ptr<RGBDImage>> RGBDImagePyramid;
20 
28 public:
30  RGBDImage(const char *name = "RGBD_Image") : ccHObject(name) {}
36  const Image &depth,
37  const char *name = "RGBD_Image")
38  : ccHObject(name), color_(color), depth_(depth) {}
39 
40  ~RGBDImage() override {
41  color_.Clear();
42  depth_.Clear();
43  };
44 
45  // inherited methods (ccHObject)
46  virtual bool isSerializable() const override { return true; }
47 
49  virtual CV_CLASS_ENUM getClassID() const override {
50  return CV_TYPES::RGBD_IMAGE;
51  }
52 
53  virtual ccBBox getOwnBB(bool withGLFeatures = false) override;
54 
55 public:
57  inline virtual bool IsEmpty() const override {
58  return !color_.HasData() || !depth_.HasData();
59  }
60 
61  virtual Eigen::Vector2d GetMin2DBound() const override;
62  virtual Eigen::Vector2d GetMax2DBound() const override;
63 
74  static std::shared_ptr<RGBDImage> CreateFromColorAndDepth(
75  const Image &color,
76  const Image &depth,
77  double depth_scale = 1000.0,
78  double depth_trunc = 3.0,
79  bool convert_rgb_to_intensity = true);
80 
87  static std::shared_ptr<RGBDImage> CreateFromRedwoodFormat(
88  const Image &color,
89  const Image &depth,
90  bool convert_rgb_to_intensity = true);
91 
98  static std::shared_ptr<RGBDImage> CreateFromTUMFormat(
99  const Image &color,
100  const Image &depth,
101  bool convert_rgb_to_intensity = true);
102 
109  static std::shared_ptr<RGBDImage> CreateFromSUNFormat(
110  const Image &color,
111  const Image &depth,
112  bool convert_rgb_to_intensity = true);
113 
120  static std::shared_ptr<RGBDImage> CreateFromNYUFormat(
121  const Image &color,
122  const Image &depth,
123  bool convert_rgb_to_intensity = true);
124 
126  const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type);
127 
129  size_t num_of_levels,
130  bool with_gaussian_filter_for_color = true,
131  bool with_gaussian_filter_for_depth = false) const;
132 
133 public:
138 };
139 
140 } // namespace geometry
141 } // namespace cloudViewer
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
#define CV_DB_LIB_API
Definition: CV_db.h:15
std::string name
char type
math::float4 color
Bounding box structure.
Definition: ecvBBox.h:25
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:33
FilterType
Specifies the Image filter type.
Definition: Image.h:52
RGBDImage is for a pair of registered color and depth images,.
Definition: RGBDImage.h:27
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.
virtual bool isSerializable() const override
Returns whether object is serializable of not.
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.
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.
Image color_
The color image.
Definition: RGBDImage.h:135
virtual Eigen::Vector2d GetMin2DBound() const override
RGBDImage(const Image &color, const Image &depth, const char *name="RGBD_Image")
Parameterized Constructor.
Definition: RGBDImage.h:35
RGBDImagePyramid CreatePyramid(size_t num_of_levels, bool with_gaussian_filter_for_color=true, bool with_gaussian_filter_for_depth=false) const
RGBDImage(const char *name="RGBD_Image")
Default Constructor.
Definition: RGBDImage.h:30
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.
Image depth_
The depth image.
Definition: RGBDImage.h:137
virtual bool IsEmpty() const override
Definition: RGBDImage.h:57
virtual CV_CLASS_ENUM getClassID() const override
Returns unique class ID.
Definition: RGBDImage.h:49
static RGBDImagePyramid FilterPyramid(const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type)
virtual Eigen::Vector2d GetMax2DBound() const override
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
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.
@ RGBD_IMAGE
Definition: CVTypes.h:158
std::vector< std::shared_ptr< RGBDImage > > RGBDImagePyramid
Typedef and functions for RGBDImagePyramid.
Definition: RGBDImage.h:16
Generic file read and write utility for python interface.