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
10 changes: 8 additions & 2 deletions 3rdparty/find_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ endfunction()
# finding the package is quiet
# PACKAGE <pkg>
# the name of the queried package <pkg> forwarded to find_package()
# VERSION <version>
# the compatible version (single or range) required for the package forwarded to find_package()
# PACKAGE_VERSION_VAR <pkg_version>
# the variable <pkg_version> where to find the version of the queried package <pkg> find_package().
# If not provided, PACKAGE_VERSION_VAR will default to <pkg>_VERSION.
Expand All @@ -269,7 +271,8 @@ endfunction()
# If <pkg> also defines targets, use them instead and pass them via TARGETS option.
#
function(open3d_find_package_3rdparty_library name)
cmake_parse_arguments(arg "PUBLIC;HEADER;REQUIRED;QUIET" "PACKAGE;PACKAGE_VERSION_VAR" "TARGETS;INCLUDE_DIRS;LIBRARIES" ${ARGN})
cmake_parse_arguments(arg "PUBLIC;HEADER;REQUIRED;QUIET"
"PACKAGE;VERSION;PACKAGE_VERSION_VAR" "TARGETS;INCLUDE_DIRS;LIBRARIES" ${ARGN})
if(arg_UNPARSED_ARGUMENTS)
message(STATUS "Unparsed: ${arg_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "Invalid syntax: open3d_find_package_3rdparty_library(${name} ${ARGN})")
Expand All @@ -281,6 +284,9 @@ function(open3d_find_package_3rdparty_library name)
set(arg_PACKAGE_VERSION_VAR "${arg_PACKAGE}_VERSION")
endif()
set(find_package_args "")
if(arg_VERSION)
list(APPEND find_package_args ${arg_VERSION})
endif()
if(arg_REQUIRED)
list(APPEND find_package_args "REQUIRED")
endif()
Expand Down Expand Up @@ -1455,7 +1461,7 @@ endif()
# VTK
if(USE_SYSTEM_VTK)
open3d_find_package_3rdparty_library(3rdparty_vtk
PACKAGE VTK
PACKAGE VTK VERSION 9.1
TARGETS
VTK::FiltersGeneral
VTK::FiltersSources
Expand Down
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 @@ -73,7 +73,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 @@ -96,7 +96,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
4 changes: 2 additions & 2 deletions examples/python/io/realsense_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
print(rscam.get_metadata())
for fid in range(5):
rgbd_frame = rscam.capture_frame()
o3d.io.write_image(f"color{fid:05d}.jpg", rgbd_frame.color.to_legacy())
o3d.io.write_image(f"depth{fid:05d}.png", rgbd_frame.depth.to_legacy())
o3d.t.io.write_image(f"color{fid:05d}.jpg", rgbd_frame.color)
o3d.t.io.write_image(f"depth{fid:05d}.png", rgbd_frame.depth)
print("Frame: {}, time: {}s".format(fid, rscam.get_timestamp() * 1e-6))

rscam.stop_capture()
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def estimate_3D_transform_RANSAC(pts_xyz_s, pts_xyz_t):
if (n_inlier > max_inlier) and (np.linalg.det(R_approx) != 0.0) and \
(R_approx[0,0] > 0 and R_approx[1,1] > 0 and R_approx[2,2] > 0):
Transform_good[:3, :3] = R_approx
Transform_good[:3, 3] = [t_approx[0], t_approx[1], t_approx[2]]
Transform_good[:3, 3:] = t_approx
max_inlier = n_inlier
inlier_vec = [id_iter for diff_iter, id_iter \
in zip(diff, range(n_points)) \
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
109 changes: 109 additions & 0 deletions python/open3d/visualization/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,115 @@ 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
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?
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 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.
???
on_animation_tick (Callable): Callback for each animation time step. ???
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/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)])
"""
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)