点云文件ply格式和pcd格式的转换

一、ply转pcd

import open3d as o3d


def convert_ply_to_pcd(ply_file, pcd_file):
    # 读取 PLY 文件
    pcd = o3d.io.read_point_cloud(ply_file)

    # 保存为 PCD 文件
    o3d.io.write_point_cloud(pcd_file, pcd)


if __name__ == "__main__":
    # 替换为你的 PLY 文件路径和目标 PCD 文件路径
    ply_file_path = "F:/24.10.181/1.ply"
    pcd_file_path = "F:/24.10.181/1.pcd"
    convert_ply_to_pcd(ply_file_path, pcd_file_path)

二、pcd转ply

import open3d as o3d

def pcd_to_ply(input_file, output_file):
    # 读取 .pcd 文件
    pcd = o3d.io.read_point_cloud(input_file)

    # 将点云数据保存为 .ply 文件
    o3d.io.write_point_cloud(output_file, pcd)

    print(f"Successfully converted {input_file} to {output_file}")

# 使用函数
if __name__ == "__main__":
    input_pcd = "F:/24.10.181/1.pcd"
    output_ply = "F:/24.10.181/11.ply"
    pcd_to_ply(input_pcd, output_ply)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值