OTB  10.0.0
Orfeo Toolbox
otbLeastSquareBilinearTransformEstimator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbLeastSquareBilinearTransformEstimator_h
22 #define otbLeastSquareBilinearTransformEstimator_h
23 
24 #include "itkObject.h"
25 #include "itkObjectFactory.h"
26 #include "itkMatrix.h"
27 #include "itkVector.h"
28 #include "itkAffineTransform.h"
29 
30 namespace otb
31 {
32 
40 template <class TPoint>
41 class ITK_EXPORT LeastSquareBilinearTransformEstimator : public itk::Object
42 {
43 public:
46  typedef itk::Object Superclass;
47  typedef itk::SmartPointer<Self> Pointer;
48  typedef itk::SmartPointer<const Self> ConstPointer;
49 
51  itkNewMacro(Self);
52 
55 
57  itkStaticConstMacro(PointDimension, unsigned int, TPoint::PointDimension);
58 
60  typedef TPoint PointType;
61  typedef typename PointType::CoordRepType PrecisionType;
62  typedef itk::CovariantVector<PrecisionType, PointDimension> CovariantVectorType;
63  typedef std::pair<PointType, PrecisionType> TiePointsType;
64  typedef std::vector<TiePointsType> TiePointsContainerType;
65 
67  typedef itk::Matrix<PrecisionType, 4, 4> MatrixType;
68  typedef itk::Matrix<PrecisionType, 4, 1> MatrixVecType;
69  typedef itk::Matrix<PrecisionType, 1, 4> MatrixVecTransposeType;
70  typedef itk::Vector<PrecisionType, 4> VectorType;
71 
74 
77 
79  itkGetConstReferenceMacro(Matrix, MatrixType);
80 
82  itkGetConstReferenceMacro(Offset, VectorType);
83 
85  itkGetConstReferenceMacro(RMSError, CovariantVectorType);
86 
88  itkGetConstReferenceMacro(RelativeResidual, CovariantVectorType);
89 
93 
96 
98  void AddTiePoints(const PointType& src, const PrecisionType& dst);
99 
101  void ClearTiePoints();
102 
104  void Compute();
105 
113  void lsFitValue(const PointType& point, PrecisionType& dst) const;
114 
115 protected:
117  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
118 
119 private:
121  void operator=(const Self&) = delete;
122 
125 
128 
131 
134 
137 
138 
139  // BILINEAR
140  // Respectibely: constant, linear-X, linear-Y, cross-XY term
141  double bl_a, bl_b, bl_c, bl_d;
142 
143  // Normal system coefficient matrix.
144  vnl_matrix_fixed<double, 4, 4> Ata;
145  // Normal system RHS vector
146  vnl_matrix_fixed<double, 4, 1> Atb;
147 
148 
149 }; // end of class
150 
151 } // end of namespace otb
152 
153 #ifndef OTB_MANUAL_INSTANTIATION
155 #endif
156 
157 #endif
This class provide the 2D Bilinear transform LSQR estimation.
LeastSquareBilinearTransformEstimator(const Self &)=delete
void SetTiePointsContainer(const TiePointsContainerType &container)
TiePointsContainerType & GetTiePointsContainer()
itk::CovariantVector< PrecisionType, PointDimension > CovariantVectorType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.