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

Build fixes MSVC and gcc #6039

Merged
merged 4 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions docs/tutorial/visualization/non_blocking_visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ The full script implementing this idea is displayed below.

.. literalinclude:: ../../../examples/python/visualization/non_blocking_visualization.py
:language: python
:lineno-start: 27
:lines: 27-
:linenos:

The following sections explain this script.
Expand All @@ -50,8 +48,8 @@ Prepare example data

.. literalinclude:: ../../../examples/python/visualization/non_blocking_visualization.py
:language: python
:lineno-start: 35
:lines: 35-46
:lineno-start: 14
:lines: 14-27
:linenos:

This part reads two point clouds and downsamples them. The source point cloud is intentionally transformed for the misalignment. Both point clouds are flipped for better visualization.
Expand All @@ -61,8 +59,8 @@ Initialize Visualizer class

.. literalinclude:: ../../../examples/python/visualization/non_blocking_visualization.py
:language: python
:lineno-start: 47
:lines: 47-59
:lineno-start: 29
:lines: 29-35
:linenos:

These lines make an instance of the visualizer class, open a visualizer window, and add two geometries to the visualizer.
Expand All @@ -72,8 +70,8 @@ Transform geometry and visualize it

.. literalinclude:: ../../../examples/python/visualization/non_blocking_visualization.py
:language: python
:lineno-start: 59
:lines: 59-72
:lineno-start: 37
:lines: 37-49
Copy link
Contributor

@saurabheights saurabheights Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssheorey These changes in non_blocking_visualization.rst are taken care of here - https://github.com/isl-org/Open3D/pull/6321/files#diff-4d3bb3b76c894acd5303dbc1d2a0d919882866be425e1ce6279c4e59c0e951c0R28 (reminding just in case).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking! No worries, they will be updated when we merge #6321.

:linenos:

This script calls ``registration_icp`` for every iteration. Note that it explicitly forces only one ICP iteration via ``ICPConvergenceCriteria(max_iteration = 1)``. This is a trick to retrieve a slight pose update from a single ICP iteration. After ICP, source geometry is transformed accordingly.
Expand Down
2 changes: 2 additions & 0 deletions examples/python/visualization/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ def main():
multi_objects()
actions()
selections()
groups()
time_animation()


if __name__ == "__main__":
Expand Down
111 changes: 54 additions & 57 deletions python/open3d/visualization/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,22 @@ def draw(geometry=None,
on_animation_tick=None,
non_blocking_and_return_uid=False):
"""Draw 3D geometry types and 3D models. This is a high level interface to
O3DVIsualizer.
:class:`open3d.visualization.O3DVisualizer`.

The initial view may be specified either as a combination of (lookat, eye,
up, and field of view) or (intrinsic matrix, extrinsic matrix) pair. A
simple pinhole camera model is used.

Args:
geometry (List[geometry type] or List[Dict]): The 3D data to be
displayed can be provided in different types:
- A list of Open3D geometry types (``PointCloud``, ``TriangleMesh``,
``LineSet`` or ``TriangleMeshModel``).
- A list of dictionaries with geometry data and additional
metadata. The following keys are used:
- name (str): Geometry name.
- geometry (geometry type): Open3D geometry type as above.
- material (``MaterialRecord``): PBR material for the
geometry.
- is_visible (bool): Show this geometry?
geometry (List[Geometry] or List[Dict]): The 3D data to be displayed can be provided in different types:
- A list of any Open3D geometry types (``PointCloud``, ``TriangleMesh``, ``LineSet`` or ``TriangleMeshModel``).
- A list of dictionaries with geometry data and additional metadata. The following keys are used:
- **name** (str): Geometry name.
- **geometry** (Geometry): Open3D geometry to be drawn.
- **material** (:class:`open3d.visualization.rendering.MaterialRecord`): PBR material for the geometry.
- **group** (str): Assign the geometry to a group. Groups are shown in the settings panel and users can take take joint actions on a group as a whole.
- **time** (float): If geometry elements are assigned times, a time bar is displayed and the elements can be animated.
- **is_visible** (bool): Show this geometry?
title (str): Window title.
width (int): Viewport width.
height (int): Viewport height.
Expand Down Expand Up @@ -85,7 +83,7 @@ def draw(geometry=None,
animation_time_step (float): Duration in seconds for each animation
frame.
animation_duration (float): Total animation duration in seconds.
rpc_interface (bool): Start an RPC interface at localhost:51454 and
rpc_interface (bool): Start an RPC interface at http://localhost:51454 and
listen for drawing requests. The requests can be made with
:class:`open3d.visualization.ExternalVisualizer`.
on_init (Callable): Extra initialization procedure for the underlying
Expand All @@ -109,50 +107,49 @@ def draw(geometry=None,
Tensorboard plugin.

Example:

See `examples/python/visualization/draw.py` for examples of advanced
usage. The ``actions()`` example from that file is shown below::

import open3d as o3d
import open3d.visualization as vis

SOURCE_NAME = "Source"
RESULT_NAME = "Result (Poisson reconstruction)"
TRUTH_NAME = "Ground truth"

bunny = o3d.data.BunnyMesh()
bunny_mesh = o3d.io.read_triangle_mesh(bunny.path)
bunny_mesh.compute_vertex_normals()

bunny_mesh.paint_uniform_color((1, 0.75, 0))
bunny_mesh.compute_vertex_normals()
cloud = o3d.geometry.PointCloud()
cloud.points = bunny_mesh.vertices
cloud.normals = bunny_mesh.vertex_normals

def make_mesh(o3dvis):
mesh, _ = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(
cloud)
mesh.paint_uniform_color((1, 1, 1))
mesh.compute_vertex_normals()
o3dvis.add_geometry({"name": RESULT_NAME, "geometry": mesh})
o3dvis.show_geometry(SOURCE_NAME, False)

def toggle_result(o3dvis):
truth_vis = o3dvis.get_geometry(TRUTH_NAME).is_visible
o3dvis.show_geometry(TRUTH_NAME, not truth_vis)
o3dvis.show_geometry(RESULT_NAME, truth_vis)

vis.draw([{
"name": SOURCE_NAME,
"geometry": cloud
}, {
"name": TRUTH_NAME,
"geometry": bunny_mesh,
"is_visible": False
}],
actions=[("Create Mesh", make_mesh),
("Toggle truth/result", toggle_result)])
See `examples/visualization/draw.py` for examples of advanced usage. The ``actions()``
example from that file is shown below::

import open3d as o3d
import open3d.visualization as vis

SOURCE_NAME = "Source"
RESULT_NAME = "Result (Poisson reconstruction)"
TRUTH_NAME = "Ground truth"

bunny = o3d.data.BunnyMesh()
bunny_mesh = o3d.io.read_triangle_mesh(bunny.path)
bunny_mesh.compute_vertex_normals()

bunny_mesh.paint_uniform_color((1, 0.75, 0))
bunny_mesh.compute_vertex_normals()
cloud = o3d.geometry.PointCloud()
cloud.points = bunny_mesh.vertices
cloud.normals = bunny_mesh.vertex_normals

def make_mesh(o3dvis):
mesh, _ = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(
cloud)
mesh.paint_uniform_color((1, 1, 1))
mesh.compute_vertex_normals()
o3dvis.add_geometry({"name": RESULT_NAME, "geometry": mesh})
o3dvis.show_geometry(SOURCE_NAME, False)

def toggle_result(o3dvis):
truth_vis = o3dvis.get_geometry(TRUTH_NAME).is_visible
o3dvis.show_geometry(TRUTH_NAME, not truth_vis)
o3dvis.show_geometry(RESULT_NAME, truth_vis)

vis.draw([{
"name": SOURCE_NAME,
"geometry": cloud
}, {
"name": TRUTH_NAME,
"geometry": bunny_mesh,
"is_visible": False
}],
actions=[("Create Mesh", make_mesh),
("Toggle truth/result", toggle_result)])
"""
gui.Application.instance.initialize()
w = O3DVisualizer(title, width, height)
Expand Down