0

I followed this link to visualize multiple .pcd as a video via open3d. It is working fine. However, I am unable to zoom in the generated output.

I have tried to use o3d.visualization.Visualizer.get_view_control() but it doesn't zoom at all.

My code is as follows

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()

I have attached my current results and expected results below.

Current results

expected results

Ammar Ul Hassan
  • 826
  • 1
  • 18
  • 48

0 Answers0