ProjectiveGT.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/geometry/ProjectiveGT.h
22 
23  \brief 2D Projective Geometric transformation.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_PROJECTIVEGT_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_PROJECTIVEGT_H
28 
29 // TerraLib
30 #include "Config.h"
32 
33 // Boost
34 #include <boost/concept_check.hpp>
35 #include <boost/numeric/ublas/matrix.hpp>
36 
37 namespace te
38 {
39  namespace gm
40  {
41  /*!
42  \class ProjectiveGT
43 
44  \brief 2D Projective Geometric transformation.
45 
46  \note The transformation parameters (inside GTParameters::m_directParameters) are disposed on the following form:
47 
48  \code
49  | u | | a b c | * | x |
50  | v | = | d e f | | y |
51  | 1 | | g h 1 | | 1 |
52 
53  u = a.x + b.y + c
54  -------------------
55  g.x + h.y + 1
56 
57  v = d.x + e.y + f
58  -------------------
59  g.x + h.y + 1
60 
61  |u0| |x0 y0 1 0 0 0 -x0*u0 -y0*v0|.|a|
62  |v0| |0 0 0 x0 y0 1 -x0*v0 -y0*v0| |b|
63  |u1| |...................................| |c|
64  |v1| = |...................................| |d|
65  |..| |...................................| |e|
66  |..| |...................................| |f|
67  |..| |...................................| |g|
68  |..| |...................................| |h|
69 
70  GTParameters::m_directParameters = [ a b c d e f g h ]
71  \endcode
72  */
74  {
75  public:
76 
77  /*! \brief Default constructor. */
79 
80  /*! \brief Destructor. */
82 
83  const std::string& getName() const;
84 
85  bool isValid( const GTParameters& params ) const;
86 
87  void directMap( const GTParameters& params, const double& pt1X,
88  const double& pt1Y, double& pt2X, double& pt2Y ) const;
89 
90  void inverseMap( const GTParameters& params, const double& pt2X,
91  const double& pt2Y, double& pt1X, double& pt1Y ) const;
92 
93  unsigned int getMinRequiredTiePoints() const;
94 
96 
97  protected:
98 
99  // Variables used by method computeParameters
100  mutable unsigned int m_computeParameters_tiepointsSize;
101  mutable unsigned int m_computeParameters_index1;
102  mutable unsigned int m_computeParameters_index2;
103  mutable unsigned int m_computeParameters_blockOffset;
104  mutable boost::numeric::ublas::matrix< double > m_computeParameters_L_DM;
105  mutable boost::numeric::ublas::matrix< double > m_computeParameters_A_DM;
106  mutable boost::numeric::ublas::matrix< double > m_computeParameters_L_IM;
107  mutable boost::numeric::ublas::matrix< double > m_computeParameters_A_IM;
108  mutable boost::numeric::ublas::matrix< double > m_computeParameters_A_DM_t;
109  mutable boost::numeric::ublas::matrix< double > m_computeParameters_A_IM_t;
110  mutable boost::numeric::ublas::matrix< double > m_computeParameters_N_DM;
111  mutable boost::numeric::ublas::matrix< double > m_computeParameters_N_IM;
112  mutable boost::numeric::ublas::matrix< double > m_computeParameters_U_DM;
113  mutable boost::numeric::ublas::matrix< double > m_computeParameters_U_IM;
114  mutable boost::numeric::ublas::matrix< double > m_computeParameters_N_DM_inv;
115  mutable boost::numeric::ublas::matrix< double > m_computeParameters_N_IM_inv;
116  mutable boost::numeric::ublas::matrix< double > m_computeParameters_X_DM;
117  mutable boost::numeric::ublas::matrix< double > m_computeParameters_X_IM;
118 
119  bool computeParameters( GTParameters& params ) const;
120  };
121 
122  } // end namespace gm
123 } // end namespace te
124 
125 #endif // __TERRALIB_GEOMETRY_INTERNAL_PROJECTIVEGT_H
126 
GeometricTransformation.h
2D Geometric transformation base class.
te::gm::ProjectiveGT::inverseMap
void inverseMap(const GTParameters &params, const double &pt2X, const double &pt2Y, double &pt1X, double &pt1Y) const
Inverse mapping (from pt2 space into pt1 space).
te::gm::ProjectiveGT::m_computeParameters_A_DM_t
boost::numeric::ublas::matrix< double > m_computeParameters_A_DM_t
Definition: ProjectiveGT.h:108
te::gm::ProjectiveGT::m_computeParameters_N_DM_inv
boost::numeric::ublas::matrix< double > m_computeParameters_N_DM_inv
Definition: ProjectiveGT.h:114
te::gm::ProjectiveGT::m_computeParameters_index1
unsigned int m_computeParameters_index1
Definition: ProjectiveGT.h:101
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::gm::ProjectiveGT::m_computeParameters_A_DM
boost::numeric::ublas::matrix< double > m_computeParameters_A_DM
Definition: ProjectiveGT.h:105
te::gm::ProjectiveGT::~ProjectiveGT
~ProjectiveGT()
Destructor.
te::gm::ProjectiveGT::m_computeParameters_A_IM
boost::numeric::ublas::matrix< double > m_computeParameters_A_IM
Definition: ProjectiveGT.h:107
te::gm::ProjectiveGT::m_computeParameters_A_IM_t
boost::numeric::ublas::matrix< double > m_computeParameters_A_IM_t
Definition: ProjectiveGT.h:109
te::gm::ProjectiveGT::m_computeParameters_tiepointsSize
unsigned int m_computeParameters_tiepointsSize
Definition: ProjectiveGT.h:100
te::gm::ProjectiveGT::m_computeParameters_N_IM_inv
boost::numeric::ublas::matrix< double > m_computeParameters_N_IM_inv
Definition: ProjectiveGT.h:115
te::gm::GTParameters
2D Geometric transformation parameters.
Definition: GTParameters.h:51
TEGEOMEXPORT
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
te::gm::ProjectiveGT::m_computeParameters_X_IM
boost::numeric::ublas::matrix< double > m_computeParameters_X_IM
Definition: ProjectiveGT.h:117
te::gm::ProjectiveGT::ProjectiveGT
ProjectiveGT()
Default constructor.
te::gm::ProjectiveGT::m_computeParameters_U_IM
boost::numeric::ublas::matrix< double > m_computeParameters_U_IM
Definition: ProjectiveGT.h:113
te::gm::ProjectiveGT::m_computeParameters_L_DM
boost::numeric::ublas::matrix< double > m_computeParameters_L_DM
Definition: ProjectiveGT.h:104
te::gm::ProjectiveGT::isValid
bool isValid(const GTParameters &params) const
Verifies if the supplied parameters already has a valid transformation.
te::gm::ProjectiveGT
2D Projective Geometric transformation.
Definition: ProjectiveGT.h:74
te::gm::ProjectiveGT::m_computeParameters_L_IM
boost::numeric::ublas::matrix< double > m_computeParameters_L_IM
Definition: ProjectiveGT.h:106
te::gm::ProjectiveGT::getName
const std::string & getName() const
Returns the current transformation name.
te::gm::ProjectiveGT::directMap
void directMap(const GTParameters &params, const double &pt1X, const double &pt1Y, double &pt2X, double &pt2Y) const
Direct mapping (from pt1 space into pt2 space).
te::gm::ProjectiveGT::clone
GeometricTransformation * clone() const
Creat a clone copy of this instance.
te::gm::ProjectiveGT::m_computeParameters_N_DM
boost::numeric::ublas::matrix< double > m_computeParameters_N_DM
Definition: ProjectiveGT.h:110
te::gm::ProjectiveGT::getMinRequiredTiePoints
unsigned int getMinRequiredTiePoints() const
Returns the minimum number of required tie-points for the current transformation.
te::gm::GeometricTransformation
2D Geometric transformation base class.
Definition: GeometricTransformation.h:57
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::gm::ProjectiveGT::m_computeParameters_index2
unsigned int m_computeParameters_index2
Definition: ProjectiveGT.h:102
te::gm::ProjectiveGT::computeParameters
bool computeParameters(GTParameters &params) const
Calculate the transformation parameters following the new supplied tie-points.
te::gm::ProjectiveGT::m_computeParameters_N_IM
boost::numeric::ublas::matrix< double > m_computeParameters_N_IM
Definition: ProjectiveGT.h:111
te::gm::ProjectiveGT::m_computeParameters_X_DM
boost::numeric::ublas::matrix< double > m_computeParameters_X_DM
Definition: ProjectiveGT.h:116
te::gm::ProjectiveGT::m_computeParameters_U_DM
boost::numeric::ublas::matrix< double > m_computeParameters_U_DM
Definition: ProjectiveGT.h:112
te::gm::ProjectiveGT::m_computeParameters_blockOffset
unsigned int m_computeParameters_blockOffset
Definition: ProjectiveGT.h:103