30 #include "../geometry/GTFactory.h"
31 #include "../geometry/GTFilter.h"
32 #include "../common/progress/TaskProgress.h"
58 m_transformationPtr.reset();
89 throw( te::rp::Exception )
103 std::auto_ptr< TiePointsLocatorStrategy > stratPtr;
130 "Tie points locator strategy initialization error" );
134 matchedInterestPoints ),
135 "Tie points interest points location error" );
207 "Tie points locator strategy initialization error" );
209 0, subSampledMatchedInterestPoints ) )
211 subSampledMatchedInterestPoints.clear();
217 std::vector< double > subSampledTiePointsWeights;
219 subSampledTransParams.
m_tiePoints, subSampledTiePointsWeights );
221 subSampledMatchedInterestPoints.clear();
225 std::auto_ptr< te::gm::GeometricTransformation > transformationPtr(
229 double transformationCoveredAreaPercentR1 = 0;
230 double transformationCoveredAreaPercentR2 = 0;
234 std::vector< te::gm::GTParameters::TiePoint > filteredTiePoints;
238 subSampledTransParams,
244 subSampledTiePointsWeights,
246 transformationPtr ) )
248 transformationCoveredAreaPercentR1 =
259 transformationCoveredAreaPercentR2 =
272 ((
double)filteredTiePoints.size())
277 ((
double)transformationPtr->getMinRequiredTiePoints() )
283 transformationCoveredAreaPercentR1
285 transformationCoveredAreaPercentR2
296 transformationPtr.reset();
301 transformationPtr.reset();
306 if( !transformationPtr->initialize( subSampledTransParams ) )
308 transformationPtr.reset();
320 "Tie points locator strategy initialization error" );
323 transformationPtr.get(),
326 matchedInterestPoints ),
327 "Tie points interest points location error" );
332 std::vector< te::gm::GTParameters::TiePoint > tiePoints;
333 std::vector< double > tiePointsWeights;
337 matchedInterestPoints.clear();
369 "Invalid transformation" );
382 unsigned int tiePointsIdx = 0;
384 for(
unsigned int outTiePointdx = 0 ; outTiePointdx < outParamsPtr->
m_tiePoints.size() ;
387 for( tiePointsIdx = 0 ; tiePointsIdx < tiePoints.size() ; ++tiePointsIdx )
389 if( tiePoints[ tiePointsIdx ] == outParamsPtr->
m_tiePoints[ outTiePointdx ] )
410 throw( te::rp::Exception )
425 "Invalid m_inRaster1Ptr" );
428 "Invalid m_inRaster1Ptr" );
436 "Invalid m_inMaskRaster1Ptr" );
439 "Invalid m_inMaskRaster1Ptr" );
443 "Invalid m_inMaskRaster1Ptr" );
447 "Invalid m_inMaskRaster1Ptr" );
454 "Invalid m_raster1TargetAreaLineStart" );
458 "Invalid m_raster1TargetAreaColStart" );
482 "Invalid m_raster1TargetAreaWidth" );
484 "Invalid m_raster1TargetAreaHeight" );
488 for(
unsigned int bandIdx = 0 ; bandIdx <
494 "Invalid m_inRaster1Bands" );
501 "Invalid m_inRaster2Ptr" );
504 "Invalid m_inRaster2Ptr" );
512 "Invalid m_inMaskRaster2Ptr" );
515 "Invalid m_inMaskRaster2Ptr" );
519 "Invalid m_inMaskRaster2Ptr" );
523 "Invalid m_inMaskRaster2Ptr" );
530 "Invalid m_raster2TargetAreaLineStart" );
534 "Invalid m_raster2TargetAreaColStart" );
558 "Invalid m_raster2TargetAreaWidth" );
560 "Invalid m_raster2TargetAreaHeight" );
565 for(
unsigned int bandIdx = 0 ; bandIdx <
571 "Invalid m_inRaster2Bands" );
597 "Invalid m_pixelSizeXRelation" )
600 "Invalid m_pixelSizeYRelation" )
603 "Invalid m_geomTransfMaxError" )
607 "Invalid m_geomTransfName" );
611 "Invalid m_geometryFilterAssurance" );
615 "Invalid m_subSampleOptimizationRescaleFactor" );
619 "Invalid m_subSampleOptimizationMinTPAreaCoverage" );
622 "Invalid m_subSampleOptimizationMinTPNumber" );
625 "Invalid m_tiePointsSubSectorsSplitFactor" );
639 std::vector< te::gm::GTParameters::TiePoint >& tiePoints,
640 std::vector< double >& tiePointsWeights )
643 tiePointsWeights.clear();
646 te::rp::TiePointsLocatorStrategy::MatchedInterestPointsSetT::const_iterator
647 itB = matchedInterestPoints.begin();
648 const te::rp::TiePointsLocatorStrategy::MatchedInterestPointsSetT::const_iterator
649 itE = matchedInterestPoints.end();
653 auxTP.first.x = itB->m_point1.m_x;
654 auxTP.first.y = itB->m_point1.m_y;
655 auxTP.second.x = itB->m_point2.m_x;
656 auxTP.second.y = itB->m_point2.m_y;
657 tiePoints.push_back( auxTP );
659 tiePointsWeights.push_back( itB->m_feature );
std::vector< te::gm::GTParameters::TiePoint > m_tiePoints
The generated tie-points (te::gm::GTParameters::TiePoint::first are raster 1 line/column indexes...
std::vector< TiePoint > m_tiePoints
Tie points.
AbstractParameters * clone() const
Create a clone copy of this instance.
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
double GetTPConvexHullArea(const ContainerT &tiePoints, const bool useTPSecondCoordPair)
Returns the tie points converx hull area.
Tie-points locator Moravec strategy.
Raster Processing algorithm output parameters base interface.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
Tie-Pointsr locator SURF strategy.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::pair< Coord2D, Coord2D > TiePoint
Tie point type definition.
2D Geometric transformation tie-points filter (outliers remotion).
bool applyRansac(const std::string &transfName, const GTParameters &inputParams, const double maxDirectMapError, const double maxInverseMapError, const RansacIntegerCounterT &maxIterations, const double &assurance, const bool enableMultiThread, const std::vector< double > &tiePointsWeights, std::vector< te::gm::GTParameters::TiePoint > &outTiePoints, std::auto_ptr< GeometricTransformation > &outTransf)
Apply a RANSAC based outliers remotion strategy.
Raster Processing functions.
#define TERP_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged and a return of context wi...
const Algorithm & operator=(const Algorithm &)
Tie-Pointsr locator Moravec strategy.
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
void convertMatchedInterestPoints2TiePoints(const te::rp::TiePointsLocatorStrategy::MatchedInterestPointsSetT &matchedInterestPoints, std::vector< te::gm::GTParameters::TiePoint > &tiePoints, std::vector< double > &tiePointsWeights)
Convert matched interest points to tie-points.
TiePointsLocator::InputParameters m_inputParameters
TiePointsLocator input execution parameters.
std::auto_ptr< te::gm::GeometricTransformation > m_transformationPtr
The generated geometric transformation with the base mininum required tie-points set ( depending on t...
unsigned int getNumberOfRows() const
Returns the raster number of rows.
#define TERP_LOG_AND_THROW(message)
Logs a error message and throws.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
static GeometricTransformation * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
TiePointsLocator output parameters.
Tie-points locator SURF strategy.
bool m_isInitialized
Tells if this instance is initialized.
Abstract parameters base interface.
const OutputParameters & operator=(const OutputParameters ¶ms)
#define TERP_LOG_AND_RETURN_FALSE(message)
Logs a warning message will and return false.
std::vector< double > m_tiePointsWeights
The generated tie-points weights.
static const factory_type * find(const std::string &factoryKey)
TiePointsLocator locator.
2D Geometric transformation parameters.
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
std::multiset< MatchedInterestPointsT > MatchedInterestPointsSetT
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.