ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
RGBDImage.cpp
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 #include "RGBDImage.h"
9 
10 #include "ecvBBox.h"
11 
12 namespace cloudViewer {
13 namespace geometry {
14 
16  color_.Clear();
17  depth_.Clear();
18  return *this;
19 }
20 
21 ccBBox RGBDImage::getOwnBB(bool withGLFeatures) {
23 }
24 
25 Eigen::Vector2d RGBDImage::GetMin2DBound() const {
26  return Eigen::Vector2d(0.0, 0.0);
27 }
28 
29 Eigen::Vector2d RGBDImage::GetMax2DBound() const {
30  return Eigen::Vector2d(color_.width_ + depth_.width_, color_.height_);
31 }
32 
34  const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type) {
35  RGBDImagePyramid rgbd_image_pyramid_filtered;
36  rgbd_image_pyramid_filtered.clear();
37  int num_of_levels = (int)rgbd_image_pyramid.size();
38  for (int level = 0; level < num_of_levels; level++) {
39  auto color_level = rgbd_image_pyramid[level]->color_;
40  auto depth_level = rgbd_image_pyramid[level]->depth_;
41  auto color_level_filtered = color_level.Filter(type);
42  auto depth_level_filtered = depth_level.Filter(type);
43  auto rgbd_image_level_filtered = std::make_shared<RGBDImage>(
44  RGBDImage(*color_level_filtered, *depth_level_filtered));
45  rgbd_image_pyramid_filtered.push_back(rgbd_image_level_filtered);
46  }
47  return rgbd_image_pyramid_filtered;
48 }
49 
51  size_t num_of_levels,
52  bool with_gaussian_filter_for_color /* = true */,
53  bool with_gaussian_filter_for_depth /* = false */) const {
54  ImagePyramid color_pyramid =
55  color_.CreatePyramid(num_of_levels, with_gaussian_filter_for_color);
56  ImagePyramid depth_pyramid =
57  depth_.CreatePyramid(num_of_levels, with_gaussian_filter_for_depth);
58  RGBDImagePyramid rgbd_image_pyramid;
59  rgbd_image_pyramid.clear();
60  for (size_t level = 0; level < num_of_levels; level++) {
61  auto rgbd_image_level = std::make_shared<RGBDImage>(
62  RGBDImage(*color_pyramid[level], *depth_pyramid[level]));
63  rgbd_image_pyramid.push_back(rgbd_image_level);
64  }
65  return rgbd_image_pyramid;
66 }
67 
68 } // namespace geometry
69 } // namespace cloudViewer
char type
Bounding box structure.
Definition: ecvBBox.h:25
virtual ccBBox GetAxisAlignedBoundingBox() const
Returns an axis-aligned bounding box of the geometry.
Definition: ecvHObject.cpp:447
int height_
Height of the image.
Definition: Image.h:221
int width_
Width of the image.
Definition: Image.h:219
ImagePyramid CreatePyramid(size_t num_of_levels, bool with_gaussian_filter=true) const
Function to create image pyramid.
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
virtual Eigen::Vector2d GetMin2DBound() const override
Definition: RGBDImage.cpp:25
Image color_
The color image.
Definition: RGBDImage.h:135
virtual Eigen::Vector2d GetMax2DBound() const override
Definition: RGBDImage.cpp:29
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:50
RGBDImage(const char *name="RGBD_Image")
Default Constructor.
Definition: RGBDImage.h:30
Image depth_
The depth image.
Definition: RGBDImage.h:137
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
Definition: RGBDImage.cpp:21
static RGBDImagePyramid FilterPyramid(const RGBDImagePyramid &rgbd_image_pyramid, Image::FilterType type)
Definition: RGBDImage.cpp:33
std::vector< std::shared_ptr< RGBDImage > > RGBDImagePyramid
Typedef and functions for RGBDImagePyramid.
Definition: RGBDImage.h:16
std::vector< std::shared_ptr< Image > > ImagePyramid
Typedef and functions for ImagePyramid.
Definition: Image.h:24
Generic file read and write utility for python interface.