Open3D (C++ API)  0.18.0+fcf98ee
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/geometry/Image.h"
13 
14 namespace open3d {
15 namespace io {
16 
19 std::shared_ptr<geometry::Image> CreateImageFromFile(
20  const std::string &filename);
21 
23 std::shared_ptr<geometry::Image> CreateImageFromMemory(
24  const std::string &image_format,
25  const unsigned char *image_data_ptr,
26  size_t image_data_size);
27 
31 bool ReadImage(const std::string &filename, geometry::Image &image);
32 
39 bool ReadImageFromMemory(const std::string &image_format,
40  const unsigned char *image_data_ptr,
41  size_t image_data_size,
42  geometry::Image &image);
43 
44 constexpr int kOpen3DImageIODefaultQuality = -1;
45 
56 bool WriteImage(const std::string &filename,
57  const geometry::Image &image,
58  int quality = kOpen3DImageIODefaultQuality);
59 
60 bool ReadImageFromPNG(const std::string &filename, geometry::Image &image);
61 
62 bool WriteImageToPNG(const std::string &filename,
63  const geometry::Image &image,
64  int quality = kOpen3DImageIODefaultQuality);
65 
66 bool ReadImageFromJPG(const std::string &filename, geometry::Image &image);
67 
68 bool WriteImageToJPG(const std::string &filename,
69  const geometry::Image &image,
70  int quality = kOpen3DImageIODefaultQuality);
71 
76 bool ReadPNGFromMemory(const unsigned char *image_data_ptr,
77  size_t image_data_size,
79 
84 bool ReadJPGFromMemory(const unsigned char *image_data_ptr,
85  size_t image_data_size,
87 
88 } // namespace io
89 } // namespace open3d
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:183
filament::Texture::Format image_format
Definition: FilamentResourceManager.cpp:193
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:34
std::shared_ptr< geometry::Image > CreateImageFromFile(const std::string &filename)
Definition: ImageIO.cpp:40
bool WriteImageToPNG(const std::string &filename, const geometry::Image &image, int quality)
Definition: FilePNG.cpp:72
constexpr int kOpen3DImageIODefaultQuality
Definition: ImageIO.h:44
std::shared_ptr< geometry::Image > CreateImageFromMemory(const std::string &image_format, const unsigned char *image_data_ptr, size_t image_data_size)
Factory function to create an image from memory.
Definition: ImageIO.cpp:90
bool WriteImageToJPG(const std::string &filename, const geometry::Image &image, int quality)
Definition: FileJPG.cpp:107
bool ReadImageFromJPG(const std::string &filename, geometry::Image &image)
Definition: FileJPG.cpp:38
bool ReadImageFromPNG(const std::string &filename, geometry::Image &image)
Definition: FilePNG.cpp:43
bool ReadJPGFromMemory(const unsigned char *image_data_ptr, size_t image_data_size, geometry::Image &image)
Definition: FileJPG.cpp:172
bool ReadImageFromMemory(const std::string &image_format, const unsigned char *image_data_ptr, size_t image_data_size, geometry::Image &image)
Definition: ImageIO.cpp:99
bool ReadImage(const std::string &filename, geometry::Image &image)
Definition: ImageIO.cpp:47
bool ReadPNGFromMemory(const unsigned char *image_data_ptr, size_t image_data_size, geometry::Image &image)
Definition: FilePNG.cpp:100
bool WriteImage(const std::string &filename, const geometry::Image &image, int quality)
Definition: ImageIO.cpp:71
Definition: PinholeCameraIntrinsic.cpp:16