I would like to get the camera viewing angle of a pointcloud which is displayed using SceneWidget()
whose scene is set like this:
self.window = gui.Application.instance.create_window("Open3D", width, height)
self._scene = gui.SceneWidget()
self._scene.scene = rendering.Open3DScene(self.window.renderer)
If I use o3d.visualization.Visualizer()
, I can get it using get_view_control()
, but cannot figure out how to get it using SceneWidget
.
I tried to get the renderer object from Visualizer()
thinking it could be passed to rendering.Open3DScene()
but Visualizer()
only has a get_render_option()
UPDATE:
Thanks @saurabheights for the answer. What I am trying to do is to load a pointcloud, rotate it, get/save it's view matrix and then for all other pointclouds, use this view matrix. So that I dont have to rotate the pointcloud each time. My intuition is that I could combine get_view_matrix()
and open3d.visualization.rendering.Camera.look_at()
. But I am trouble trying it. How can I do it?
The properties of camera of SceneWidget are available via widget3d.scene.camera
. Notice the class relationship:- SceneWidget -> Open3dScene -> Camera
.
You should be able to get view matrix from
widget3d.scene.camera.get_view_matrix()
Note - You should rename _scene
to widget
, makes it easier to infer the class of the object.