diff --git a/3rdparty/boringssl/boringssl.cmake b/3rdparty/boringssl/boringssl.cmake index 5f9aeea9e33..5048b76648f 100644 --- a/3rdparty/boringssl/boringssl.cmake +++ b/3rdparty/boringssl/boringssl.cmake @@ -48,7 +48,9 @@ ExternalProject_Add( CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + /$<$:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}ssl${CMAKE_STATIC_LIBRARY_SUFFIX} + /$<$:$,Debug,Release>/>lib/${CMAKE_STATIC_LIBRARY_PREFIX}crypto${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_boringssl SOURCE_DIR) diff --git a/3rdparty/curl/curl.cmake b/3rdparty/curl/curl.cmake index c45dbea0dd9..7a73051c1c0 100644 --- a/3rdparty/curl/curl.cmake +++ b/3rdparty/curl/curl.cmake @@ -51,6 +51,7 @@ if(BUILD_CURL_FROM_SOURCE) ${ExternalProject_CMAKE_ARGS_hidden} BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} + /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_curl INSTALL_DIR) @@ -79,7 +80,9 @@ else() CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX} + /lib/${CMAKE_STATIC_LIBRARY_PREFIX}${curl_lib_name}-d${CMAKE_STATIC_LIBRARY_SUFFIX} ) ExternalProject_Get_Property(ext_curl SOURCE_DIR) diff --git a/3rdparty/ipp/ipp.cmake b/3rdparty/ipp/ipp.cmake index ffc9b320512..deaed2ab179 100755 --- a/3rdparty/ipp/ipp.cmake +++ b/3rdparty/ipp/ipp.cmake @@ -35,6 +35,20 @@ else() set(IPP_SUBPATH "") endif() +# Threading layer libs must be linked first. +# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html +# Library dependency order: +# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html +if (WIN32) + set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) +else() + set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) +endif() + +foreach(item IN LISTS IPP_LIBRARIES) + list(APPEND IPP_BUILD_BYPRODUCTS /${IPP_SUBPATH}lib/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) +endforeach() + ExternalProject_Add(ext_ipp PREFIX ipp URL ${IPP_URL} @@ -45,16 +59,10 @@ ExternalProject_Add(ext_ipp CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - ) + BUILD_BYPRODUCTS + ${IPP_BUILD_BYPRODUCTS} +) + ExternalProject_Get_Property(ext_ipp SOURCE_DIR) set(IPP_INCLUDE_DIR "${SOURCE_DIR}/${IPP_SUBPATH}include/") -# Threading layer libs must be linked first. -# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/ipp-performace-benefits-with-tl-functions.html -# Library dependency order: -# https://www.intel.com/content/www/us/en/docs/ipp/developer-guide-reference/2021-11/library-dependencies-by-domain.html -if (WIN32) - set(IPP_LIBRARIES ipp_iw ippcvmt_tl_tbb ippcvmt ippimt_tl_tbb ippimt ippccmt_tl_tbb ippccmt ippsmt ippvmmt ippcoremt_tl_tbb ippcoremt) -else() - set(IPP_LIBRARIES ipp_iw ippcv_tl_tbb ippcv ippi_tl_tbb ippi ippcc_tl_tbb ippcc ipps ippvm ippcore_tl_tbb ippcore) -endif() set(IPP_LIB_DIR "${SOURCE_DIR}/${IPP_SUBPATH}lib") \ No newline at end of file diff --git a/3rdparty/uvatlas/uvatlas.cmake b/3rdparty/uvatlas/uvatlas.cmake index 51831059941..63642f80e3d 100644 --- a/3rdparty/uvatlas/uvatlas.cmake +++ b/3rdparty/uvatlas/uvatlas.cmake @@ -52,7 +52,7 @@ ExternalProject_Add( -Ddirectxmath_DIR= DEPENDS ext_directxheaders ext_directxmath BUILD_BYPRODUCTS - /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}uvatlas${CMAKE_STATIC_LIBRARY_SUFFIX} + /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}UVAtlas${CMAKE_STATIC_LIBRARY_SUFFIX} ) diff --git a/3rdparty/vtk/vtk_build.cmake b/3rdparty/vtk/vtk_build.cmake index 271d3789667..f9217f2301e 100644 --- a/3rdparty/vtk/vtk_build.cmake +++ b/3rdparty/vtk/vtk_build.cmake @@ -26,13 +26,13 @@ set(VTK_LIBRARIES vtksys-${VTK_VERSION}${VTK_LIB_SUFFIX} ) -foreach(item IN LISTS VTK_LIBRARIES) - list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) -endforeach() - if(BUILD_VTK_FROM_SOURCE) + foreach(item IN LISTS VTK_LIBRARIES) + list(APPEND VTK_BUILD_BYPRODUCTS /${Open3D_INSTALL_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endforeach() + ExternalProject_Add( ext_vtk PREFIX vtk @@ -294,6 +294,10 @@ if(BUILD_VTK_FROM_SOURCE) else() #### download prebuilt vtk + foreach(item IN LISTS VTK_LIBRARIES) + list(APPEND VTK_BUILD_BYPRODUCTS /lib/${item}${CMAKE_STATIC_LIBRARY_SUFFIX}) + endforeach() + if(LINUX_AARCH64) message(FATAL "No precompiled vtk for platform. Enable BUILD_VTK_FROM_SOURCE") elseif(APPLE_AARCH64) @@ -334,7 +338,8 @@ else() #### download prebuilt vtk CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS "" + BUILD_BYPRODUCTS + ${VTK_BUILD_BYPRODUCTS} ) ExternalProject_Get_Property(ext_vtk SOURCE_DIR) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ee0597af9c..03818e01b47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ - Fix minimal oriented bounding box of MeshBase derived classes and add new unit tests (PR #6898) - Fix projection of point cloud to Depth/RGBD image if no position attribute is provided (PR #6880) - Support lowercase types when reading PCD files (PR #6930) +- Fix visualization/draw ICP example and add warnings (PR #6933) ## 0.13 diff --git a/cpp/open3d/t/geometry/RaycastingScene.cpp b/cpp/open3d/t/geometry/RaycastingScene.cpp index 901bc651ed0..4a4482ebc4d 100644 --- a/cpp/open3d/t/geometry/RaycastingScene.cpp +++ b/cpp/open3d/t/geometry/RaycastingScene.cpp @@ -1174,4 +1174,21 @@ uint32_t RaycastingScene::INVALID_ID() { return RTC_INVALID_GEOMETRY_ID; } } // namespace geometry } // namespace t -} // namespace open3d \ No newline at end of file + + +namespace fmt { +template <> +struct formatter { + template + auto format(const RTCError& c, FormatContext& ctx) const { + const char* name = rtcGetErrorString(c); + return format_to(ctx.out(), name); + } + + template + constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } +}; +} // namespace fmt + diff --git a/cpp/open3d/utility/IJsonConvertible.h b/cpp/open3d/utility/IJsonConvertible.h index 8febffa566f..e18e2948a23 100644 --- a/cpp/open3d/utility/IJsonConvertible.h +++ b/cpp/open3d/utility/IJsonConvertible.h @@ -86,7 +86,7 @@ namespace fmt { template <> struct formatter { template - auto format(const Json::Value &value, FormatContext &ctx) + auto format(const Json::Value &value, FormatContext &ctx) const -> decltype(ctx.out()) { return format_to(ctx.out(), "{}", open3d::utility::JsonToString(value)); } diff --git a/cpp/open3d/visualization/rendering/RendererHandle.h b/cpp/open3d/visualization/rendering/RendererHandle.h index dc8b06382e7..be69a3d99a8 100644 --- a/cpp/open3d/visualization/rendering/RendererHandle.h +++ b/cpp/open3d/visualization/rendering/RendererHandle.h @@ -164,7 +164,7 @@ struct formatter< char>> { template auto format(const open3d::visualization::rendering::REHandle_abstract& uid, - FormatContext& ctx) -> decltype(ctx.out()) { + FormatContext& ctx) const -> decltype(ctx.out()) { return format_to(ctx.out(), "[{}, {}, hash: {}]", open3d::visualization::rendering::REHandle_abstract:: TypeToString(uid.type), diff --git a/examples/python/visualization/draw.py b/examples/python/visualization/draw.py index f354f55783e..231a0af8bb0 100644 --- a/examples/python/visualization/draw.py +++ b/examples/python/visualization/draw.py @@ -11,6 +11,7 @@ import open3d.visualization as vis import os import random +import warnings pyexample_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) test_data_path = os.path.join(os.path.dirname(pyexample_path), 'test_data') @@ -142,30 +143,46 @@ def selections(): source_name = "Source (yellow)" target_name = "Target (blue)" - def do_icp_one_set(o3dvis): + def _prep_correspondences(o3dvis, two_set=False): # sets: [name: [{ "index": int, "order": int, "point": (x, y, z)}, ...], # ...] sets = o3dvis.get_selection_sets() - source_picked = sorted(list(sets[0][source_name]), - key=lambda x: x.order) - target_picked = sorted(list(sets[0][target_name]), - key=lambda x: x.order) - source_indices = [idx.index for idx in source_picked] - target_indices = [idx.index for idx in target_picked] - - t = get_icp_transform(source, target, source_indices, target_indices) - source.transform(t) - - # Update the source geometry - o3dvis.remove_geometry(source_name) - o3dvis.add_geometry({"name": source_name, "geometry": source}) + if not sets: + warnings.warn( + "Empty selection sets. Select point correspondences for initial rough transform.", + RuntimeWarning) + return [], [] + if source_name not in sets[0]: + warnings.warn( + "First selection set should contain Source (yellow) points.", + RuntimeWarning) + return [], [] - def do_icp_two_sets(o3dvis): - sets = o3dvis.get_selection_sets() source_set = sets[0][source_name] - target_set = sets[1][target_name] + if two_set: + if not len(sets) == 2: + warnings.warn( + "Two set registration requires exactly two selection sets of corresponding points.", + RuntimeWarning) + return [], [] + target_set = sets[1][target_name] + else: + if target_name not in sets[0]: + warnings.warn( + "Selection set should contain Target (blue) points.", + RuntimeWarning) + return [], [] + target_set = sets[0][target_name] source_picked = sorted(list(source_set), key=lambda x: x.order) target_picked = sorted(list(target_set), key=lambda x: x.order) + if len(source_picked) != len(target_picked): + warnings.warn( + f"Registration requires equal number of corresponding points (current selection: {len(source_picked)} source, {len(target_picked)} target).", + RuntimeWarning) + return [], [] + return source_picked, target_picked + + def _do_icp(o3dvis, source_picked, target_picked): source_indices = [idx.index for idx in source_picked] target_indices = [idx.index for idx in target_picked] @@ -176,6 +193,12 @@ def do_icp_two_sets(o3dvis): o3dvis.remove_geometry(source_name) o3dvis.add_geometry({"name": source_name, "geometry": source}) + def do_icp_one_set(o3dvis): + _do_icp(o3dvis, *_prep_correspondences(o3dvis)) + + def do_icp_two_sets(o3dvis): + _do_icp(o3dvis, *_prep_correspondences(o3dvis, two_set=True)) + vis.draw([{ "name": source_name, "geometry": source