// This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. // Copyright (C) 2026, BigVision LLC, all rights reserved. // Third party copyrights are property of their respective owners. #include "perf_precomp.hpp" #include "opencv2/geometry/segment.hpp" // cv::normalEstimate namespace opencv_test { namespace { using namespace perf; // Evenly sampled unit sphere (Fibonacci) of the requested size. static Mat makeSphere(int n) { std::vector pts; pts.reserve(n); const float ga = (float)(CV_PI * (3.0 - std::sqrt(5.0))); for (int i = 0; i < n; i++) { float z = 1.f - 2.f * (i + 0.5f) / n; float r = std::sqrt(std::max(0.f, 1.f - z * z)); float t = ga * i; pts.emplace_back(r * std::cos(t), r * std::sin(t), z); } return Mat(pts).clone(); } typedef TestBaseWithParam Ptcloud_NormalPerf; PERF_TEST_P(Ptcloud_NormalPerf, orient_consistent, testing::Values(50000, 150000)) { Mat cloud = makeSphere(GetParam()); Mat normals, curv; normalEstimate(normals, curv, cloud, noArray(), 30); // normals to orient (geometry) TEST_CYCLE() orientNormalsConsistent(cloud, normals, 30); SANITY_CHECK_NOTHING(); } }} // namespace