ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
affine_transform.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 <Eigen/Core>
11 #include <vector>
12 
13 #include "util/alignment.h"
14 #include "util/types.h"
15 
16 namespace colmap {
17 
19 public:
20  typedef Eigen::Vector2d X_t;
21  typedef Eigen::Vector2d Y_t;
22  typedef Eigen::Matrix<double, 2, 3> M_t;
23 
24  // The minimum number of samples needed to estimate a model.
25  static const int kMinNumSamples = 3;
26 
27  // Estimate the affine transformation from at least 3 correspondences.
28  static std::vector<M_t> Estimate(const std::vector<X_t>& points1,
29  const std::vector<Y_t>& points2);
30 
31  // Compute the squared transformation error.
32  static void Residuals(const std::vector<X_t>& points1,
33  const std::vector<Y_t>& points2,
34  const M_t& E,
35  std::vector<double>* residuals);
36 };
37 
38 } // namespace colmap
static std::vector< M_t > Estimate(const std::vector< X_t > &points1, const std::vector< Y_t > &points2)
Eigen::Matrix< double, 2, 3 > M_t
static void Residuals(const std::vector< X_t > &points1, const std::vector< Y_t > &points2, const M_t &E, std::vector< double > *residuals)