| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeGeometricTransformation.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00027 #ifndef TEGEOMETRICTRANSFORMATION_H
    00028   #define TEGEOMETRICTRANSFORMATION_H
    00029
    00030   #include "TeDefines.h"
    00031   #include "TeCoord2D.h"
    00032   #include "TeMatrix.h"
    00033   #include "TeGTParams.h"
    00034   #include "TeSharedPtr.h"
    00035   #include "TeAgnostic.h"
    00036   #include "TeThreadParameters.h"
    00037
    00038   #include <vector>
    00039   #include <list>
    00040
    00048   class TL_DLL TeGeometricTransformation {
    00049     private :
    00050
    00054       TeGTParams internal_params_;
    00055
    00056     protected :
    00057
    00065       virtual bool isTransDefined( const TeGTParams& params )
    00066         const = 0;
    00067
    00068     public :
    00069
    00074       typedef TeSharedPtr< TeGeometricTransformation > pointer;
    00075
    00079       virtual ~TeGeometricTransformation();
    00080
    00087       inline void directMap( const TeCoord2D& pt1, TeCoord2D& pt2 ) const
    00088       {
    00089         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00090           "Transformation not defined" )
    00091
    00092         directMap( internal_params_, pt1, pt2 );
    00093       };
    00094
    00101       inline void inverseMap( const TeCoord2D& pt2,
    00102         TeCoord2D& pt1 ) const
    00103       {
    00104         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00105           "Transformation not defined" )
    00106
    00107         inverseMap( internal_params_, pt2, pt1 );
    00108       };
    00109
    00117       bool reset( const TeGTParams& newparams );
    00118
    00124       void getParameters( TeGTParams& params ) const;
    00125
    00131       const TeGTParams& getParameters() const;
    00132
    00139       inline double getDirectMappingError() const
    00140       {
    00141         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00142           "Transformation not defined" )
    00143
    00144         return getDirectMappingError( internal_params_ );
    00145       };
    00146
    00153       inline double getInverseMappingError() const
    00154       {
    00155         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00156           "Transformation not defined" )
    00157
    00158         return getInverseMappingError( internal_params_ );
    00159       };
    00160
    00167       inline double getDMapRMSE() const
    00168       {
    00169         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00170           "Transformation not defined" )
    00171
    00172         return getDMapRMSE( internal_params_ );
    00173       };
    00174
    00181       inline double getIMapRMSE() const
    00182       {
    00183         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00184           "Transformation not defined" )
    00185
    00186         return getIMapRMSE( internal_params_ );
    00187       };
    00188
    00196       inline double getDirectMappingError( const TeCoordPair& tie_point ) const
    00197       {
    00198         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00199           "Transformation not defined" )
    00200
    00201         return getDirectMappingError( tie_point, internal_params_ );
    00202       };
    00203
    00211       inline double getInverseMappingError( const TeCoordPair& tie_point ) const
    00212       {
    00213         TEAGN_DEBUG_CONDITION( isTransDefined( internal_params_ ),
    00214           "Transformation not defined" )
    00215
    00216         return getInverseMappingError( tie_point, internal_params_ );
    00217       };
    00218
    00226       virtual unsigned int getMinRequiredTiePoints() const = 0;
    00227
    00233       static TeGeometricTransformation* DefaultObject(
    00234         const TeGTParams& );
    00235
    00236     protected :
    00237
    00241       TeGeometricTransformation();
    00242
    00250       virtual void directMap( const TeGTParams& params,
    00251         const TeCoord2D& pt1, TeCoord2D& pt2 ) const = 0;
    00252
    00260       virtual void inverseMap( const TeGTParams& params,
    00261         const TeCoord2D& pt2,
    00262         TeCoord2D& pt1 ) const = 0;
    00263
    00271       virtual bool computeParameters( TeGTParams& params )
    00272         const = 0;
    00273
    00281       double getDirectMappingError( const TeGTParams& params ) const;
    00282
    00290       double getInverseMappingError( const TeGTParams& params ) const;
    00291
    00299       double getDMapRMSE( const TeGTParams& params ) const;
    00300
    00308       double getIMapRMSE( const TeGTParams& params ) const;
    00309
    00318       double getDirectMappingError( const TeCoordPair& tie_point,
    00319         const TeGTParams& params ) const;
    00320
    00329       double getInverseMappingError( const TeCoordPair& tie_point,
    00330         const TeGTParams& params ) const;
    00331
    00332     private :
    00333
    00337       typedef unsigned int RansacItCounterT;
    00338
    00342       class ExcTPDataNode
    00343       {
    00344         public :
    00345           TeCoordPair tp_;
    00347           double tp_weight_;
    00348
    00349           double dmap_error_;
    00350           double imap_error_;
    00351
    00353           double tp_error_;
    00354
    00355           ExcTPDataNode()
    00356           {
    00357             tp_weight_ = dmap_error_ = imap_error_ = tp_error_ = 0.0;
    00358           }
    00359
    00360           ExcTPDataNode( const ExcTPDataNode& other )
    00361           {
    00362             tp_ = other.tp_;
    00363             tp_weight_ = other.tp_weight_;
    00364             dmap_error_ = other.dmap_error_;
    00365             imap_error_ = other.imap_error_;
    00366             tp_error_ = other.tp_error_;
    00367           }
    00368
    00369           const ExcTPDataNode& operator=( const ExcTPDataNode& other )
    00370           {
    00371             tp_ = other.tp_;
    00372             tp_weight_ = other.tp_weight_;
    00373             dmap_error_ = other.dmap_error_;
    00374             imap_error_ = other.imap_error_;
    00375             tp_error_ = other.tp_error_;
    00376
    00377             return other;
    00378           }
    00379
    00380           bool operator< ( const ExcTPDataNode& other ) const
    00381           {
    00382             return ( ( tp_error_ < other.tp_error_ ) ? true : false );
    00383           }
    00384       };
    00385
    00389       class TPDataNode
    00390       {
    00391         public :
    00392           unsigned int tpindex_;
    00393           double dmap_error_;
    00394           double imap_error_;
    00395
    00397           double tp_error_;
    00398
    00399           TPDataNode()
    00400           {
    00401             dmap_error_ = imap_error_ = tp_error_ = 0.0;
    00402             tpindex_ = 0;
    00403           }
    00404
    00405           TPDataNode( const TPDataNode& other )
    00406           {
    00407             tpindex_ = other.tpindex_;
    00408             dmap_error_ = other.dmap_error_;
    00409             imap_error_ = other.imap_error_;
    00410             tp_error_ = other.tp_error_;
    00411           }
    00412
    00413           const TPDataNode& operator=( const TPDataNode& other )
    00414           {
    00415             tpindex_ = other.tpindex_;
    00416             dmap_error_ = other.dmap_error_;
    00417             imap_error_ = other.imap_error_;
    00418             tp_error_ = other.tp_error_;
    00419
    00420             return other;
    00421           }
    00422
    00423           bool operator< ( const TPDataNode& other ) const
    00424           {
    00425             return ( ( tp_error_ < other.tp_error_ ) ? true : false );
    00426           }
    00427       };
    00428
    00436       const TeGeometricTransformation& operator=(
    00437         const TeGeometricTransformation& ) { return *this; };
    00438
    00452       static bool recombineSeed( std::vector<unsigned int>& seed,
    00453         const unsigned int& seedpos, const unsigned int& elements_nmb );
    00454
    00464       bool exaustiveOutRemotion( TeGTParams& params,
    00465         unsigned int threads_nmb );
    00466
    00472       static bool eORThreadEntry( const TeThreadParameters&
    00473         params );
    00474
    00482       bool lWOutRemotion( TeGTParams& params );
    00483
    00492       void updateExcTPErrList( const TeGTParams& params,
    00493         bool useTPWeights,
    00494         std::list< ExcTPDataNode >& exc_tp_list ) const;
    00495
    00504       void updateTPErrVec( const TeGTParams& params,
    00505         bool useTPWeights,
    00506         std::vector< TPDataNode >& errvec ) const;
    00507
    00514       bool ransacRemotion( const TeGTParams& inputParams,
    00515         TeGTParams& outputParams ) const;
    00516
    00517
    00524       bool normalizeTPWeights( std::vector< double >& tpWeights ) const;
    00525
    00526       double getPt1ConvexHullArea( const TeCoordPairVect& tiePoints ) const;
    00527
    00528   };
    00529
    00530 #endif
    00531

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines