Skip to content

Commit

Permalink
Build fixes MSVC and gcc (#6039)
Browse files Browse the repository at this point in the history
Windows MSVC revert to fmt 6
gcc-12 maybe-uninitialized warning
set VTK compatible version
documentation for draw
  • Loading branch information
ssheorey authored Sep 7, 2023
1 parent b620539 commit 5b6ef4b
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 17 deletions.
5 changes: 2 additions & 3 deletions 3rdparty/fmt/fmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ include(ExternalProject)

set(FMT_LIB_NAME fmt)

if (MSVC AND MSVC_VERSION VERSION_LESS 1930 OR
CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
# MSVC 17.x required for building fmt >6
if (MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
# MSVC has errors when building fmt >6, up till 9.1
# SYCL / DPC++ needs fmt ver <=6 or >= 9.2: https://github.com/fmtlib/fmt/issues/3005
set(FMT_VER "6.0.0")
set(FMT_SHA256
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/possionrecon/possionrecon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ include(ExternalProject)
ExternalProject_Add(
ext_poisson
PREFIX poisson
URL https://github.com/isl-org/Open3D-PoissonRecon/archive/fd273ea8c77a36973d6565a495c9969ccfb12d3b.tar.gz
URL_HASH SHA256=917d98e037982d57a159fa166b259ff3dc90ffffe09c6a562a71b400f6869ddf
URL https://github.com/isl-org/Open3D-PoissonRecon/archive/90f3f064e275b275cff445881ecee5a7c495c9e0.tar.gz
URL_HASH SHA256=1310df0c80ff0616b8fcf9b2fb568aa9b2190d0e071b0ead47dba339c146b1d3
DOWNLOAD_DIR "${OPEN3D_THIRD_PARTY_DOWNLOAD_DIR}/poisson"
SOURCE_DIR "poisson/src/ext_poisson/PoissonRecon" # Add extra directory level for POISSON_INCLUDE_DIRS.
UPDATE_COMMAND ""
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_git_short_hash():
'm2r2',
]

if os.environ["skip_notebooks"] == "true":
if os.environ.get("skip_notebooks", "false") == "true":
print("Skipping Jupyter notebooks")
extensions = [e for e in extensions if e != "nbsphinx"]

Expand All @@ -94,7 +94,7 @@ def get_git_short_hash():

# General information about the project.
project = u"Open3D"
copyright = u"2018 - 2021, www.open3d.org"
copyright = u"2018 - 2023, www.open3d.org"
author = u"www.open3d.org"

# The version info for the project you're documenting, acts as replacement for
Expand Down
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
: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: 1 addition & 1 deletion examples/python/reconstruction_system/run_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
initialize_config(config)
check_folder_structure(config['path_dataset'])
else:
# load deafult dataset.
# load default dataset.
config = dataset_loader(args.default_dataset)

assert config is not None
Expand Down
3 changes: 2 additions & 1 deletion examples/python/t_reconstruction_system/dense_slam.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import time

from config import ConfigParser
from common import get_default_dataset, load_rgbd_file_names, save_poses, load_intrinsic, extract_trianglemesh, get_default_testdata, extract_rgbd_frames
from common import (get_default_dataset, load_rgbd_file_names, save_poses,
load_intrinsic, extract_trianglemesh, extract_rgbd_frames)


def slam(depth_file_names, color_file_names, intrinsic, config):
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
115 changes: 115 additions & 0 deletions python/open3d/visualization/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,121 @@ def draw(geometry=None,
on_animation_frame=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
: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] 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.
actions (List[(str, Callable)]): A list of pairs of action names and the
corresponding functions to execute. These actions are presented as
buttons in the settings panel. Each callable receives the window
(``O3DVisualizer``) as an argument.
lookat (array of shape (3,)): Camera principal axis direction.
eye (array of shape (3,)): Camera location.
up (array of shape (3,)): Camera up direction.
field_of_view (float): Camera horizontal field of view (degrees).
intrinsic_matrix (array of shape (3,3)): Camera intrinsic matrix.
extrinsic_matrix (array of shape (4,4)): Camera extrinsic matrix (world
to camera transformation).
bg_color (array of shape (4,)): Background color float with range [0,1],
default white.
bg_image (open3d.geometry.Image): Background image.
ibl (open3d.geometry.Image): Environment map for image based lighting
(IBL).
ibl_intensity (float): IBL intensity.
show_skybox (bool): Show skybox as scene background (default False).
show_ui (bool): Show settings user interface (default False). This can
be toggled from the Actions menu.
raw_mode (bool): Use raw mode for simpler rendering of the basic
geometry (Default false).
point_size (int): 3D point size (default 3).
line_width (int): 3D line width (default 1).
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 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
GUI window. The procedure receives a single argument of type
:class:`open3d.visualization.O3DVisualizer`.
on_animation_frame (Callable): Callback for each animation frame update
with signature::
Callback(O3DVisualizer, double time) -> None
on_animation_tick (Callable): Callback for each animation time step with
signature::
Callback(O3DVisualizer, double tick_duration, double time) -> TickResult
If the callback returns ``TickResult.REDRAW``, the scene is redrawn.
It should return ``TickResult.NOCHANGE`` if redraw is not required.
non_blocking_and_return_uid (bool): Do not block waiting for the user
to close the window. Instead return the window ID. This is useful
for embedding the visualizer and is used in the WebRTC interface and
Tensorboard plugin.
Example:
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)
w.set_background(bg_color, bg_image)
Expand Down
3 changes: 3 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def finalize_options(self):
description="@PROJECT_DESCRIPTION@",
long_description=long_description,
long_description_content_type="text/x-rst",
# Metadata below is valid but currently ignored by pip (<=v23)
obsoletes=["open3d_python"],
provides=["open3d", "open3d_cpu"], # For open3d-cpu
)

setup(**setup_args)

0 comments on commit 5b6ef4b

Please sign in to comment.