Open3d: How to load viewpoint in Visualization?

Created on 18 Sep 2018  路  7Comments  路  Source: intel-isl/Open3D

It looks like we can store the viewpoint to Json file, any method for us to load specific viewpoint when opening the visualization through 'draw_geometries' ?

Any comment is appreciated.

Most helpful comment

All 7 comments

The easiest way is to open the json file, select all, copy, then paste in the Visualizer window.

The programmatic way is to call Visualizer.get_view_control().convert_to_pinhole_camera_parameters() (and/or convert_from_pinhole_camera_parameters()), then use write_pinhole_camera_intrinsic() (and/or read_pinhole_camera_intrinsic).

This issue is related to #387.
@qianyizh: read/write_pinhole_camera_intrinsic can only save camera intrinsic matrix, not extrinsic 4x4 matrix that are necessary for saving a view point. I just tried

    vis = Visualizer()
    vis.create_window()
    ctr = vis.get_view_control()
    pcd = read_point_cloud("../../TestData/fragment.pcd")
    vis.add_geometry(pcd)
    vis.run()
    param = ctr.convert_to_pinhole_camera_parameters()
    write_pinhole_camera_intrinsic("test.json", param)
    vis.destroy_window()

and got

    write_pinhole_camera_intrinsic("test.json", param)
TypeError: write_pinhole_camera_intrinsic(): incompatible function arguments. The following argument types are supported:
    1. (filename: str, intrinsic: open3d.PinholeCameraIntrinsic) -> bool

Currently, the best option is to use PinholeCameraTrajectory as I mentioned here. I think we need to define and expose PinholeCameraParameters and read/write_pinhole_camera_parameters.
Please correct me if I misunderstood your comment :)

Yes, I think you just need to save a PinholeCameraTrajectory. As long as it only has one extrinsic matrix, it is basically a pair of intrinsic and extrinsic.

@syncle @qianyizh
The open3d is great, and I'm planning to use this as the key framework for my project.

I have a question of this viewpoint settings..
After reading bunch of issues, I am still not sure if we are able to load the view point within the script.

The easiest way is to open the json file, select all, copy, then paste in the Visualizer window.

I confirmed this working, but I'm not sure how to get the PinholeCameraTrajectory pipeline working.

Oh, this script worked perfectly.
https://github.com/intel-isl/Open3D/blob/master/examples/Python/Advanced/load_save_viewpoint.py

Did not realize that it was in the examples..

You're right. Thanks for the clarification!

Was this page helpful?
0 / 5 - 0 ratings