ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TriangleMesh.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <benchmark/benchmark.h>
9 #include <ecvMesh.h>
10 #include <ecvPointCloud.h>
11 
14 
15 namespace cloudViewer {
16 namespace pipelines {
17 namespace registration {
18 
19 // This pcd does not contains non-finite points.
20 // TODO: Change this to pcd with non-finite points.
22  benchmark::State& state, const bool remove_non_finite_points) {
23  data::PCDPointCloud sample_pcd;
24  auto pcd = io::CreatePointCloudFromFile(sample_pcd.GetPath());
25 
26  if (remove_non_finite_points) {
27  pcd->RemoveNonFinitePoints();
28  }
29 
30  std::vector<double> distance = pcd->ComputeNearestNeighborDistance();
31  size_t n = distance.size();
32  double dist_average = 0.0;
33  if (n != 0) {
34  dist_average =
35  std::accumulate(distance.begin(), distance.end(), 0.0) / n;
36  }
37  double radius = 1.5 * dist_average;
38  std::vector<double> radii = {radius, radius * 1};
39  std::shared_ptr<ccMesh> mesh;
40 
42 
43  for (auto _ : state) {
45  }
46 }
47 
49  Without Non Finite Points,
50  /*remove_non_finite_points*/ true)
51  ->Unit(benchmark::kMillisecond);
52 
53 // TODO: Add BENCHMARK for case `With Non Finite Points`.
54 
55 } // namespace registration
56 } // namespace pipelines
57 } // namespace cloudViewer
static std::shared_ptr< ccMesh > CreateFromPointCloudBallPivoting(const ccPointCloud &pcd, const std::vector< double > &radii)
Data class for PCDPointCloud contains the fragment.pcd point cloud mesh from the Redwood Living Room ...
Definition: Dataset.h:688
std::string GetPath() const
Path to the pcd format point cloud.
Definition: Dataset.h:693
std::shared_ptr< ccPointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
BENCHMARK_CAPTURE(BenchmarkCreateFromPointCloudBallPivoting, Without Non Finite Points, true) -> Unit(benchmark::kMillisecond)
static void BenchmarkCreateFromPointCloudBallPivoting(benchmark::State &state, const bool remove_non_finite_points)
Generic file read and write utility for python interface.
std::vector< Eigen::Vector3f > Points
std::vector< PointCoordinateType > radii
Definition: qM3C2Tools.cpp:42