open3d.visualization.VisualizerWithKeyCallback

class open3d.visualization.VisualizerWithKeyCallback

Visualizer with custom key callack capabilities.

__init__(self: open3d.cpu.pybind.visualization.VisualizerWithKeyCallback) → None

Default constructor

add_geometry(self, geometry, reset_bounding_box=True)

Function to add geometry to the scene and create corresponding shaders

Parameters
  • geometry (open3d.cpu.pybind.geometry.Geometry) – The Geometry object.

  • reset_bounding_box (bool, optional, default=True) – Set to False to keep current viewpoint

Returns

bool

capture_depth_float_buffer(self, do_render=False)

Function to capture depth in a float buffer

Parameters

do_render (bool, optional, default=False) – Set to True to do render.

Returns

open3d.cpu.pybind.geometry.Image

capture_depth_image(self, filename, do_render=False, depth_scale=1000.0)

Function to capture and save a depth image

Parameters
  • filename (str) – Path to file.

  • do_render (bool, optional, default=False) – Set to True to do render.

  • depth_scale (float, optional, default=1000.0) – Scale depth value when capturing the depth image.

Returns

None

capture_depth_point_cloud(self, filename, do_render=False, convert_to_world_coordinate=False)

Function to capture and save local point cloud

Parameters
  • filename (str) – Path to file.

  • do_render (bool, optional, default=False) – Set to True to do render.

  • convert_to_world_coordinate (bool, optional, default=False) – Set to True to convert to world coordinates

Returns

None

capture_screen_float_buffer(self, do_render=False)

Function to capture screen and store RGB in a float buffer

Parameters

do_render (bool, optional, default=False) – Set to True to do render.

Returns

open3d.cpu.pybind.geometry.Image

capture_screen_image(self, filename, do_render=False)

Function to capture and save a screen image

Parameters
  • filename (str) – Path to file.

  • do_render (bool, optional, default=False) – Set to True to do render.

Returns

None

clear_geometries(self: open3d.cpu.pybind.visualization.Visualizer) → bool

Function to clear geometries from the visualizer

close(self)

Function to notify the window to be closed

Returns

None

create_window(self, window_name='Open3D', width=1920, height=1080, left=50, top=50, visible=True)

Function to create a window and initialize GLFW

Parameters
  • window_name (str, optional, default='Open3D') – Window title name.

  • width (int, optional, default=1920) – Width of the window.

  • height (int, optional, default=1080) – Height of window.

  • left (int, optional, default=50) – Left margin of the window to the screen.

  • top (int, optional, default=50) – Top margin of the window to the screen.

  • visible (bool, optional, default=True) – Whether the window is visible.

Returns

bool

destroy_window(self)

Function to destroy a window. This function MUST be called from the main thread.

Returns

None

get_render_option(self)

Function to retrieve the associated RenderOption

Returns

open3d.cpu.pybind.visualization.RenderOption

get_view_control(self)

Function to retrieve the associated ViewControl

Returns

open3d.cpu.pybind.visualization.ViewControl

get_window_name(self)
Returns

str

poll_events(self)

Function to poll events

Returns

bool

register_animation_callback(self, callback_func)

Function to register a callback function for animation. The callback function returns if UpdateGeometry() needs to be run.

Parameters

callback_func (Callable[[open3d.cpu.pybind.visualization.Visualizer], bool]) – The call back function.

Returns

None

register_key_action_callback(self: open3d.cpu.pybind.visualization.VisualizerWithKeyCallback, key: int, callback_func: Callable[[open3d.cpu.pybind.visualization.Visualizer, int, int], bool]) → None

Function to register a callback function for a key action event. The callback function takes Visualizer, action and mods as input and returns a boolean indicating if UpdateGeometry() needs to be run.

register_key_callback(self: open3d.cpu.pybind.visualization.VisualizerWithKeyCallback, key: int, callback_func: Callable[[open3d.cpu.pybind.visualization.Visualizer], bool]) → None

Function to register a callback function for a key press event

remove_geometry(self, geometry, reset_bounding_box=True)

Function to remove geometry

Parameters
  • geometry (open3d.cpu.pybind.geometry.Geometry) – The Geometry object.

  • reset_bounding_box (bool, optional, default=True) – Set to False to keep current viewpoint

Returns

bool

reset_view_point(self, arg0)

Function to reset view point

Parameters

arg0 (bool) –

Returns

None

run(self)

Function to activate the window. This function will block the current thread until the window is closed.

Returns

None

update_geometry(self, geometry)

Function to update geometry. This function must be called when geometry has been changed. Otherwise the behavior of Visualizer is undefined.

Parameters

geometry (open3d.cpu.pybind.geometry.Geometry) – The Geometry object.

Returns

bool

update_renderer(self)

Function to inform render needed to be updated

Returns

None