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
colmap::InlierSupportMeasurer::Compare
bool Compare(const Support &support1, const Support &support2)
Definition: support_measurement.cc:52
colmap::MEstimatorSupportMeasurer::Support::num_inliers
size_t num_inliers
Definition: support_measurement.h:41
colmap::InlierSupportMeasurer::Support::num_inliers
size_t num_inliers
Definition: support_measurement.h:22
colmap::MEstimatorSupportMeasurer::Support
Definition: support_measurement.h:39
colmap::MEstimatorSupportMeasurer::Support::score
double score
Definition: support_measurement.h:44
colmap::InlierSupportMeasurer::Evaluate
Support Evaluate(const std::vector< double > &residuals, const double max_residual)
Definition: support_measurement.cc:36
colmap::MEstimatorSupportMeasurer::Evaluate
Support Evaluate(const std::vector< double > &residuals, const double max_residual)
Definition: support_measurement.cc:62
support_measurement.h
colmap::InlierSupportMeasurer::Support::residual_sum
double residual_sum
Definition: support_measurement.h:25
colmap::InlierSupportMeasurer
Definition: support_measurement.h:19
colmap
Definition: AutomaticReconstructionController.h:17
colmap::InlierSupportMeasurer::Support
Definition: support_measurement.h:20
colmap::MEstimatorSupportMeasurer
Definition: support_measurement.h:38
colmap::MEstimatorSupportMeasurer::Compare
bool Compare(const Support &support1, const Support &support2)
Definition: support_measurement.cc:80