image_framework_ymj/include/open3d/t/io/PointCloudIO.h
2024-12-06 16:25:16 +08:00

88 lines
3.7 KiB
C++
Executable File

// ----------------------------------------------------------------------------
// - Open3D: www.open3d.org -
// ----------------------------------------------------------------------------
// Copyright (c) 2018-2023 www.open3d.org
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------
#pragma once
#include <string>
#include "open3d/io/PointCloudIO.h"
#include "open3d/t/geometry/PointCloud.h"
namespace open3d {
namespace t {
namespace io {
using open3d::io::ReadPointCloudOption;
using open3d::io::WritePointCloudOption;
/// Factory function to create a pointcloud from a file
/// Return an empty pointcloud if fail to read the file.
std::shared_ptr<geometry::PointCloud> CreatePointCloudFromFile(
const std::string &filename,
const std::string &format = "auto",
bool print_progress = false);
/// The general entrance for reading a PointCloud from a file
/// The function calls read functions based on the extension name of filename.
/// See \p ReadPointCloudOption for additional options you can pass.
/// \return return true if the read function is successful, false otherwise.
bool ReadPointCloud(const std::string &filename,
geometry::PointCloud &pointcloud,
const ReadPointCloudOption &params = {});
/// The general entrance for writing a PointCloud to a file
/// The function calls write functions based on the extension name of filename.
/// See \p WritePointCloudOption for additional options you can pass.
/// \return return true if the write function is successful, false otherwise.
bool WritePointCloud(const std::string &filename,
const geometry::PointCloud &pointcloud,
const WritePointCloudOption &params = {});
bool ReadPointCloudFromNPZ(const std::string &filename,
geometry::PointCloud &pointcloud,
const ReadPointCloudOption &params);
bool WritePointCloudToNPZ(const std::string &filename,
const geometry::PointCloud &pointcloud,
const WritePointCloudOption &params);
bool ReadPointCloudFromTXT(const std::string &filename,
geometry::PointCloud &pointcloud,
const ReadPointCloudOption &params);
bool WritePointCloudToTXT(const std::string &filename,
const geometry::PointCloud &pointcloud,
const WritePointCloudOption &params);
bool ReadPointCloudFromPCD(const std::string &filename,
geometry::PointCloud &pointcloud,
const ReadPointCloudOption &params);
bool WritePointCloudToPCD(const std::string &filename,
const geometry::PointCloud &pointcloud,
const WritePointCloudOption &params);
bool ReadPointCloudFromPLY(const std::string &filename,
geometry::PointCloud &pointcloud,
const ReadPointCloudOption &params);
bool WritePointCloudToPLY(const std::string &filename,
const geometry::PointCloud &pointcloud,
const WritePointCloudOption &params);
bool ReadPointCloudFromPTS(const std::string &filename,
geometry::PointCloud &pointcloud,
const ReadPointCloudOption &params);
bool WritePointCloudToPTS(const std::string &filename,
const geometry::PointCloud &pointcloud,
const WritePointCloudOption &params);
} // namespace io
} // namespace t
} // namespace open3d