Open3D (C++ API)  0.18.0+0cf605f
ImageIO.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <string>
11 
12 #include "open3d/io/ImageIO.h"
14 
15 namespace open3d {
16 namespace t {
17 namespace io {
18 
21 std::shared_ptr<geometry::Image> CreateImageFromFile(
22  const std::string &filename);
23 
30 bool ReadImage(const std::string &filename, geometry::Image &image);
31 
32 constexpr int kOpen3DImageIODefaultQuality = -1;
33 
54 bool WriteImage(const std::string &filename,
55  const geometry::Image &image,
56  int quality = kOpen3DImageIODefaultQuality);
57 
58 bool ReadImageFromPNG(const std::string &filename, geometry::Image &image);
59 
60 bool WriteImageToPNG(const std::string &filename,
61  const geometry::Image &image,
62  int quality = kOpen3DImageIODefaultQuality);
63 
64 bool WriteImageToPNGInMemory(std::vector<uint8_t> &output_buffer,
65  const geometry::Image &image,
66  int quality = kOpen3DImageIODefaultQuality);
67 
68 bool ReadImageFromJPG(const std::string &filename, geometry::Image &image);
69 
70 bool WriteImageToJPG(const std::string &filename,
71  const geometry::Image &image,
72  int quality = kOpen3DImageIODefaultQuality);
73 
79 public:
84  explicit DepthNoiseSimulator(const std::string &noise_model_path);
85 
96  float depth_scale = 1000.0);
97 
99  core::Tensor GetNoiseModel() const { return model_; }
100 
103  void EnableDeterministicDebugMode() { deterministic_debug_mode_ = true; }
104 
105 private:
106  core::Tensor model_; // ndims==3
107  bool deterministic_debug_mode_ = false;
108 };
109 
110 } // namespace io
111 } // namespace t
112 } // namespace open3d
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:183
Definition: Tensor.h:32
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
Definition: ImageIO.h:78
DepthNoiseSimulator(const std::string &noise_model_path)
Constructor.
Definition: ImageIO.cpp:88
geometry::Image Simulate(const geometry::Image &im_src, float depth_scale=1000.0)
Apply noise model to a depth image.
Definition: ImageIO.cpp:146
core::Tensor GetNoiseModel() const
Return the noise model.
Definition: ImageIO.h:99
void EnableDeterministicDebugMode()
Enable deterministic debug mode. All normally distributed noise will be replaced by 0.
Definition: ImageIO.h:103
bool WriteImageToPNG(const std::string &filename, const geometry::Image &image, int quality)
Definition: FilePNG.cpp:72
bool ReadImageFromJPG(const std::string &filename, geometry::Image &image)
Definition: FileJPG.cpp:22
bool ReadImageFromPNG(const std::string &filename, geometry::Image &image)
Definition: FilePNG.cpp:38
bool WriteImageToPNGInMemory(std::vector< uint8_t > &buffer, const t::geometry::Image &image, int quality)
Definition: FilePNG.cpp:106
bool WriteImageToJPG(const std::string &filename, const geometry::Image &image, int quality)
Definition: FileJPG.cpp:83
bool WriteImage(const std::string &filename, const geometry::Image &image, int quality)
Definition: ImageIO.cpp:69
constexpr int kOpen3DImageIODefaultQuality
Definition: ImageIO.h:32
std::shared_ptr< geometry::Image > CreateImageFromFile(const std::string &filename)
Definition: ImageIO.cpp:44
bool ReadImage(const std::string &filename, geometry::Image &image)
Definition: ImageIO.cpp:51
Definition: PinholeCameraIntrinsic.cpp:16