多帧点云文件动画显示

  • 使用python库 Open3d
  • 安装Open3d
pip install open3d==0.8.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
  • 连续帧显示:
import open3d as o3d
import os
import numpy as np
import time

#打开文件路径
files = os.listdir("D:\\data\\myMapFile02\\")

vis = o3d.visualization.Visualizer()
#创建播放窗口
vis.create_window()
pointcloud = o3d.geometry.PointCloud()
to_reset = True
vis.add_geometry(pointcloud)

for f in files:
    pcd = o3d.io.read_point_cloud("D:\\data\\myMapFile02\\" + f)   #此处读取的ply文件,也可读取其他格式的
    pcd = np.asarray(pcd.points).reshape((-1, 3))
    pointcloud.points = o3d.utility.Vector3dVector(pcd)  # 如果使用numpy数组可省略上两行
    vis.update_geometry()
    if to_reset:
        vis.reset_view_point(True)
        to_reset = False
    vis.poll_events()
    vis.update_renderer()

time.sleep(2) # 阻止程序一闪而过

如果open3d的版本不是0.8.0,可能出现以下错误:

Traceback (most recent call last): File "E:/untitled/PlayerPointCloudData.py", line 19, 
in <module> vis.update_geometry() TypeError: update_geometry(): incompatible function 
arguments. The following argument types are supported: 1. (self:open3d.cpu.pybind.visualization.Visualizer,
geometry: open3d.cpu.pybind.geometry.Geometry) -> bool Invoked with: Visualizer with name Open3D 

安装0.8.0版本即可(其他方法目前不会,第一次使用…)

在这里插入图片描述

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值