diff --git a/.github/workflows/clean-gcloud-profiles.yml b/.github/workflows/clean-gcloud-profiles.yml index 0aec813a48f..2521b1de160 100644 --- a/.github/workflows/clean-gcloud-profiles.yml +++ b/.github/workflows/clean-gcloud-profiles.yml @@ -16,14 +16,11 @@ # happens, run this workflow manually to clean up the login profiles. name: Clean GCloud Profiles +permissions: + contents: read on: workflow_dispatch: - # push: - # branches: - # - main - # pull_request: - # types: [opened, reopened, synchronize] env: GCE_GPU_CI_SA: ${{ secrets.GCE_GPU_CI_SA }} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 00580af33d9..83527c68b56 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,4 +1,7 @@ name: Documentation +permissions: + contents: write + actions: write on: workflow_dispatch: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f0234f975ee..362cc2327f0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,4 +1,7 @@ name: MacOS +permissions: + contents: write + actions: write on: workflow_dispatch: diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index e0de61516be..3c27504fdd9 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,4 +1,7 @@ name: Style Check +permissions: + contents: read + actions: write on: workflow_dispatch: diff --git a/.github/workflows/ubuntu-cuda.yml b/.github/workflows/ubuntu-cuda.yml index 1ff1d20c75b..9cf3cd3e749 100644 --- a/.github/workflows/ubuntu-cuda.yml +++ b/.github/workflows/ubuntu-cuda.yml @@ -1,4 +1,7 @@ name: Ubuntu CUDA +permissions: + contents: write + actions: write on: workflow_dispatch: diff --git a/.github/workflows/ubuntu-openblas.yml b/.github/workflows/ubuntu-openblas.yml index 9bbb423f457..acfe20e4ddf 100644 --- a/.github/workflows/ubuntu-openblas.yml +++ b/.github/workflows/ubuntu-openblas.yml @@ -1,4 +1,7 @@ name: Ubuntu OpenBLAS +permissions: + contents: read + actions: write on: workflow_dispatch: diff --git a/.github/workflows/ubuntu-sycl.yml b/.github/workflows/ubuntu-sycl.yml index 4f4c9f6d9c1..984d0fe9485 100644 --- a/.github/workflows/ubuntu-sycl.yml +++ b/.github/workflows/ubuntu-sycl.yml @@ -1,4 +1,7 @@ name: Ubuntu SYCL +permissions: + contents: read + actions: write on: workflow_dispatch: diff --git a/.github/workflows/ubuntu-wheel.yml b/.github/workflows/ubuntu-wheel.yml index 2ff88c74b6a..733c52218ee 100644 --- a/.github/workflows/ubuntu-wheel.yml +++ b/.github/workflows/ubuntu-wheel.yml @@ -1,4 +1,7 @@ name: Ubuntu Wheel +permissions: + contents: write + actions: write on: workflow_dispatch: @@ -102,7 +105,7 @@ jobs: run: | gsutil cp ${GITHUB_WORKSPACE}/${{ env.CCACHE_TAR_NAME }}.tar.gz gs://open3d-ci-cache/ - name: Update devel release - # if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} env: GH_TOKEN: ${{ github.token }} run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ba2765c82c7..08ef6721fea 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,7 @@ name: Ubuntu +permissions: + contents: write + actions: write on: workflow_dispatch: diff --git a/.github/workflows/vtk_packages.yml b/.github/workflows/vtk_packages.yml index acd20c5260b..a134daeb71a 100644 --- a/.github/workflows/vtk_packages.yml +++ b/.github/workflows/vtk_packages.yml @@ -1,8 +1,8 @@ name: VTK Packages +permissions: + contents: write on: - # pull_request: - # branches: [ main ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.github/workflows/webrtc.yml b/.github/workflows/webrtc.yml index 90c45e053e7..91a9a5b122d 100644 --- a/.github/workflows/webrtc.yml +++ b/.github/workflows/webrtc.yml @@ -1,4 +1,7 @@ name: WebRTC +permissions: + contents: write + actions: write on: workflow_dispatch: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 141f1917a30..c3c1d1e8395 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,4 +1,7 @@ name: Windows +permissions: + contents: write + actions: write on: workflow_dispatch: diff --git a/3rdparty/find_dependencies.cmake b/3rdparty/find_dependencies.cmake index d929b27728a..45555b83a84 100644 --- a/3rdparty/find_dependencies.cmake +++ b/3rdparty/find_dependencies.cmake @@ -1554,7 +1554,9 @@ if(OPEN3D_USE_ONEAPI_PACKAGES) TARGETS TBB::tbb ) list(APPEND Open3D_3RDPARTY_PRIVATE_TARGETS_FROM_SYSTEM Open3D::3rdparty_tbb) - + target_compile_definitions(3rdparty_tbb INTERFACE OPEN3D_USE_ONEAPI_PACKAGES=1) + target_compile_definitions(3rdparty_tbb INTERFACE _PSTL_UDR_PRESENT=0) + target_compile_definitions(3rdparty_tbb INTERFACE _PSTL_UDS_PRESENT=0) # 2. oneDPL # /opt/intel/oneapi/dpl/latest/lib/cmake/oneDPL open3d_find_package_3rdparty_library(3rdparty_onedpl diff --git a/3rdparty/fmt/fmt.cmake b/3rdparty/fmt/fmt.cmake index 88cd8e2fcef..d7698e1a645 100644 --- a/3rdparty/fmt/fmt.cmake +++ b/3rdparty/fmt/fmt.cmake @@ -2,16 +2,20 @@ include(ExternalProject) set(FMT_LIB_NAME fmt) -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 - "f1907a58d5e86e6c382e51441d92ad9e23aea63827ba47fd647eacc0d3a16c78") +if (MSVC AND BUILD_CUDA_MODULE) + if (MSVC_VERSION GREATER_EQUAL 1930) # v143 + set(FMT_VER "10.1.1") + set(FMT_SHA256 + "78b8c0a72b1c35e4443a7e308df52498252d1cefc2b08c9a97bc9ee6cfe61f8b") + else() + set(FMT_VER "6.0.0") + set(FMT_SHA256 + "f1907a58d5e86e6c382e51441d92ad9e23aea63827ba47fd647eacc0d3a16c78") + endif() else() - set(FMT_VER "9.0.0") + set(FMT_VER "10.2.1") set(FMT_SHA256 - "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5") + "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811") endif() ExternalProject_Add( diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a6e8a59ac2..e192ce692e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - Fix KDTreeFlann possibly using a dangling pointer instead of internal storage and simplified its members (PR #6734) - Fix RANSAC early stop if no inliers in a specific iteration (PR #6789) - Fix segmentation fault (infinite recursion) of DetectPlanarPatches if multiple points have same coordinates (PR #6794) +- Fix build with fmt v10.2.0 (#6783) - Fix segmentation fault (lambda reference capture) of VisualizerWithCustomAnimation::Play (PR #6804) ## 0.13 diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000000..38d9c833993 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +# Security Policy +Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. + +## Reporting a Vulnerability +Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). \ No newline at end of file diff --git a/cpp/open3d/core/DLPack.h b/cpp/open3d/core/DLPack.h index 9a0c3e57aff..1cec10a712f 100644 --- a/cpp/open3d/core/DLPack.h +++ b/cpp/open3d/core/DLPack.h @@ -188,4 +188,56 @@ typedef struct DLManagedTensor { #ifdef __cplusplus } // DLPACK_EXTERN_C #endif + +#include +#include + +namespace fmt { + +template <> +struct formatter { + template + auto format(const DLDeviceType& c, FormatContext& ctx) const + -> decltype(ctx.out()) { + const char* text = nullptr; + switch (c) { + case kDLCPU: + text = "kDLCPU"; + break; + case kDLGPU: + text = "kDLGPU"; + break; + case kDLCPUPinned: + text = "kDLCPUPinned"; + break; + case kDLOpenCL: + text = "kDLOpenCL"; + break; + case kDLVulkan: + text = "kDLVulkan"; + break; + case kDLMetal: + text = "kDLMetal"; + break; + case kDLVPI: + text = "kDLVPI"; + break; + case kDLROCM: + text = "kDLROCM"; + break; + case kDLExtDev: + text = "kDLExtDev"; + break; + } + return format_to(ctx.out(), text); + } + + template + constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } +}; + +} // namespace fmt + #endif // DLPACK_DLPACK_H_ diff --git a/cpp/open3d/core/linalg/LinalgHeadersCUDA.h b/cpp/open3d/core/linalg/LinalgHeadersCUDA.h index d34394dc813..cf1b8d635ba 100644 --- a/cpp/open3d/core/linalg/LinalgHeadersCUDA.h +++ b/cpp/open3d/core/linalg/LinalgHeadersCUDA.h @@ -16,4 +16,107 @@ #include #include #include +#include +#include + +namespace fmt { + +template <> +struct formatter { + template + auto format(const cusolverStatus_t& c, FormatContext& ctx) const + -> decltype(ctx.out()) { + const char* text = nullptr; + switch (c) { + case CUSOLVER_STATUS_SUCCESS: + text = "CUSOLVER_STATUS_SUCCESS"; + break; + case CUSOLVER_STATUS_NOT_INITIALIZED: + text = "CUSOLVER_STATUS_NOT_INITIALIZED"; + break; + case CUSOLVER_STATUS_ALLOC_FAILED: + text = "CUSOLVER_STATUS_ALLOC_FAILED"; + break; + case CUSOLVER_STATUS_INVALID_VALUE: + text = "CUSOLVER_STATUS_INVALID_VALUE"; + break; + case CUSOLVER_STATUS_ARCH_MISMATCH: + text = "CUSOLVER_STATUS_ARCH_MISMATCH"; + break; + case CUSOLVER_STATUS_MAPPING_ERROR: + text = "CUSOLVER_STATUS_MAPPING_ERROR"; + break; + case CUSOLVER_STATUS_EXECUTION_FAILED: + text = "CUSOLVER_STATUS_EXECUTION_FAILED"; + break; + case CUSOLVER_STATUS_INTERNAL_ERROR: + text = "CUSOLVER_STATUS_INTERNAL_ERROR"; + break; + case CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED: + text = "CUSOLVER_STATUS_MATRIX_TYPE_NOT_SUPPORTED"; + break; + case CUSOLVER_STATUS_NOT_SUPPORTED: + text = "CUSOLVER_STATUS_NOT_SUPPORTED"; + break; + case CUSOLVER_STATUS_ZERO_PIVOT: + text = "CUSOLVER_STATUS_ZERO_PIVOT"; + break; + case CUSOLVER_STATUS_INVALID_LICENSE: + text = "CUSOLVER_STATUS_INVALID_LICENSE"; + break; + case CUSOLVER_STATUS_IRS_PARAMS_NOT_INITIALIZED: + text = "CUSOLVER_STATUS_IRS_PARAMS_NOT_INITIALIZED"; + break; + case CUSOLVER_STATUS_IRS_PARAMS_INVALID: + text = "CUSOLVER_STATUS_IRS_PARAMS_INVALID"; + break; + case CUSOLVER_STATUS_IRS_PARAMS_INVALID_PREC: + text = "CUSOLVER_STATUS_IRS_PARAMS_INVALID_PREC"; + break; + case CUSOLVER_STATUS_IRS_PARAMS_INVALID_REFINE: + text = "CUSOLVER_STATUS_IRS_PARAMS_INVALID_REFINE"; + break; + case CUSOLVER_STATUS_IRS_PARAMS_INVALID_MAXITER: + text = "CUSOLVER_STATUS_IRS_PARAMS_INVALID_MAXITER"; + break; + case CUSOLVER_STATUS_IRS_INTERNAL_ERROR: + text = "CUSOLVER_STATUS_IRS_INTERNAL_ERROR"; + break; + case CUSOLVER_STATUS_IRS_NOT_SUPPORTED: + text = "CUSOLVER_STATUS_IRS_NOT_SUPPORTED"; + break; + case CUSOLVER_STATUS_IRS_OUT_OF_RANGE: + text = "CUSOLVER_STATUS_IRS_OUT_OF_RANGE"; + break; + case CUSOLVER_STATUS_IRS_NRHS_NOT_SUPPORTED_FOR_REFINE_GMRES: + text = "CUSOLVER_STATUS_IRS_NRHS_NOT_SUPPORTED_FOR_REFINE_" + "GMRES"; + break; + case CUSOLVER_STATUS_IRS_INFOS_NOT_INITIALIZED: + text = "CUSOLVER_STATUS_IRS_INFOS_NOT_INITIALIZED"; + break; + case CUSOLVER_STATUS_IRS_INFOS_NOT_DESTROYED: + text = "CUSOLVER_STATUS_IRS_INFOS_NOT_DESTROYED"; + break; + case CUSOLVER_STATUS_IRS_MATRIX_SINGULAR: + text = "CUSOLVER_STATUS_IRS_MATRIX_SINGULAR"; + break; + case CUSOLVER_STATUS_INVALID_WORKSPACE: + text = "CUSOLVER_STATUS_INVALID_WORKSPACE"; + break; + default: + text = "CUSOLVER_STATUS_UNKNOWN"; + break; + } + return format_to(ctx.out(), text); + } + + template + constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } +}; + +} // namespace fmt + #endif diff --git a/cpp/open3d/geometry/LineSetFactory.cpp b/cpp/open3d/geometry/LineSetFactory.cpp index 41e44d1db5f..3a66d86d300 100644 --- a/cpp/open3d/geometry/LineSetFactory.cpp +++ b/cpp/open3d/geometry/LineSetFactory.cpp @@ -170,6 +170,25 @@ std::shared_ptr LineSet::CreateCameraVisualization( lines->lines_.push_back({4, 1}); lines->PaintUniformColor({0.0f, 0.0f, 1.0f}); + // Add XYZ axes + lines->points_.push_back( + mult(m, Eigen::Vector3d{intrinsic(0, 0) * scale, 0.0, 0.0})); + lines->points_.push_back( + mult(m, Eigen::Vector3d{0.0, intrinsic(1, 1) * scale, 0.0})); + lines->points_.push_back( + mult(m, Eigen::Vector3d{intrinsic(0, 2) * scale, + intrinsic(1, 2) * scale, scale})); + + // Add lines for the axes + lines->lines_.push_back({0, 5}); // X axis (red) + lines->lines_.push_back({0, 6}); // Y axis (green) + lines->lines_.push_back({0, 7}); // Z axis (blue) + + // Set colors for the axes + lines->colors_.push_back({1.0f, 0.0f, 0.0f}); // Red + lines->colors_.push_back({0.0f, 1.0f, 0.0f}); // Green + lines->colors_.push_back({0.0f, 0.0f, 1.0f}); // Blue + return lines; } diff --git a/cpp/open3d/io/IJsonConvertibleIO.h b/cpp/open3d/io/IJsonConvertibleIO.h index 8bc9f03b13b..a366b4f5ef8 100644 --- a/cpp/open3d/io/IJsonConvertibleIO.h +++ b/cpp/open3d/io/IJsonConvertibleIO.h @@ -82,7 +82,7 @@ bool WriteIJsonConvertibleToJSONString(std::string &json_string, [&str](const std::pair &es_pair) \ -> bool { return es_pair.second == str; }); \ e = ((it != std::end(m)) ? it : std::begin(m))->first; \ - utility::LogDebug("{} -> {}", str, e); \ + utility::LogDebug("{} -> {}", str, enum_to_string(e)); \ } } // namespace io diff --git a/cpp/open3d/io/sensor/azure_kinect/K4aPlugin.h b/cpp/open3d/io/sensor/azure_kinect/K4aPlugin.h index cd9a6eb1db1..15e461d4285 100644 --- a/cpp/open3d/io/sensor/azure_kinect/K4aPlugin.h +++ b/cpp/open3d/io/sensor/azure_kinect/K4aPlugin.h @@ -295,3 +295,38 @@ k4a_result_t k4a_transformation_depth_image_to_point_cloud( } // namespace k4a_plugin } // namespace io } // namespace open3d + +#include + +namespace fmt { + +template <> +struct formatter { + template + auto format(const k4a_wait_result_t &c, FormatContext &ctx) const + -> decltype(ctx.out()) { + const char *text = nullptr; + switch (c) { + case K4A_WAIT_RESULT_SUCCEEDED: + text = "K4A_WAIT_RESULT_SUCCEEDED"; + break; + case K4A_WAIT_RESULT_FAILED: + text = "K4A_WAIT_RESULT_FAILED"; + break; + case K4A_WAIT_RESULT_TIMEOUT: + text = "K4A_WAIT_RESULT_TIMEOUT"; + break; + default: + text = "Unknown k4a_wait_result_t"; + break; + } + return format_to(ctx.out(), text); + } + + template + constexpr auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } +}; + +} // namespace fmt diff --git a/cpp/open3d/ml/pytorch/CMakeLists.txt b/cpp/open3d/ml/pytorch/CMakeLists.txt index adc9ac48e3d..3cb75e531de 100644 --- a/cpp/open3d/ml/pytorch/CMakeLists.txt +++ b/cpp/open3d/ml/pytorch/CMakeLists.txt @@ -140,9 +140,18 @@ target_link_libraries(open3d_torch_ops PRIVATE Open3D::3rdparty_eigen3 Open3D::3rdparty_fmt Open3D::3rdparty_nanoflann - Open3D::3rdparty_parallelstl Open3D::3rdparty_tbb ) +if (TARGET Open3D::3rdparty_parallelstl) + target_link_libraries(open3d_torch_ops PRIVATE + Open3D::3rdparty_parallelstl + ) +endif() +if (TARGET Open3D::3rdparty_onedpl) + target_link_libraries(open3d_torch_ops PRIVATE + Open3D::3rdparty_onedpl + ) +endif() if (BUILD_CUDA_MODULE) target_link_libraries(open3d_torch_ops PRIVATE diff --git a/cpp/open3d/t/geometry/LineSet.cpp b/cpp/open3d/t/geometry/LineSet.cpp index c2d95f0ced2..f525694ca45 100644 --- a/cpp/open3d/t/geometry/LineSet.cpp +++ b/cpp/open3d/t/geometry/LineSet.cpp @@ -9,6 +9,7 @@ #include +#include "open3d/core/Dtype.h" #include "open3d/core/EigenConverter.h" #include "open3d/core/ShapeUtil.h" #include "open3d/core/Tensor.h" @@ -211,6 +212,81 @@ OrientedBoundingBox LineSet::GetOrientedBoundingBox() const { return OrientedBoundingBox::CreateFromPoints(GetPointPositions()); } +LineSet &LineSet::PaintUniformColor(const core::Tensor &color) { + core::AssertTensorShape(color, {3}); + core::Tensor clipped_color = color.To(GetDevice()); + if (color.GetDtype() == core::Float32 || + color.GetDtype() == core::Float64) { + clipped_color = clipped_color.Clip(0.0f, 1.0f); + } + core::Tensor ls_colors = + core::Tensor::Empty({GetLineIndices().GetLength(), 3}, + clipped_color.GetDtype(), GetDevice()); + ls_colors.AsRvalue() = clipped_color; + SetLineColors(ls_colors); + + return *this; +} + +LineSet LineSet::CreateCameraVisualization(int view_width_px, + int view_height_px, + const core::Tensor &intrinsic_in, + const core::Tensor &extrinsic_in, + double scale, + const core::Tensor &color) { + core::AssertTensorShape(intrinsic_in, {3, 3}); + core::AssertTensorShape(extrinsic_in, {4, 4}); + core::Tensor intrinsic = intrinsic_in.To(core::Float32, "CPU:0"); + core::Tensor extrinsic = extrinsic_in.To(core::Float32, "CPU:0"); + + // Calculate points for camera visualization + float w(view_width_px), h(view_height_px), s(scale); + float fx = intrinsic[0][0].Item(), + fy = intrinsic[1][1].Item(), + cx = intrinsic[0][2].Item(), + cy = intrinsic[1][2].Item(); + core::Tensor points = core::Tensor::Init({{0.f, 0.f, 0.f}, // origin + {0.f, 0.f, s}, + {w * s, 0.f, s}, + {w * s, h * s, s}, + {0.f, h * s, s}, + // Add XYZ axes + {fx * s, 0.f, 0.f}, + {0.f, fy * s, 0.f}, + {cx * s, cy * s, s}}); + points = (intrinsic.Inverse().Matmul(points.T()) - + extrinsic.Slice(0, 0, 3).Slice(1, 3, 4)) + .T() + .Matmul(extrinsic.Slice(0, 0, 3).Slice(1, 0, 3)); + + // Add lines for camera frame and XYZ axes + core::Tensor lines = core::Tensor::Init({{0, 1}, + {0, 2}, + {0, 3}, + {0, 4}, + {1, 2}, + {2, 3}, + {3, 4}, + {4, 1}, + // Add XYZ axes + {0, 5}, + {0, 6}, + {0, 7}}); + + LineSet lineset(points, lines); + if (color.NumElements() == 3) { + lineset.PaintUniformColor(color); + } else { + lineset.PaintUniformColor(core::Tensor::Init({0.f, 0.f, 1.f})); + } + auto &lscolors = lineset.GetLineColors(); + lscolors[8] = core::Tensor::Init({1.f, 0.f, 0.f}); // Red + lscolors[9] = core::Tensor::Init({0.f, 1.f, 0.f}); // Green + lscolors[10] = core::Tensor::Init({0.f, 0.f, 1.f}); // Blue + + return lineset; +} + } // namespace geometry } // namespace t } // namespace open3d diff --git a/cpp/open3d/t/geometry/LineSet.h b/cpp/open3d/t/geometry/LineSet.h index 6c3ecb66da8..38fb7c61be2 100644 --- a/cpp/open3d/t/geometry/LineSet.h +++ b/cpp/open3d/t/geometry/LineSet.h @@ -337,6 +337,12 @@ class LineSet : public Geometry, public DrawableGeometry { /// \return Rotated line set. LineSet &Rotate(const core::Tensor &R, const core::Tensor ¢er); + /// \brief Assigns uniform color to all lines of the LineSet. + /// + /// \param color RGB color for the LineSet. {3,} shaped Tensor. + /// Floating color values are clipped between 0.0 and 1.0. + LineSet &PaintUniformColor(const core::Tensor &color); + /// \brief Returns the device attribute of this LineSet. core::Device GetDevice() const override { return device_; } @@ -385,6 +391,22 @@ class LineSet : public Geometry, public DrawableGeometry { double scale = 1.0, bool capping = true) const; + /// Factory function to create a LineSet from intrinsic and extrinsic + /// matrices. + /// + /// \param view_width_px The width of the view, in pixels. + /// \param view_height_px The height of the view, in pixels. + /// \param intrinsic The intrinsic matrix {3,3} shape. + /// \param extrinsic The extrinsic matrix {4,4} shape. + /// \param scale camera scale + /// \param color tensor with float32 dtype and shape {3}. Default is blue. + static LineSet CreateCameraVisualization(int view_width_px, + int view_height_px, + const core::Tensor &intrinsic, + const core::Tensor &extrinsic, + double scale, + const core::Tensor &color = {}); + protected: core::Device device_ = core::Device("CPU:0"); TensorMap point_attr_; diff --git a/cpp/open3d/t/geometry/RaycastingScene.cpp b/cpp/open3d/t/geometry/RaycastingScene.cpp index 14f9962c26c..8906f6373e5 100644 --- a/cpp/open3d/t/geometry/RaycastingScene.cpp +++ b/cpp/open3d/t/geometry/RaycastingScene.cpp @@ -1173,4 +1173,44 @@ uint32_t RaycastingScene::INVALID_ID() { return RTC_INVALID_GEOMETRY_ID; } } // namespace geometry } // namespace t -} // namespace open3d \ No newline at end of file +} // namespace open3d + +namespace fmt { +template <> +struct formatter { + template + auto format(const RTCError& c, FormatContext& ctx) { + const char* name = nullptr; + switch (c) { + case RTC_ERROR_NONE: + name = "RTC_ERROR_NONE"; + break; + case RTC_ERROR_UNKNOWN: + name = "RTC_ERROR_UNKNOWN"; + break; + case RTC_ERROR_INVALID_ARGUMENT: + name = "RTC_ERROR_INVALID_ARGUMENT"; + break; + case RTC_ERROR_INVALID_OPERATION: + name = "RTC_ERROR_INVALID_OPERATION"; + break; + case RTC_ERROR_OUT_OF_MEMORY: + name = "RTC_ERROR_OUT_OF_MEMORY"; + break; + case RTC_ERROR_UNSUPPORTED_CPU: + name = "RTC_ERROR_UNSUPPORTED_CPU"; + break; + case RTC_ERROR_CANCELLED: + name = "RTC_ERROR_CANCELLED"; + break; + } + // return formatter::format(name, ctx); + 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/t/io/sensor/realsense/RSBagReader.cpp b/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp index 356fdbed6bc..1bb6dd76081 100644 --- a/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp +++ b/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp @@ -7,6 +7,9 @@ #include "open3d/t/io/sensor/realsense/RSBagReader.h" +#if FMT_VERSION >= 100000 +#include +#endif #include #include diff --git a/cpp/open3d/utility/Logging.h b/cpp/open3d/utility/Logging.h index 15fe28fa539..fdb132f9b06 100644 --- a/cpp/open3d/utility/Logging.h +++ b/cpp/open3d/utility/Logging.h @@ -21,6 +21,9 @@ #include #include #include +#if FMT_VERSION >= 100000 +#include +#endif #define DEFAULT_IO_BUFFER_SIZE 1024 diff --git a/cpp/open3d/utility/ParallelScan.h b/cpp/open3d/utility/ParallelScan.h index a98015053f8..0479d611eb5 100644 --- a/cpp/open3d/utility/ParallelScan.h +++ b/cpp/open3d/utility/ParallelScan.h @@ -13,6 +13,14 @@ // clang-format off #if TBB_INTERFACE_VERSION >= 10000 #ifdef OPEN3D_USE_ONEAPI_PACKAGES + #ifdef _PSTL_UDR_PRESENT + #undef _PSTL_UDR_PRESENT + #endif + #define _PSTL_UDR_PRESENT 0 + #ifdef _PSTL_UDS_PRESENT + #undef _PSTL_UDS_PRESENT + #endif + #define _PSTL_UDS_PRESENT 0 #include #include #else diff --git a/cpp/open3d/visualization/rendering/RendererHandle.h b/cpp/open3d/visualization/rendering/RendererHandle.h index 45b59a70c60..dc8b06382e7 100644 --- a/cpp/open3d/visualization/rendering/RendererHandle.h +++ b/cpp/open3d/visualization/rendering/RendererHandle.h @@ -98,7 +98,7 @@ struct REHandle : public REHandle_abstract { id = REHandle_abstract::kBadId + 1; } - return std::move(REHandle(id)); + return REHandle(id); } static REHandle Concretize(const REHandle_abstract& abstract) { diff --git a/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp b/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp index 0c831e9d2d0..1dcf1715368 100644 --- a/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp +++ b/cpp/open3d/visualization/rendering/filament/FilamentResourceManager.cpp @@ -77,8 +77,8 @@ using ResourcesContainer = template std::shared_ptr MakeShared(ResourceType* pointer, filament::Engine& engine) { - return std::move(std::shared_ptr( - pointer, [&engine](ResourceType* p) { engine.destroy(p); })); + return std::shared_ptr( + pointer, [&engine](ResourceType* p) { engine.destroy(p); }); } template diff --git a/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h b/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h index ceb0fc9df74..8ef27e79a54 100644 --- a/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h +++ b/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h @@ -456,3 +456,45 @@ class PeerConnectionManager { } // namespace webrtc_server } // namespace visualization } // namespace open3d + +namespace fmt { + +template <> +struct formatter { + template + auto format(const webrtc::PeerConnectionInterface::SignalingState& state, + FormatContext& ctx) const -> decltype(ctx.out()) { + using namespace webrtc; + const char* text = nullptr; + switch (state) { + case PeerConnectionInterface::SignalingState::kStable: + text = "kStable"; + break; + case PeerConnectionInterface::SignalingState::kHaveLocalOffer: + text = "kHaveLocalOffer"; + break; + case PeerConnectionInterface::SignalingState::kHaveLocalPrAnswer: + text = "kHaveLocalPrAnswer"; + break; + case PeerConnectionInterface::SignalingState::kHaveRemoteOffer: + text = "kHaveRemoteOffer"; + break; + case PeerConnectionInterface::SignalingState::kHaveRemotePrAnswer: + text = "kHaveRemotePrAnswer"; + break; + case PeerConnectionInterface::SignalingState::kClosed: + text = "kClosed"; + break; + default: + text = "unknown"; + } + return format_to(ctx.out(), "{}", text); + } + + template + constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) { + return ctx.begin(); + } +}; + +} // namespace fmt diff --git a/cpp/pybind/t/geometry/lineset.cpp b/cpp/pybind/t/geometry/lineset.cpp index d9bf8adbe43..299deef36b0 100644 --- a/cpp/pybind/t/geometry/lineset.cpp +++ b/cpp/pybind/t/geometry/lineset.cpp @@ -299,6 +299,37 @@ transformation as :math:`P = R(P) + t`)"); mesh = lines.extrude_linear([0,1,0]) o3d.visualization.draw([{'name': 'L', 'geometry': mesh}]) +)"); + line_set.def("paint_uniform_color", &LineSet::PaintUniformColor, "color"_a, + "Assigns unifom color to all the lines of the LineSet. " + "Floating color values are clipped between 00 and 1.0. Input " + "`color` should be a (3,) shape tensor."); + line_set.def_static( + "create_camera_visualization", &LineSet::CreateCameraVisualization, + "view_width_px"_a, "view_height_px"_a, "intrinsic"_a, "extrinsic"_a, + "scale"_a = 1.f, "color"_a = core::Tensor({}, core::Float32), + R"(Factory function to create a LineSet from intrinsic and extrinsic +matrices. Camera reference frame is shown with XYZ axes in RGB. + +Args: + view_width_px (int): The width of the view, in pixels. + view_height_px (int): The height of the view, in pixels. + intrinsic (open3d.core.Tensor): The intrinsic matrix {3,3} shape. + extrinsic (open3d.core.Tensor): The extrinsic matrix {4,4} shape. + scale (float): camera scale + color (open3d.core.Tensor): color with float32 and shape {3}. Default is blue. + +Example: + + Draw a purple camera frame with XYZ axes in RGB. + + import open3d.core as o3c + from open3d.t.geometry import LineSet + from open3d.visualization import draw + K = o3c.Tensor([[512, 0, 512], [0, 512, 512], [0, 0, 1]], dtype=o3c.float32) + T = o3c.Tensor.eye(4, dtype=o3c.float32) + ls = LineSet.create_camera_visualization(1024, 1024, K, T, 1, [0.8, 0.2, 0.8]) + draw([ls]) )"); } diff --git a/examples/cpp/OnlineSLAMUtil.h b/examples/cpp/OnlineSLAMUtil.h index 585f18a8fbe..358256de3df 100644 --- a/examples/cpp/OnlineSLAMUtil.h +++ b/examples/cpp/OnlineSLAMUtil.h @@ -5,6 +5,10 @@ // SPDX-License-Identifier: MIT // ---------------------------------------------------------------------------- +#if FMT_VERSION >= 100000 +#include +#endif + #include #include #include