ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
support_measurement.h
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 #pragma once
9 
10 #include <cstddef>
11 #include <limits>
12 #include <vector>
13 
14 namespace colmap {
15 
16 // Measure the support of a model by counting the number of inliers and
17 // summing all inlier residuals. The support is better if it has more inliers
18 // and a smaller residual sum.
20  struct Support {
21  // The number of inliers.
22  size_t num_inliers = 0;
23 
24  // The sum of all inlier residuals.
25  double residual_sum = std::numeric_limits<double>::max();
26  };
27 
28  // Compute the support of the residuals.
29  Support Evaluate(const std::vector<double>& residuals,
30  const double max_residual);
31 
32  // Compare the two supports and return the better support.
33  bool Compare(const Support& support1, const Support& support2);
34 };
35 
36 // Measure the support of a model by its fitness to the data as used in MSAC.
37 // A support is better if it has a smaller MSAC score.
39  struct Support {
40  // The number of inliers.
41  size_t num_inliers = 0;
42 
43  // The MSAC score, defined as the truncated sum of residuals.
44  double score = std::numeric_limits<double>::max();
45  };
46 
47  // Compute the support of the residuals.
48  Support Evaluate(const std::vector<double>& residuals,
49  const double max_residual);
50 
51  // Compare the two supports and return the better support.
52  bool Compare(const Support& support1, const Support& support2);
53 };
54 
55 } // namespace colmap
Support Evaluate(const std::vector< double > &residuals, const double max_residual)
bool Compare(const Support &support1, const Support &support2)
bool Compare(const Support &support1, const Support &support2)
Support Evaluate(const std::vector< double > &residuals, const double max_residual)