OTB  9.1.1
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 
54  itkTypeMacro(LeastSquareBilinearTransformEstimator, Object);
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 
92  TiePointsContainerType& GetTiePointsContainer();
93 
95  void SetTiePointsContainer(const TiePointsContainerType& container);
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
otb::LeastSquareBilinearTransformEstimator::PrecisionType
PointType::CoordRepType PrecisionType
Definition: otbLeastSquareBilinearTransformEstimator.h:61
otb::LeastSquareBilinearTransformEstimator::MatrixVecTransposeType
itk::Matrix< PrecisionType, 1, 4 > MatrixVecTransposeType
Definition: otbLeastSquareBilinearTransformEstimator.h:69
otb::LeastSquareBilinearTransformEstimator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLeastSquareBilinearTransformEstimator.h:48
otb::LeastSquareBilinearTransformEstimator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLeastSquareBilinearTransformEstimator.h:47
otb::LeastSquareBilinearTransformEstimator::CovariantVectorType
itk::CovariantVector< PrecisionType, PointDimension > CovariantVectorType
Definition: otbLeastSquareBilinearTransformEstimator.h:62
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbLeastSquareBilinearTransformEstimator.hxx
otb::LeastSquareBilinearTransformEstimator::MatrixType
itk::Matrix< PrecisionType, 4, 4 > MatrixType
Definition: otbLeastSquareBilinearTransformEstimator.h:67
otb::LeastSquareBilinearTransformEstimator::MatrixVecType
itk::Matrix< PrecisionType, 4, 1 > MatrixVecType
Definition: otbLeastSquareBilinearTransformEstimator.h:68
otb::LeastSquareBilinearTransformEstimator
This class provide the 2D Bilinear transform LSQR estimation.
Definition: otbLeastSquareBilinearTransformEstimator.h:41
otb::LeastSquareBilinearTransformEstimator::TiePointsContainerType
std::vector< TiePointsType > TiePointsContainerType
Definition: otbLeastSquareBilinearTransformEstimator.h:64
otb::LeastSquareBilinearTransformEstimator::m_Offset
VectorType m_Offset
Definition: otbLeastSquareBilinearTransformEstimator.h:136
otb::LeastSquareBilinearTransformEstimator::Self
LeastSquareBilinearTransformEstimator Self
Definition: otbLeastSquareBilinearTransformEstimator.h:45
otb::LeastSquareBilinearTransformEstimator::m_RelativeResidual
CovariantVectorType m_RelativeResidual
Definition: otbLeastSquareBilinearTransformEstimator.h:130
otb::LeastSquareBilinearTransformEstimator::Superclass
itk::Object Superclass
Definition: otbLeastSquareBilinearTransformEstimator.h:46
otb::LeastSquareBilinearTransformEstimator::TiePointsType
std::pair< PointType, PrecisionType > TiePointsType
Definition: otbLeastSquareBilinearTransformEstimator.h:63
otb::LeastSquareBilinearTransformEstimator::PointType
TPoint PointType
Definition: otbLeastSquareBilinearTransformEstimator.h:60
otb::LeastSquareBilinearTransformEstimator::m_RMSError
CovariantVectorType m_RMSError
Definition: otbLeastSquareBilinearTransformEstimator.h:127
otb::LeastSquareBilinearTransformEstimator::m_Matrix
MatrixType m_Matrix
Definition: otbLeastSquareBilinearTransformEstimator.h:133
otb::LeastSquareBilinearTransformEstimator::Atb
vnl_matrix_fixed< double, 4, 1 > Atb
Definition: otbLeastSquareBilinearTransformEstimator.h:146
otb::LeastSquareBilinearTransformEstimator::Ata
vnl_matrix_fixed< double, 4, 4 > Ata
Definition: otbLeastSquareBilinearTransformEstimator.h:144
otb::LeastSquareBilinearTransformEstimator::VectorType
itk::Vector< PrecisionType, 4 > VectorType
Definition: otbLeastSquareBilinearTransformEstimator.h:70
otb::LeastSquareBilinearTransformEstimator::m_TiePointsContainer
TiePointsContainerType m_TiePointsContainer
Definition: otbLeastSquareBilinearTransformEstimator.h:124
otb::LeastSquareBilinearTransformEstimator::bl_d
double bl_d
Definition: otbLeastSquareBilinearTransformEstimator.h:141