27 #include "../common/MatrixUtils.h"
44 static std::string name(
"SecondDegreePolynomial" );
55 const double& pt1Y,
double& pt2X,
double& pt2Y )
const
57 assert( isValid( params ) );
77 const double& pt2Y,
double& pt1X,
double& pt1Y )
const
79 assert( isValid( params ) );
120 m_computeParameters_tiepointsSize = params.
m_tiePoints.size();
121 if( m_computeParameters_tiepointsSize < getMinRequiredTiePoints() )
return false;
123 m_computeParameters_W.resize( m_computeParameters_tiepointsSize, 6 );
124 m_computeParameters_WI.resize( m_computeParameters_tiepointsSize, 6 );
125 m_computeParameters_X.resize( m_computeParameters_tiepointsSize, 1 );
126 m_computeParameters_XI.resize( m_computeParameters_tiepointsSize, 1 );
127 m_computeParameters_Y.resize( m_computeParameters_tiepointsSize, 1 );
128 m_computeParameters_YI.resize( m_computeParameters_tiepointsSize, 1 );
130 for ( m_computeParameters_tpIdx = 0 ; m_computeParameters_tpIdx < m_computeParameters_tiepointsSize ; ++m_computeParameters_tpIdx )
134 m_computeParameters_W( m_computeParameters_tpIdx, 0 ) = 1;
135 m_computeParameters_W( m_computeParameters_tpIdx, 1 ) = pt1.
x;
136 m_computeParameters_W( m_computeParameters_tpIdx, 2 ) = pt1.
y;
137 m_computeParameters_W( m_computeParameters_tpIdx, 3 ) = pt1.
x * pt1.
y;
138 m_computeParameters_W( m_computeParameters_tpIdx, 4 ) = pt1.
x * pt1.
x;
139 m_computeParameters_W( m_computeParameters_tpIdx, 5 ) = pt1.
y * pt1.
y;
143 m_computeParameters_WI( m_computeParameters_tpIdx, 0 ) = 1;
144 m_computeParameters_WI( m_computeParameters_tpIdx, 1 ) = pt2.
x;
145 m_computeParameters_WI( m_computeParameters_tpIdx, 2 ) = pt2.
y;
146 m_computeParameters_WI( m_computeParameters_tpIdx, 3 ) = pt2.
x * pt2.
y;
147 m_computeParameters_WI( m_computeParameters_tpIdx, 4 ) = pt2.
x * pt2.
x;
148 m_computeParameters_WI( m_computeParameters_tpIdx, 5 ) = pt2.
y * pt2.
y;
150 m_computeParameters_X( m_computeParameters_tpIdx, 0 ) = pt2.
x;
152 m_computeParameters_XI( m_computeParameters_tpIdx, 0 ) = pt1.
x;
154 m_computeParameters_Y( m_computeParameters_tpIdx, 0 ) = pt2.
y;
156 m_computeParameters_YI( m_computeParameters_tpIdx, 0 ) = pt1.
y;
165 m_computeParameters_A = boost::numeric::ublas::prod( m_computeParameters_PinvW, m_computeParameters_X );
167 m_computeParameters_AI = boost::numeric::ublas::prod( m_computeParameters_PinvWI, m_computeParameters_XI );
169 m_computeParameters_B = boost::numeric::ublas::prod( m_computeParameters_PinvW, m_computeParameters_Y );
171 m_computeParameters_BI = boost::numeric::ublas::prod( m_computeParameters_PinvWI, m_computeParameters_YI );
Second Degree Polynomial Geometric transformation.
std::vector< TiePoint > m_tiePoints
Tie points.
const std::string & getName() const
Returns the current transformation name.
Second Degree Polynomial Geometric transformation.
std::vector< double > m_directParameters
Transformation numeric direct parameters.
SecondDegreePolynomialGT()
Default constructor.
An utility struct for representing 2D coordinates.
bool GetPseudoInverseMatrix(const boost::numeric::ublas::matrix< T > &inputMatrix, boost::numeric::ublas::matrix< T > &outputMatrix)
Pseudo matrix inversion.
~SecondDegreePolynomialGT()
Destructor.
bool computeParameters(GTParameters ¶ms) const
Calculate the transformation parameters following the new supplied tie-points.
void inverseMap(const GTParameters ¶ms, const double &pt2X, const double &pt2Y, double &pt1X, double &pt1Y) const
Inverse mapping (from pt2 space into pt1 space).
std::vector< double > m_inverseParameters
Transformation numeric inverse parameters.
2D Geometric transformation parameters.
unsigned int getMinRequiredTiePoints() const
Returns the minimum number of required tie-points for the current transformation. ...
GeometricTransformation * clone() const
Creat a clone copy of this instance.
void directMap(const GTParameters ¶ms, const double &pt1X, const double &pt1Y, double &pt2X, double &pt2Y) const
Direct mapping (from pt1 space into pt2 space).