open3d显示

open3d显示

视点调整

载入json的方式调整视点

  • 对视点等参数保存成文件的形式,然后再load
  • open3d调整显示点大小?、视点
    • https://github.com/intel-isl/Open3D/issues/615

重要补充:https://blog.csdn.net/qq_26623879/article/details/106380014

手动保存json数据

  • 其实也可以点击open3d的显示窗口ctrl+c,视图信息就保存在了截切板里面(win10打开剪切板——win+v),然后对再次显示的点云窗口点击并ctrl+v,就可以按照之前的视点信息显示
  • 也可以手动对这次的视点等信息win+v,保存到json文件中方便使用

使用get_view_control 调整视点

最后一点是这个脚本的核心。update_geometry通知 vis相关的几何已经被更新。最后,可视化器渲染新的一帧通过调用poll_events和update_renderer来实现。在所有的循环结束之后,调用destroy_window来关闭窗口

set_front设置的是垂直指向屏幕外的向量,set_up设置的是指向屏幕上方的向量,当设置了这两个向量之后,当前视角坐标系就可以确定了,set_lookat也就是当前帧lidar所处的位置,是以世界坐标系为统一坐标系计算出来的(可以理解为,不管哪一帧,在整个地图,只有一个共同的原点),set_zoom是控制视角远近的,因为要实现第一人称视角,所以设置为0.001,因为设置0的话屏幕会出现空白的现象——https://github.com/isl-org/Open3D/issues/2139

import open3d as o3d
coor_frame = o3d.geometry.TriangleMesh.create_coordinate_frame()
visualizer = o3d.visualization.Visualizer()
visualizer.create_window()
visualizer.add_geometry(coor_frame)
view_ctl = visualizer.get_view_control()
# view_ctl.set_up((1, 0, 0))  # set the positive direction of the x-axis as the up direction
view_ctl.set_up((0, -1, 0))  # set the negative direction of the y-axis as the up direction
view_ctl.set_front((0, 0, -1))  # set the positive direction of the x-axis toward you
view_ctl.set_lookat((0, 0, -2))  # set the original point as the center point of the window
view_ctl.set_zoom(2)
visualizer.run()

图形拖拽

点大小调整 `+ -` 号
– Mouse view control –– 鼠标视图控制 –
Left button + drag : Rotate.  ——左键+拖动:旋转。
Ctrl + left button + drag : Translate.——Ctrl+左键+拖动:平移。
Wheel button + drag : Translate.——滚轮按钮+拖动:平移。
Shift + left button + drag : Roll.——Shift+左键+拖动:滚动。
Wheel : Zoom in/out.——控制盘:放大/缩小。
– Keyboard view control ––键盘视图控件–
[/] : Increase/decrease field of view.——[/]:增大/减小视野。
R : Reset view point.——R:重置视点。
Ctrl/Cmd + C : Copy current view status into the clipboard.——Ctrl/Cmd+C:将当前视图状态复制到剪贴板。
Ctrl/Cmd + V : Paste view status from clipboard.——Ctrl/Cmd+V:从剪贴板粘贴视图状态。
– General control ––一般控制–
Q, Esc : Exit window.——Q、 Esc:退出窗口。
H : Print help message.——H:打印帮助信息。
P, PrtScn : Take a screen capture.——P、 拍摄屏幕截图。
D : Take a depth capture.——D:进行深度捕捉。
O : Take a capture of current rendering settings.——O:捕获当前渲染设置。

动态显示

  • 初始化
  vis = o3d.visualization.Visualizer()
  vis.create_window()
  vis.add_geometry(source)
  vis.add_geometry(target)
#  vis.get_render_option().load_from_json("../../TestData/renderoption.json") 
#  调整显示的视点等
  • 转换几何体后显示
   for i in range(icp_iteration):
        reg_p2l = o3d.registration.registration_icp(
            source, target, threshold, np.identity(4),
            o3d.registration.TransformationEstimationPointToPlane(),
            o3d.registration.ICPConvergenceCriteria(max_iteration=1))
        source.transform(reg_p2l.transformation)
        vis.update_geometry(source)
        vis.poll_events()
        vis.update_renderer()
        if save_image:
            vis.capture_screen_image("temp_%04d.jpg" % i)
    vis.destroy_window()

每一次迭代中调用了registration_icp函数。需要注意的是它通过ICPConvergenceCriteria(max_iteration = 1)标志来显示的只执行一次ICP配准。这是一种从ICP迭代中检索轻微更新姿态的技巧。在ICP之后呢相应的旋转源几何形状。

其他显示参考:
https://blog.csdn.net/io569417668/article/details/107013386
https://blog.csdn.net/io569417668/article/details/111830828
http://www.open3d.org/docs/0.10.0/tutorial/Advanced/non_blocking_visualization.html

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
Open3D是一个开源的用于处理三维数据的库,它支持多种三维数据格式的读取和处理,其中包括点云数据。 要在Open3D显示点云界面,我们需要进行以下步骤: 1. 导入Open3D库:在代码中使用`import open3d`命令导入Open3D库,以便我们可以使用其中提供的函数和类。 2. 读取点云数据:使用`open3d.io.read_point_cloud()`函数读取点云数据文件,并将其存储在一个变量中,例如`pcd = open3d.io.read_point_cloud("point_cloud.ply")`。 3. 创建一个可视化窗口:使用`open3d.visualization.Visualizer()`函数创建一个可视化窗口,以便我们可以将点云数据显示在其中,例如`vis = open3d.visualization.Visualizer()`。 4. 设置点云数据并添加到可视化窗口:使用`vis.create_window()`函数创建一个窗口,并将点云数据添加到窗口中,例如`vis.create_window()``vis.add_geometry(pcd)`。 5. 显示点云界面:使用`vis.run()`函数来运行可视化窗口,并将点云数据显示在其中,例如`vis.run()`。 完整的示例代码如下: ``` import open3d # 读取点云数据 pcd = open3d.io.read_point_cloud("point_cloud.ply") # 创建一个可视化窗口 vis = open3d.visualization.Visualizer() # 设置点云数据并添加到可视化窗口 vis.create_window() vis.add_geometry(pcd) # 显示点云界面 vis.run() ``` 通过以上步骤,我们可以使用Open3D库来读取并显示点云数据的界面。这使我们能够对点云数据进行可视化和进一步的处理。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值