27 #include "../common/MatrixUtils.h"
44 static std::string name(
"ThirdDegreePolynomial" );
55 const double& pt1Y,
double& pt2X,
double& pt2Y )
const
57 assert( isValid( params ) );
85 const double& pt2Y,
double& pt1X,
double& pt1Y )
const
87 assert( isValid( params ) );
131 m_computeParameters_tiepointsSize = params.
m_tiePoints.size();
132 if( m_computeParameters_tiepointsSize < getMinRequiredTiePoints() )
return false;
134 m_computeParameters_W.resize( m_computeParameters_tiepointsSize, 10 );
135 m_computeParameters_WI.resize( m_computeParameters_tiepointsSize, 10 );
136 m_computeParameters_X.resize( m_computeParameters_tiepointsSize, 1 );
137 m_computeParameters_XI.resize( m_computeParameters_tiepointsSize, 1 );
138 m_computeParameters_Y.resize( m_computeParameters_tiepointsSize, 1 );
139 m_computeParameters_YI.resize( m_computeParameters_tiepointsSize, 1 );
141 for ( m_computeParameters_tpIdx = 0 ; m_computeParameters_tpIdx < m_computeParameters_tiepointsSize ; ++m_computeParameters_tpIdx )
145 m_computeParameters_W( m_computeParameters_tpIdx, 0 ) = 1;
146 m_computeParameters_W( m_computeParameters_tpIdx, 1 ) = pt1.
x;
147 m_computeParameters_W( m_computeParameters_tpIdx, 2 ) = pt1.
y;
148 m_computeParameters_W( m_computeParameters_tpIdx, 3 ) = pt1.
x * pt1.
x;
149 m_computeParameters_W( m_computeParameters_tpIdx, 4 ) = pt1.
x * pt1.
y;
150 m_computeParameters_W( m_computeParameters_tpIdx, 5 ) = pt1.
y * pt1.
y;
151 m_computeParameters_W( m_computeParameters_tpIdx, 6 ) = pt1.
x * pt1.
x * pt1.
x;
152 m_computeParameters_W( m_computeParameters_tpIdx, 7 ) = pt1.
x * pt1.
x * pt1.
y;
153 m_computeParameters_W( m_computeParameters_tpIdx, 8 ) = pt1.
x * pt1.
y * pt1.
y;
154 m_computeParameters_W( m_computeParameters_tpIdx, 9 ) = pt1.
y * pt1.
y * pt1.
y;
158 m_computeParameters_WI( m_computeParameters_tpIdx, 0 ) = 1;
159 m_computeParameters_WI( m_computeParameters_tpIdx, 1 ) = pt2.
x;
160 m_computeParameters_WI( m_computeParameters_tpIdx, 2 ) = pt2.
y;
161 m_computeParameters_WI( m_computeParameters_tpIdx, 3 ) = pt2.
x * pt2.
x;
162 m_computeParameters_WI( m_computeParameters_tpIdx, 4 ) = pt2.
x * pt2.
y;
163 m_computeParameters_WI( m_computeParameters_tpIdx, 5 ) = pt2.
y * pt2.
y;
164 m_computeParameters_WI( m_computeParameters_tpIdx, 6 ) = pt2.
x * pt2.
x * pt2.
x;
165 m_computeParameters_WI( m_computeParameters_tpIdx, 7 ) = pt2.
x * pt2.
x * pt2.
y;
166 m_computeParameters_WI( m_computeParameters_tpIdx, 8 ) = pt2.
x * pt2.
y * pt2.
y;
167 m_computeParameters_WI( m_computeParameters_tpIdx, 9 ) = pt2.
y * pt2.
y * pt2.
y;
169 m_computeParameters_X( m_computeParameters_tpIdx, 0 ) = pt2.
x;
171 m_computeParameters_XI( m_computeParameters_tpIdx, 0 ) = pt1.
x;
173 m_computeParameters_Y( m_computeParameters_tpIdx, 0 ) = pt2.
y;
175 m_computeParameters_YI( m_computeParameters_tpIdx, 0 ) = pt1.
y;
184 m_computeParameters_A = boost::numeric::ublas::prod( m_computeParameters_PinvW, m_computeParameters_X );
186 m_computeParameters_AI = boost::numeric::ublas::prod( m_computeParameters_PinvWI, m_computeParameters_XI );
188 m_computeParameters_B = boost::numeric::ublas::prod( m_computeParameters_PinvW, m_computeParameters_Y );
190 m_computeParameters_BI = boost::numeric::ublas::prod( m_computeParameters_PinvWI, m_computeParameters_YI );
std::vector< TiePoint > m_tiePoints
Tie points.
Third Degree Polynomial Geometric transformation.
void inverseMap(const GTParameters ¶ms, const double &pt2X, const double &pt2Y, double &pt1X, double &pt1Y) const
Inverse mapping (from pt2 space into pt1 space).
bool computeParameters(GTParameters ¶ms) const
Calculate the transformation parameters following the new supplied tie-points.
std::vector< double > m_directParameters
Transformation numeric direct parameters.
GeometricTransformation * clone() const
Creat a clone copy of this instance.
An utility struct for representing 2D coordinates.
void directMap(const GTParameters ¶ms, const double &pt1X, const double &pt1Y, double &pt2X, double &pt2Y) const
Direct mapping (from pt1 space into pt2 space).
bool GetPseudoInverseMatrix(const boost::numeric::ublas::matrix< T > &inputMatrix, boost::numeric::ublas::matrix< T > &outputMatrix)
Pseudo matrix inversion.
Third Degree Polynomial Geometric transformation.
const std::string & getName() const
Returns the current transformation name.
std::vector< double > m_inverseParameters
Transformation numeric inverse parameters.
~ThirdDegreePolynomialGT()
Destructor.
2D Geometric transformation parameters.
ThirdDegreePolynomialGT()
Default constructor.
unsigned int getMinRequiredTiePoints() const
Returns the minimum number of required tie-points for the current transformation. ...