Open3D (C++ API)  0.18.0
Loading...
Searching...
No Matches
PointCloudIO.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
13
14namespace open3d {
15namespace io {
16
19std::shared_ptr<geometry::PointCloud> CreatePointCloudFromFile(
20 const std::string &filename,
21 const std::string &format = "auto",
22 bool print_progress = false);
23
26std::shared_ptr<geometry::PointCloud> CreatePointCloudFromMemory(
27 const unsigned char *buffer,
28 const size_t length,
29 const std::string &format,
30 bool print_progress = false);
31
36 // Attention: when you update the defaults, update the docstrings in
37 // pybind/io/class_io.cpp
38 std::string format = "auto",
39 bool remove_nan_points = false,
40 bool remove_infinite_points = false,
41 bool print_progress = false,
42 std::function<bool(double)> update_progress = {})
43 : format(format),
48 ReadPointCloudOption(std::function<bool(double)> up)
50 update_progress = up;
51 };
55 std::string format;
67 std::function<bool(double)> update_progress;
68};
69
74bool ReadPointCloud(const std::string &filename,
75 geometry::PointCloud &pointcloud,
76 const ReadPointCloudOption &params = {});
77
82bool ReadPointCloud(const unsigned char *buffer,
83 const size_t length,
84 geometry::PointCloud &pointcloud,
85 const ReadPointCloudOption &params = {});
86
90 enum class IsAscii : bool { Binary = false, Ascii = true };
91 enum class Compressed : bool { Uncompressed = false, Compressed = true };
93 // Attention: when you update the defaults, update the docstrings in
94 // pybind/io/class_io.cpp
95 std::string format = "auto",
98 bool print_progress = false,
99 std::function<bool(double)> update_progress = {})
100 : format(format),
105 // for compatibility
114 // for compatibility
116 bool write_ascii,
117 bool compressed = false,
118 bool print_progress = false,
119 std::function<bool(double)> update_progress = {})
120 : format(format),
125 WritePointCloudOption(std::function<bool(double)> up)
127 update_progress = up;
128 };
132 std::string format;
147 std::function<bool(double)> update_progress;
148};
149
154bool WritePointCloud(const std::string &filename,
155 const geometry::PointCloud &pointcloud,
156 const WritePointCloudOption &params = {});
157
165bool WritePointCloud(unsigned char *&buffer,
166 size_t &length,
167 const geometry::PointCloud &pointcloud,
168 const WritePointCloudOption &params = {});
169
170bool ReadPointCloudFromXYZ(const std::string &filename,
171 geometry::PointCloud &pointcloud,
172 const ReadPointCloudOption &params);
173
174bool ReadPointCloudInMemoryFromXYZ(const unsigned char *buffer,
175 const size_t length,
176 geometry::PointCloud &pointcloud,
177 const ReadPointCloudOption &params);
178
179bool WritePointCloudToXYZ(const std::string &filename,
180 const geometry::PointCloud &pointcloud,
181 const WritePointCloudOption &params);
182
183bool WritePointCloudInMemoryToXYZ(unsigned char *&buffer,
184 size_t &length,
185 const geometry::PointCloud &pointcloud,
186 const WritePointCloudOption &params);
187
188bool ReadPointCloudFromXYZN(const std::string &filename,
189 geometry::PointCloud &pointcloud,
190 const ReadPointCloudOption &params);
191
192bool WritePointCloudToXYZN(const std::string &filename,
193 const geometry::PointCloud &pointcloud,
194 const WritePointCloudOption &params);
195
196bool ReadPointCloudFromXYZRGB(const std::string &filename,
197 geometry::PointCloud &pointcloud,
198 const ReadPointCloudOption &params);
199
200bool WritePointCloudToXYZRGB(const std::string &filename,
201 const geometry::PointCloud &pointcloud,
202 const WritePointCloudOption &params);
203
204bool ReadPointCloudFromPLY(const std::string &filename,
205 geometry::PointCloud &pointcloud,
206 const ReadPointCloudOption &params);
207
208bool WritePointCloudToPLY(const std::string &filename,
209 const geometry::PointCloud &pointcloud,
210 const WritePointCloudOption &params);
211
212bool ReadPointCloudFromPCD(const std::string &filename,
213 geometry::PointCloud &pointcloud,
214 const ReadPointCloudOption &params);
215
216bool WritePointCloudToPCD(const std::string &filename,
217 const geometry::PointCloud &pointcloud,
218 const WritePointCloudOption &params);
219
220bool ReadPointCloudFromPTS(const std::string &filename,
221 geometry::PointCloud &pointcloud,
222 const ReadPointCloudOption &params);
223
224bool WritePointCloudToPTS(const std::string &filename,
225 const geometry::PointCloud &pointcloud,
226 const WritePointCloudOption &params);
227
228} // namespace io
229} // namespace open3d
filament::Texture::InternalFormat format
Definition FilamentResourceManager.cpp:195
A point cloud consists of point coordinates, and optionally point colors and point normals.
Definition PointCloud.h:36
std::shared_ptr< geometry::PointCloud > CreatePointCloudFromMemory(const unsigned char *buffer, const size_t length, const std::string &format, bool print_progress)
Definition PointCloudIO.cpp:78
bool WritePointCloudToXYZRGB(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FileXYZRGB.cpp:59
bool WritePointCloudToPCD(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FilePCD.cpp:772
bool ReadPointCloudFromXYZ(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FileXYZ.cpp:25
bool ReadPointCloud(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition PointCloudIO.cpp:89
bool WritePointCloudToPLY(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FilePLY.cpp:443
bool WritePointCloud(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition PointCloudIO.cpp:171
bool ReadPointCloudFromXYZN(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FileXYZN.cpp:23
bool ReadPointCloudFromXYZRGB(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FileXYZRGB.cpp:23
bool WritePointCloudInMemoryToXYZ(unsigned char *&buffer, size_t &length, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FileXYZ.cpp:123
bool ReadPointCloudInMemoryFromXYZ(const unsigned char *buffer, const size_t length, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FileXYZ.cpp:59
bool ReadPointCloudFromPLY(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FilePLY.cpp:378
bool WritePointCloudToXYZN(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FileXYZN.cpp:59
bool ReadPointCloudFromPCD(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FilePCD.cpp:735
bool WritePointCloudToPTS(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FilePTS.cpp:127
bool ReadPointCloudFromPTS(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition FilePTS.cpp:24
std::shared_ptr< geometry::PointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
Definition PointCloudIO.cpp:69
bool WritePointCloudToXYZ(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition FileXYZ.cpp:90
Definition PinholeCameraIntrinsic.cpp:16
Optional parameters to ReadPointCloud.
Definition PointCloudIO.h:34
std::function< bool(double)> update_progress
Definition PointCloudIO.h:67
ReadPointCloudOption(std::function< bool(double)> up)
Definition PointCloudIO.h:48
bool remove_infinite_points
Whether to remove all points that have +-inf.
Definition PointCloudIO.h:59
ReadPointCloudOption(std::string format="auto", bool remove_nan_points=false, bool remove_infinite_points=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition PointCloudIO.h:35
std::string format
Definition PointCloudIO.h:55
bool remove_nan_points
Whether to remove all points that have nan.
Definition PointCloudIO.h:57
bool print_progress
Definition PointCloudIO.h:63
Optional parameters to WritePointCloud.
Definition PointCloudIO.h:89
std::function< bool(double)> update_progress
Definition PointCloudIO.h:147
IsAscii
Definition PointCloudIO.h:90
Compressed
Definition PointCloudIO.h:91
WritePointCloudOption(std::function< bool(double)> up)
Definition PointCloudIO.h:125
WritePointCloudOption(std::string format, bool write_ascii, bool compressed=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition PointCloudIO.h:115
bool print_progress
Definition PointCloudIO.h:143
std::string format
Definition PointCloudIO.h:132
WritePointCloudOption(std::string format="auto", IsAscii write_ascii=IsAscii::Binary, Compressed compressed=Compressed::Uncompressed, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition PointCloudIO.h:92
IsAscii write_ascii
Definition PointCloudIO.h:135
Compressed compressed
Definition PointCloudIO.h:139
WritePointCloudOption(bool write_ascii, bool compressed=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition PointCloudIO.h:106