colmap 顺序匹配

colmap源码解读—Sequential match

  • match.cc
      • 参数分析:
          • 1.`const SequentialMatchingOptions options_`参数,定义顺序匹配选项值
          • 2.`const SiftMatchingOptions match_options_`参数,定义匹配默认参数
          • 3.参数`database_path`数据库存放路径

match.cc

在matching.cc中,类SequentialFeatureMatcher完成顺序匹配。在matching.h中对该类进行定义:

class SequentialFeatureMatcher : public Thread {
 public:
  SequentialFeatureMatcher(const SequentialMatchingOptions& options,
                           const SiftMatchingOptions& match_options,
                           const std::string& database_path);

 private:
  void Run() override;

  std::vector<image_t> GetOrderedImageIds() const;
  void RunSequentialMatching(const std::vector<image_t>& image_ids);
  void RunLoopDetection(const std::vector<image_t>& image_ids);

  const SequentialMatchingOptions options_;
  const SiftMatchingOptions match_options_;
  Database database_;
  FeatureMatcherCache cache_;
  SiftFeatureMatcher matcher_;
};

SequentialFeatureMatcher公有继承Thread类。

参数分析:

1.const SequentialMatchingOptions options_参数,定义顺序匹配选项值
struct SequentialMatchingOptions {
  // Number of overlapping image pairs.重叠图像对的数量。
  int overlap = 10;

  // Whether to match images against their quadratic neighbors.
  bool quadratic_overlap = true;

  // Whether to enable vocabulary tree based loop detection.
  bool loop_detection = false;

  // Loop detection is invoked every ` loop_detection_period` images.
  int loop_detection_period = 10;

  // The number of images to retrieve in loop detection. This number should be significantly bigger than the sequential matching overlap.
  int loop_detection_num_images = 50;

  // Number of nearest neighbors to retrieve per query feature.
  int loop_detection_num_nearest_neighbors = 1;

  // Number of nearest-neighbor checks to use in retrieval.
  int loop_detection_num_checks = 256;

  // How many images to return after spatial verification. Set to 0 to turn off
  // spatial verification.
  int loop_detection_num_images_after_verification = 0;

  // The maximum number of features to use for indexing an image. If an
  // image has more features, only the largest-scale features will be indexed.
  int loop_detection_max_num_features = -1;

  // Path to the vocabulary tree.
  std::string vocab_tree_path = "";

  bool Check() const;
};

GUIFeature matching中参数预设值:
colmap 顺序匹配_第1张图片

2.const SiftMatchingOptions match_options_参数,定义匹配默认参数
struct SiftMatchingOptions {
  // Number of threads for feature matching and geometric verification.特征匹配和几何线程数
  int num_threads = -1;

  // Whether to use the GPU for feature matching.
  bool use_gpu = true;

  // Index of the GPU used for feature matching. For multi-GPU matching,
  // you should separate multiple GPU indices by comma, e.g., "0,1,2,3".GPU匹配索引
  std::string gpu_index = "-1";

  // Maximum distance ratio between first and second best match.最佳匹配的距离比
  double max_ratio = 0.8;

  // Maximum distance to best match.最佳匹配的最大距离
  double max_distance = 0.7;

  // Whether to enable cross checking in matching.匹配中交叉检查
  bool cross_check = true;

  // Maximum number of matches.最大匹配数量
  int max_num_matches = 32768;

  // Maximum epipolar error in pixels for geometric verification.用于几何验证的最大对极误差(以像素为单位)
  double max_error = 4.0;

  // Confidence threshold for geometric verification.几何验证的置信度阈值
  double confidence = 0.999;

  // Minimum/maximum number of RANSAC iterations. Note that this option
  // overrules the min_inlier_ratio option.迭代的最大最小次数
  int min_num_trials = 30;
  int max_num_trials = 10000;

  // A priori assumed minimum inlier ratio, which determines the maximum
  // number of iterations.先验假设的最小线性比率决定了最大迭代次数。
  double min_inlier_ratio = 0.25;

  // Minimum number of inliers for an image pair to be considered as
  // geometrically verified.图像对的最小内联线数量视为经过几何验证
  int min_num_inliers = 15;

  // Whether to attempt to estimate multiple geometric models per image pair.是否估计每个图像多个几何模型
  bool multiple_models = false;

  // Whether to perform guided matching, if geometric verification succeeds.如果几何验证成功,是否执行引导匹配。
  
  bool guided_matching = false;

  bool Check() const;
};

GUI界面显示:
colmap 顺序匹配_第2张图片

3.参数database_path数据库存放路径

你可能感兴趣的:(colmap)