Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load / Save Viewpoint for Orthographic Camera #1377

Open
JunShern opened this issue Dec 4, 2019 · 3 comments
Open

Load / Save Viewpoint for Orthographic Camera #1377

JunShern opened this issue Dec 4, 2019 · 3 comments

Comments

@JunShern
Copy link

JunShern commented Dec 4, 2019

Hi, thanks for all the awesome work on this library.

I'm looking for a way to save and load the viewpoint of the orthographic camera in the visualizer using the Python bindings. I am aware of this #597 which resulted in this example, but unless I am using it wrongly I believe that it only works for non-orthographic cameras. That is, when the FOV is set to 5, saving and loading produces a different view.

The closest lead I've found so far is in the visualizer commands Ctrl+C and Ctrl+V for storing and loading the view, which works perfectly for orthographic and any view. This is exactly the behavior I want but I have not found a way to achieve this programmatically in Python, and my guess is that this relies on the C++ ConvertFromViewParameters which is not exposed yet in the Python API.

https://github.com/intel-isl/Open3D/blob/995b646375121e348ff814b138a924bfac0f047e/src/Visualization/Visualizer/ViewControl.cpp#L96

This would be a great help to my projects, please help or let me know if I am missing something.

@syncle

@Walter0807
Copy link

Walter0807 commented Nov 6, 2020

I have the same problem. It seems not implemented yet.

@JReesW
Copy link

JReesW commented Jun 10, 2022

Hello, I was wondering if there are any updates on this issue?

Specifically the part where I can replicate the functionalities of Ctrl+C and Ctrl+V programmatically.
I wish to load the JSON generated by Ctrl+C from a file, such that the window opens with those camera settings.

@claudius-kienle
Copy link

As far as I know, there is currently no such functionality. But following code implements the same functionality:

def convert_from_view_parameters(vc, json_path: str):
    with open(json_path, "r") as f:
        js = json.load()
   vc.change_field_of_view(js['trajectory'][0]['field_of_view'])
   vc.set_front(js['trajectory'][0]['front'])
   vc.set_lookat(js['trajectory'][0]['lookat'])
   vc.set_up(js['trajectory'][0]['up'])
   vc.set_zoom(js['trajectory'][0]['zoom'])

The function can be called in the following way:

vis = o3d.visualization.Visualizer()
convert_from_view_parameters(vc=vis.get_view_control(), json_path="our/saved/view/parameters.json")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants