我按照此链接通过open3d将多个.pcd可视化为视频。它运行良好。但是,我无法放大生成的输出。
我尝试过使用
o3d.visualization.Visualizer.get_view_control()
,但它根本无法缩放。
我的代码如下
import os
import fnmatch
import numpy as np
if __name__ == "__main__":
pcd_directory = './2023-04-07-17-17-59/2023-04-07-17-17-59_Clouds'
# List all files in the directory
files = os.listdir(pcd_directory)
# Filter the .pcd files
pcd_files = fnmatch.filter(files, '*.pcd')
# Sort the .pcd files
pcd_files.sort()
# Creating an object of class visualizer
vis = o3d.visualization.Visualizer()
vis.create_window()
# Setting the colors of visualizer
ropt = vis.get_render_option()
ropt.point_size = 1.0
ropt.background_color = np.asarray([0, 0, 0])
ropt.light_on = False
# Reading first Pcd and adding to geometry
pcd = o3d.io.read_point_cloud(f'./2023-04-07-17-17-59/2023-04-07-17-17-59_Clouds/0000000001.pcd')
vis.add_geometry(pcd)
# zoom the view
ctr = vis.get_view_control()
ctr.set_zoom(4)
for i in range(1, len(pcd_files) - 550):
pcd.points = o3d.io.read_point_cloud(f'./2023-04-07-17-17-59/2023-04-07-17-17-59_Clouds/{i:010d}.pcd').points
vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()
vis.destroy_window()
我已在下面附上我当前的结果和预期结果。
你可以参考我在Open3D论坛找到的这个答案:
https://forum.open3d.org/t/how-to-unlock-the-maximum-zoom-out/413
我还对代码做了一个小小的调整: 将
vis.remove_geometry(geometries[i],reset_bounding_box=False)
替换为 vis.clear_geometries()
并删除 vis.update_geometry(geometries[i])