Open3D (C++ API)  0.17.0
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 
14 namespace open3d {
15 namespace io {
16 
19 std::shared_ptr<geometry::PointCloud> CreatePointCloudFromFile(
20  const std::string &filename,
21  const std::string &format = "auto",
22  bool print_progress = false);
23 
28  // Attention: when you update the defaults, update the docstrings in
29  // pybind/io/class_io.cpp
30  std::string format = "auto",
31  bool remove_nan_points = false,
32  bool remove_infinite_points = false,
33  bool print_progress = false,
34  std::function<bool(double)> update_progress = {})
35  : format(format),
40  ReadPointCloudOption(std::function<bool(double)> up)
42  update_progress = up;
43  };
46  std::string format;
58  std::function<bool(double)> update_progress;
59 };
60 
65 bool ReadPointCloud(const std::string &filename,
66  geometry::PointCloud &pointcloud,
67  const ReadPointCloudOption &params = {});
68 
72  enum class IsAscii : bool { Binary = false, Ascii = true };
73  enum class Compressed : bool { Uncompressed = false, Compressed = true };
75  // Attention: when you update the defaults, update the docstrings in
76  // pybind/io/class_io.cpp
79  bool print_progress = false,
80  std::function<bool(double)> update_progress = {})
85  // for compatibility
87  bool compressed = false,
88  bool print_progress = false,
89  std::function<bool(double)> update_progress = {})
94  WritePointCloudOption(std::function<bool(double)> up)
96  update_progress = up;
97  };
112  std::function<bool(double)> update_progress;
113 };
114 
119 bool WritePointCloud(const std::string &filename,
120  const geometry::PointCloud &pointcloud,
121  const WritePointCloudOption &params = {});
122 
123 bool ReadPointCloudFromXYZ(const std::string &filename,
124  geometry::PointCloud &pointcloud,
125  const ReadPointCloudOption &params);
126 
127 bool WritePointCloudToXYZ(const std::string &filename,
128  const geometry::PointCloud &pointcloud,
129  const WritePointCloudOption &params);
130 
131 bool ReadPointCloudFromXYZN(const std::string &filename,
132  geometry::PointCloud &pointcloud,
133  const ReadPointCloudOption &params);
134 
135 bool WritePointCloudToXYZN(const std::string &filename,
136  const geometry::PointCloud &pointcloud,
137  const WritePointCloudOption &params);
138 
139 bool ReadPointCloudFromXYZRGB(const std::string &filename,
140  geometry::PointCloud &pointcloud,
141  const ReadPointCloudOption &params);
142 
143 bool WritePointCloudToXYZRGB(const std::string &filename,
144  const geometry::PointCloud &pointcloud,
145  const WritePointCloudOption &params);
146 
147 bool ReadPointCloudFromPLY(const std::string &filename,
148  geometry::PointCloud &pointcloud,
149  const ReadPointCloudOption &params);
150 
151 bool WritePointCloudToPLY(const std::string &filename,
152  const geometry::PointCloud &pointcloud,
153  const WritePointCloudOption &params);
154 
155 bool ReadPointCloudFromPCD(const std::string &filename,
156  geometry::PointCloud &pointcloud,
157  const ReadPointCloudOption &params);
158 
159 bool WritePointCloudToPCD(const std::string &filename,
160  const geometry::PointCloud &pointcloud,
161  const WritePointCloudOption &params);
162 
163 bool ReadPointCloudFromPTS(const std::string &filename,
164  geometry::PointCloud &pointcloud,
165  const ReadPointCloudOption &params);
166 
167 bool WritePointCloudToPTS(const std::string &filename,
168  const geometry::PointCloud &pointcloud,
169  const WritePointCloudOption &params);
170 
171 } // namespace io
172 } // 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
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:23
bool ReadPointCloud(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: PointCloudIO.cpp:58
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:108
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 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:49
bool WritePointCloudToXYZ(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FileXYZ.cpp:57
Definition: PinholeCameraIntrinsic.cpp:16
Optional parameters to ReadPointCloud.
Definition: PointCloudIO.h:26
std::function< bool(double)> update_progress
Definition: PointCloudIO.h:58
ReadPointCloudOption(std::function< bool(double)> up)
Definition: PointCloudIO.h:40
bool remove_infinite_points
Whether to remove all points that have +-inf.
Definition: PointCloudIO.h:50
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:27
std::string format
Definition: PointCloudIO.h:43
bool remove_nan_points
Whether to remove all points that have nan.
Definition: PointCloudIO.h:48
bool print_progress
Definition: PointCloudIO.h:54
Optional parameters to WritePointCloud.
Definition: PointCloudIO.h:71
std::function< bool(double)> update_progress
Definition: PointCloudIO.h:112
IsAscii
Definition: PointCloudIO.h:72
Compressed
Definition: PointCloudIO.h:73
WritePointCloudOption(std::function< bool(double)> up)
Definition: PointCloudIO.h:94
bool print_progress
Definition: PointCloudIO.h:108
WritePointCloudOption(IsAscii write_ascii=IsAscii::Binary, Compressed compressed=Compressed::Uncompressed, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: PointCloudIO.h:74
IsAscii write_ascii
Definition: PointCloudIO.h:97
Compressed compressed
Definition: PointCloudIO.h:104
WritePointCloudOption(bool write_ascii, bool compressed=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: PointCloudIO.h:86