27 #include "../common/MatrixUtils.h" 
   34 #include <boost/numeric/ublas/matrix.hpp> 
   46   static std::string name( 
"SecondDegreePolynomial" );
 
   57                                                   const double& pt1Y, 
double& pt2X, 
double& pt2Y )
 const 
   59   assert( isValid( params ) );
 
   79                                                    const double& pt2Y, 
double& pt1X, 
double& pt1Y )
 const 
   81   assert( isValid( params ) );
 
  122   const unsigned int tiepointsSize = params.
m_tiePoints.size();
 
  123   if( tiepointsSize < getMinRequiredTiePoints() ) 
return false;
 
  125   boost::numeric::ublas::matrix< double > W( tiepointsSize, 6 );
 
  126   boost::numeric::ublas::matrix< double > WI( tiepointsSize, 6 );
 
  127   boost::numeric::ublas::matrix< double > X( tiepointsSize, 1 );
 
  128   boost::numeric::ublas::matrix< double > XI( tiepointsSize, 1 );
 
  129   boost::numeric::ublas::matrix< double > Y( tiepointsSize, 1 );
 
  130   boost::numeric::ublas::matrix< double > YI( tiepointsSize, 1 );
 
  132   for ( 
unsigned int tpIdx = 0 ; tpIdx < tiepointsSize ; ++tpIdx ) 
 
  137     W( tpIdx, 1 ) = pt1.
x;
 
  138     W( tpIdx, 2 ) = pt1.
y;
 
  139     W( tpIdx, 3 ) = pt1.
x * pt1.
y;
 
  140     W( tpIdx, 4 ) = pt1.
x * pt1.
x;
 
  141     W( tpIdx, 5 ) = pt1.
y * pt1.
y;
 
  146     WI( tpIdx, 1 ) = pt2.
x;
 
  147     WI( tpIdx, 2 ) = pt2.
y;
 
  148     WI( tpIdx, 3 ) = pt2.
x * pt2.
y;
 
  149     WI( tpIdx, 4 ) = pt2.
x * pt2.
x;
 
  150     WI( tpIdx, 5 ) = pt2.
y * pt2.
y;    
 
  152     X( tpIdx, 0 ) = pt2.
x;
 
  154     XI( tpIdx, 0 ) = pt1.
x;
 
  156     Y( tpIdx, 0 ) = pt2.
y;
 
  158     YI( tpIdx, 0 ) = pt1.
y;    
 
  163   boost::numeric::ublas::matrix< double > PinvW;
 
  166   boost::numeric::ublas::matrix< double > PinvWI;
 
  169   boost::numeric::ublas::matrix< double > 
A( boost::numeric::ublas::prod( PinvW, X ) );
 
  171   boost::numeric::ublas::matrix< double > AI( boost::numeric::ublas::prod( PinvWI, XI ) );
 
  173   boost::numeric::ublas::matrix< double > B( boost::numeric::ublas::prod( PinvW, Y ) );
 
  175   boost::numeric::ublas::matrix< double > BI( boost::numeric::ublas::prod( PinvWI, YI ) );
 
void inverseMap(const GTParameters ¶ms, const double &pt2X, const double &pt2Y, double &pt1X, double &pt1Y) const 
Inverse mapping (from pt2 space into pt1 space). 
 
Second Degree Polynomial Geometric transformation. 
 
Second Degree Polynomial Geometric transformation. 
 
bool getPseudoInverseMatrix(const boost::numeric::ublas::matrix< T > &inputMatrix, boost::numeric::ublas::matrix< T > &outputMatrix)
Pseudo matrix inversion. 
 
An utility struct for representing 2D coordinates. 
 
bool isValid() const 
Tells if the current instance has a valid transformation. 
 
unsigned int getMinRequiredTiePoints() const 
Returns the minimum number of required tie-points for the current transformation. ...
 
const std::string & getName() const 
Returns the current transformation name. 
 
std::vector< TiePoint > m_tiePoints
Tie points. 
 
~SecondDegreePolynomialGT()
Destructor. 
 
bool computeParameters(GTParameters ¶ms) const 
Calculate the transformation parameters following the new supplied tie-points. 
 
GTParameters m_internalParameters
The current internal parameters. 
 
std::vector< double > m_inverseParameters
Transformation numeric inverse parameters. 
 
void directMap(const GTParameters ¶ms, const double &pt1X, const double &pt1Y, double &pt2X, double &pt2Y) const 
Direct mapping (from pt1 space into pt2 space). 
 
2D Geometric transformation base class. 
 
std::vector< double > m_directParameters
Transformation numeric direct parameters. 
 
2D Geometric transformation parameters. 
 
GeometricTransformation * clone() const 
Creat a clone copy of this instance. 
 
SecondDegreePolynomialGT()
Default constructor.