ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ImageIO.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 
12 #include <string>
13 
14 #include "CV_io.h"
15 
16 namespace cloudViewer {
17 namespace io {
18 
21 std::shared_ptr<geometry::Image> CV_IO_LIB_API
22 CreateImageFromFile(const std::string &filename);
23 
25 std::shared_ptr<geometry::Image> CV_IO_LIB_API
27  const unsigned char *image_data_ptr,
28  size_t image_data_size);
29 
33 bool CV_IO_LIB_API ReadImage(const std::string &filename,
35 
43  const unsigned char *image_data_ptr,
44  size_t image_data_size,
46 
48 
59 bool CV_IO_LIB_API WriteImage(const std::string &filename,
60  const geometry::Image &image,
61  int quality = kCloudViewerImageIODefaultQuality);
62 
63 bool CV_IO_LIB_API ReadImageFromPNG(const std::string &filename,
65 
70 bool CV_IO_LIB_API ReadPNGFromMemory(const unsigned char *image_data_ptr,
71  size_t image_data_size,
73 
74 bool CV_IO_LIB_API
75 WriteImageToPNG(const std::string &filename,
76  const geometry::Image &image,
77  int quality = kCloudViewerImageIODefaultQuality);
78 
79 bool CV_IO_LIB_API ReadImageFromJPG(const std::string &filename,
81 
86 bool CV_IO_LIB_API ReadJPGFromMemory(const unsigned char *image_data_ptr,
87  size_t image_data_size,
89 
90 bool CV_IO_LIB_API
91 WriteImageToJPG(const std::string &filename,
92  const geometry::Image &image,
93  int quality = kCloudViewerImageIODefaultQuality);
94 
95 } // namespace io
96 } // namespace cloudViewer
std::string filename
#define CV_IO_LIB_API
Definition: CV_io.h:15
std::shared_ptr< core::Tensor > image
filament::Texture::Format image_format
The Image class stores image with customizable width, height, num of channels and bytes per channel.
Definition: Image.h:33
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.
bool WriteImage(const std::string &filename, const geometry::Image &image, int quality=kCloudViewerImageIODefaultQuality)
bool ReadImageFromJPG(const std::string &filename, geometry::Image &image)
constexpr int kCloudViewerImageIODefaultQuality
Definition: ImageIO.h:47
bool ReadJPGFromMemory(const unsigned char *image_data_ptr, size_t image_data_size, geometry::Image &image)
bool ReadImageFromPNG(const std::string &filename, geometry::Image &image)
bool ReadPNGFromMemory(const unsigned char *image_data_ptr, size_t image_data_size, geometry::Image &image)
std::shared_ptr< geometry::Image > CreateImageFromFile(const std::string &filename)
bool ReadImage(const std::string &filename, geometry::Image &image)
bool WriteImageToPNG(const std::string &filename, const geometry::Image &image, int quality=kCloudViewerImageIODefaultQuality)
bool ReadImageFromMemory(const std::string &image_format, const unsigned char *image_data_ptr, size_t image_data_size, geometry::Image &image)
bool WriteImageToJPG(const std::string &filename, const geometry::Image &image, int quality=kCloudViewerImageIODefaultQuality)
Generic file read and write utility for python interface.