From 31955a895f87a2c8025d9df7ae5adbaec59863c0 Mon Sep 17 00:00:00 2001 From: Shlok Date: Wed, 4 Mar 2026 09:59:53 +0100 Subject: [PATCH 1/2] add param normal_length_as_confidence --- cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp | 7 ++++++- cpp/open3d/geometry/TriangleMesh.h | 3 +++ cpp/pybind/geometry/trianglemesh.cpp | 7 ++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp b/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp index 7195166701f..1bcc873c912 100644 --- a/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp +++ b/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp @@ -400,6 +400,7 @@ void Execute(const open3d::geometry::PointCloud& pcd, float width, float scale, bool linear_fit, + bool use_normal_length_as_confidence, UIntPack) { static const int Dim = sizeof...(FEMSigs); typedef UIntPack Sigs; @@ -421,6 +422,9 @@ void Execute(const open3d::geometry::PointCloud& pcd, int base_depth = 0; int base_v_cycles = 1; float confidence = 0.f; + if (use_normal_length_as_confidence) { + confidence = 1.f; + } float point_weight = 2.f * DEFAULT_FEM_DEGREE; float confidence_bias = 0.f; float samples_per_node = 1.5f; @@ -721,6 +725,7 @@ TriangleMesh::CreateFromPointCloudPoisson(const PointCloud& pcd, float width, float scale, bool linear_fit, + bool use_normal_length_as_confidence, int n_threads) { static const BoundaryType BType = DEFAULT_FEM_BOUNDARY; typedef IsotropicUIntPack< @@ -746,7 +751,7 @@ TriangleMesh::CreateFromPointCloudPoisson(const PointCloud& pcd, auto mesh = std::make_shared(); std::vector densities; Execute(pcd, mesh, densities, static_cast(depth), width, scale, - linear_fit, FEMSigs()); + linear_fit, use_normal_length_as_confidence, FEMSigs()); ThreadPool::Terminate(); diff --git a/cpp/open3d/geometry/TriangleMesh.h b/cpp/open3d/geometry/TriangleMesh.h index 7f0b05c6ca5..d1d1c9a879a 100644 --- a/cpp/open3d/geometry/TriangleMesh.h +++ b/cpp/open3d/geometry/TriangleMesh.h @@ -545,6 +545,8 @@ class TriangleMesh : public MeshBase { /// for reconstruction and the diameter of the samples' bounding cube. /// \param linear_fit If true, the reconstructor use linear interpolation to /// estimate the positions of iso-vertices. + /// \param use_normal_length_as_confidence If true, use the length (norm) + /// of normal vectors as point confidence. /// \param n_threads Number of threads used for reconstruction. Set to -1 to /// automatically determine it. /// \return The estimated TriangleMesh, and per vertex density values that @@ -555,6 +557,7 @@ class TriangleMesh : public MeshBase { float width = 0.0f, float scale = 1.1f, bool linear_fit = false, + bool use_normal_length_as_confidence = false, int n_threads = -1); /// Factory function to create a tetrahedron mesh (trianglemeshfactory.cpp). diff --git a/cpp/pybind/geometry/trianglemesh.cpp b/cpp/pybind/geometry/trianglemesh.cpp index 818630e9542..45cdafbf297 100644 --- a/cpp/pybind/geometry/trianglemesh.cpp +++ b/cpp/pybind/geometry/trianglemesh.cpp @@ -350,7 +350,9 @@ void pybind_trianglemesh_definitions(py::module &m) { "This function uses the original implementation by " "Kazhdan. See https://github.com/mkazhdan/PoissonRecon", "pcd"_a, "depth"_a = 8, "width"_a = 0, "scale"_a = 1.1, - "linear_fit"_a = false, "n_threads"_a = -1) + "linear_fit"_a = false, + "use_normal_length_as_confidence"_a = false, + "n_threads"_a = -1) .def_static( "create_from_oriented_bounding_box", &TriangleMesh::CreateFromOrientedBoundingBox, @@ -692,6 +694,9 @@ void pybind_trianglemesh_definitions(py::module &m) { {"linear_fit", "If true, the reconstructor will use linear interpolation to " "estimate the positions of iso-vertices."}, + {"use_normal_length_as_confidence", + "If true, use the length (norm) of normal vectors as " + "point confidence"}, {"n_threads", "Number of threads used for reconstruction. Set to -1 to " "automatically determine it."}}); From efe818439c1b0c06bbfb873af9f4b659fc94a99f Mon Sep 17 00:00:00 2001 From: Shlok Date: Mon, 9 Mar 2026 10:13:55 +0100 Subject: [PATCH 2/2] append normal_length_as_confidence parameter --- CHANGELOG.md | 1 + .../geometry/SurfaceReconstructionPoisson.cpp | 15 ++++++++------- cpp/open3d/geometry/TriangleMesh.h | 4 ++-- cpp/pybind/geometry/trianglemesh.cpp | 13 ++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb5ed5d725..cd7c5819c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ - macOS x86_64 not longer supported, only macOS arm64 is supported. - Python 3.13+3.14 support - Fix Windows build failure for PyTorch ops due to PyTorch's bundled fmt (v11+) requiring `/utf-8` with MSVC (PR #7447) +- Add `use_normal_length_as_confidence` boolean parameter to Poisson surface reconstruction ## 0.13 diff --git a/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp b/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp index 1bcc873c912..ba2f5ffa772 100644 --- a/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp +++ b/cpp/open3d/geometry/SurfaceReconstructionPoisson.cpp @@ -720,13 +720,14 @@ void Execute(const open3d::geometry::PointCloud& pcd, } // namespace std::tuple, std::vector> -TriangleMesh::CreateFromPointCloudPoisson(const PointCloud& pcd, - size_t depth, - float width, - float scale, - bool linear_fit, - bool use_normal_length_as_confidence, - int n_threads) { +TriangleMesh::CreateFromPointCloudPoisson( + const PointCloud& pcd, + size_t depth, + float width, + float scale, + bool linear_fit, + int n_threads, + bool use_normal_length_as_confidence) { static const BoundaryType BType = DEFAULT_FEM_BOUNDARY; typedef IsotropicUIntPack< DIMENSION, FEMDegreeAndBType::Signature> diff --git a/cpp/open3d/geometry/TriangleMesh.h b/cpp/open3d/geometry/TriangleMesh.h index d1d1c9a879a..a5e84eb50a2 100644 --- a/cpp/open3d/geometry/TriangleMesh.h +++ b/cpp/open3d/geometry/TriangleMesh.h @@ -557,8 +557,8 @@ class TriangleMesh : public MeshBase { float width = 0.0f, float scale = 1.1f, bool linear_fit = false, - bool use_normal_length_as_confidence = false, - int n_threads = -1); + int n_threads = -1, + bool use_normal_length_as_confidence = false); /// Factory function to create a tetrahedron mesh (trianglemeshfactory.cpp). /// the mesh centroid will be at (0,0,0) and \p radius defines the diff --git a/cpp/pybind/geometry/trianglemesh.cpp b/cpp/pybind/geometry/trianglemesh.cpp index 45cdafbf297..81a7fbd6f35 100644 --- a/cpp/pybind/geometry/trianglemesh.cpp +++ b/cpp/pybind/geometry/trianglemesh.cpp @@ -350,9 +350,8 @@ void pybind_trianglemesh_definitions(py::module &m) { "This function uses the original implementation by " "Kazhdan. See https://github.com/mkazhdan/PoissonRecon", "pcd"_a, "depth"_a = 8, "width"_a = 0, "scale"_a = 1.1, - "linear_fit"_a = false, - "use_normal_length_as_confidence"_a = false, - "n_threads"_a = -1) + "linear_fit"_a = false, "n_threads"_a = -1, + "use_normal_length_as_confidence"_a = false) .def_static( "create_from_oriented_bounding_box", &TriangleMesh::CreateFromOrientedBoundingBox, @@ -694,12 +693,12 @@ void pybind_trianglemesh_definitions(py::module &m) { {"linear_fit", "If true, the reconstructor will use linear interpolation to " "estimate the positions of iso-vertices."}, - {"use_normal_length_as_confidence", - "If true, use the length (norm) of normal vectors as " - "point confidence"}, {"n_threads", "Number of threads used for reconstruction. Set to -1 to " - "automatically determine it."}}); + "automatically determine it."}, + {"use_normal_length_as_confidence", + "If true, use the length (norm) of normal vectors as a per-point " + "confidence."}}); docstring::ClassMethodDocInject( m, "TriangleMesh", "create_from_oriented_bounding_box", {{"obox", "OrientedBoundingBox object to create mesh of."},