Open3D (C++ API)  0.15.1
PointCloudIO.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// The MIT License (MIT)
5//
6// Copyright (c) 2018-2021 www.open3d.org
7//
8// Permission is hereby granted, free of charge, to any person obtaining a copy
9// of this software and associated documentation files (the "Software"), to deal
10// in the Software without restriction, including without limitation the rights
11// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12// copies of the Software, and to permit persons to whom the Software is
13// furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included in
16// all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24// IN THE SOFTWARE.
25// ----------------------------------------------------------------------------
26
27#pragma once
28
29#include <string>
30
32
33namespace open3d {
34namespace io {
35
38std::shared_ptr<geometry::PointCloud> CreatePointCloudFromFile(
39 const std::string &filename,
40 const std::string &format = "auto",
41 bool print_progress = false);
42
47 // Attention: when you update the defaults, update the docstrings in
48 // pybind/io/class_io.cpp
49 std::string format = "auto",
50 bool remove_nan_points = false,
51 bool remove_infinite_points = false,
52 bool print_progress = false,
53 std::function<bool(double)> update_progress = {})
54 : format(format),
59 ReadPointCloudOption(std::function<bool(double)> up)
61 update_progress = up;
62 };
65 std::string format;
77 std::function<bool(double)> update_progress;
78};
79
84bool ReadPointCloud(const std::string &filename,
85 geometry::PointCloud &pointcloud,
86 const ReadPointCloudOption &params = {});
87
91 enum class IsAscii : bool { Binary = false, Ascii = true };
92 enum class Compressed : bool { Uncompressed = false, Compressed = true };
94 // Attention: when you update the defaults, update the docstrings in
95 // pybind/io/class_io.cpp
98 bool print_progress = false,
99 std::function<bool(double)> update_progress = {})
104 // for compatibility
106 bool compressed = false,
107 bool print_progress = false,
108 std::function<bool(double)> update_progress = {})
113 WritePointCloudOption(std::function<bool(double)> up)
115 update_progress = up;
116 };
131 std::function<bool(double)> update_progress;
132};
133
138bool WritePointCloud(const std::string &filename,
139 const geometry::PointCloud &pointcloud,
140 const WritePointCloudOption &params = {});
141
142bool ReadPointCloudFromXYZ(const std::string &filename,
143 geometry::PointCloud &pointcloud,
144 const ReadPointCloudOption &params);
145
146bool WritePointCloudToXYZ(const std::string &filename,
147 const geometry::PointCloud &pointcloud,
148 const WritePointCloudOption &params);
149
150bool ReadPointCloudFromXYZN(const std::string &filename,
151 geometry::PointCloud &pointcloud,
152 const ReadPointCloudOption &params);
153
154bool WritePointCloudToXYZN(const std::string &filename,
155 const geometry::PointCloud &pointcloud,
156 const WritePointCloudOption &params);
157
158bool ReadPointCloudFromXYZRGB(const std::string &filename,
159 geometry::PointCloud &pointcloud,
160 const ReadPointCloudOption &params);
161
162bool WritePointCloudToXYZRGB(const std::string &filename,
163 const geometry::PointCloud &pointcloud,
164 const WritePointCloudOption &params);
165
166bool ReadPointCloudFromPLY(const std::string &filename,
167 geometry::PointCloud &pointcloud,
168 const ReadPointCloudOption &params);
169
170bool WritePointCloudToPLY(const std::string &filename,
171 const geometry::PointCloud &pointcloud,
172 const WritePointCloudOption &params);
173
174bool ReadPointCloudFromPCD(const std::string &filename,
175 geometry::PointCloud &pointcloud,
176 const ReadPointCloudOption &params);
177
178bool WritePointCloudToPCD(const std::string &filename,
179 const geometry::PointCloud &pointcloud,
180 const WritePointCloudOption &params);
181
182bool ReadPointCloudFromPTS(const std::string &filename,
183 geometry::PointCloud &pointcloud,
184 const ReadPointCloudOption &params);
185
186bool WritePointCloudToPTS(const std::string &filename,
187 const geometry::PointCloud &pointcloud,
188 const WritePointCloudOption &params);
189
190} // namespace io
191} // namespace open3d
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:214
A point cloud consists of point coordinates, and optionally point colors and point normals.
Definition: PointCloud.h:55
bool WritePointCloudToXYZRGB(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FileXYZRGB.cpp:78
bool WritePointCloudToPCD(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FilePCD.cpp:791
bool ReadPointCloudFromXYZ(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: FileXYZ.cpp:42
bool ReadPointCloud(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: PointCloudIO.cpp:77
bool WritePointCloudToPLY(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FilePLY.cpp:462
bool WritePointCloud(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: PointCloudIO.cpp:127
bool ReadPointCloudFromXYZN(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: FileXYZN.cpp:42
bool ReadPointCloudFromXYZRGB(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: FileXYZRGB.cpp:42
bool ReadPointCloudFromPLY(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: FilePLY.cpp:397
bool WritePointCloudToXYZN(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FileXYZN.cpp:78
bool ReadPointCloudFromPCD(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: FilePCD.cpp:754
bool WritePointCloudToPTS(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FilePTS.cpp:146
bool ReadPointCloudFromPTS(const std::string &filename, geometry::PointCloud &pointcloud, const ReadPointCloudOption &params)
Definition: FilePTS.cpp:43
std::shared_ptr< geometry::PointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
Definition: PointCloudIO.cpp:68
bool WritePointCloudToXYZ(const std::string &filename, const geometry::PointCloud &pointcloud, const WritePointCloudOption &params)
Definition: FileXYZ.cpp:76
Definition: PinholeCameraIntrinsic.cpp:35
Optional parameters to ReadPointCloud.
Definition: PointCloudIO.h:45
std::function< bool(double)> update_progress
Definition: PointCloudIO.h:77
ReadPointCloudOption(std::function< bool(double)> up)
Definition: PointCloudIO.h:59
bool remove_infinite_points
Whether to remove all points that have +-inf.
Definition: PointCloudIO.h:69
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:46
std::string format
Definition: PointCloudIO.h:65
bool remove_nan_points
Whether to remove all points that have nan.
Definition: PointCloudIO.h:67
bool print_progress
Definition: PointCloudIO.h:73
Optional parameters to WritePointCloud.
Definition: PointCloudIO.h:90
std::function< bool(double)> update_progress
Definition: PointCloudIO.h:131
IsAscii
Definition: PointCloudIO.h:91
Compressed
Definition: PointCloudIO.h:92
WritePointCloudOption(std::function< bool(double)> up)
Definition: PointCloudIO.h:113
bool print_progress
Definition: PointCloudIO.h:127
WritePointCloudOption(IsAscii write_ascii=IsAscii::Binary, Compressed compressed=Compressed::Uncompressed, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: PointCloudIO.h:93
IsAscii write_ascii
Definition: PointCloudIO.h:119
Compressed compressed
Definition: PointCloudIO.h:123
WritePointCloudOption(bool write_ascii, bool compressed=false, bool print_progress=false, std::function< bool(double)> update_progress={})
Definition: PointCloudIO.h:105