30 #include "../geometry/GTFactory.h" 31 #include "../geometry/GTFilter.h" 32 #include "../common/progress/TaskProgress.h" 87 throw( te::rp::Exception )
101 std::unique_ptr< TiePointsLocatorStrategy > stratPtr(
113 "Tie points locator strategy initialization error: " +
114 stratPtr->getErrorMessage() );
118 matchedInterestPoints ),
119 "Tie points interest points location error: " +
120 stratPtr->getErrorMessage() );
137 std::unique_ptr< TiePointsLocatorStrategyParameters > subSampledSpecStratParametersPtr;
138 stratPtr->getSubSampledSpecStrategyParams(
141 subSampledSpecStratParametersPtr );
146 "Tie points locator strategy initialization error: " + stratPtr->getErrorMessage() );
148 0, subSampledMatchedInterestPoints ) )
150 subSampledMatchedInterestPoints.clear();
156 std::vector< double > subSampledTiePointsWeights;
158 subSampledTransParams.
m_tiePoints, subSampledTiePointsWeights );
160 subSampledMatchedInterestPoints.clear();
164 std::unique_ptr< te::gm::GeometricTransformation > transformationPtr(
168 double transformationCoveredAreaPercentR1 = 0;
169 double transformationCoveredAreaPercentR2 = 0;
173 std::vector< te::gm::GTParameters::TiePoint > filteredTiePoints;
177 subSampledTransParams,
183 subSampledTiePointsWeights,
185 transformationPtr ) )
187 transformationCoveredAreaPercentR1 =
198 transformationCoveredAreaPercentR2 =
211 ((
double)filteredTiePoints.size())
216 ((
double)transformationPtr->getMinRequiredTiePoints() )
222 transformationCoveredAreaPercentR1
224 transformationCoveredAreaPercentR2
235 transformationPtr.reset();
240 transformationPtr.reset();
245 if( !transformationPtr->initialize( subSampledTransParams ) )
247 transformationPtr.reset();
259 "Tie points locator strategy initialization error: " + stratPtr->getErrorMessage() );
262 transformationPtr.get(),
265 matchedInterestPoints ),
266 "Tie points interest points location error: " + stratPtr->getErrorMessage() );
271 std::vector< te::gm::GTParameters::TiePoint > tiePoints;
272 std::vector< double > tiePointsWeights;
276 matchedInterestPoints.clear();
308 "Invalid transformation" );
321 unsigned int tiePointsIdx = 0;
323 for(
unsigned int outTiePointdx = 0 ; outTiePointdx < outParamsPtr->
m_tiePoints.size() ;
326 for( tiePointsIdx = 0 ; tiePointsIdx < tiePoints.size() ; ++tiePointsIdx )
328 if( tiePoints[ tiePointsIdx ] == outParamsPtr->
m_tiePoints[ outTiePointdx ] )
351 throw( te::rp::Exception )
366 "Invalid m_inRaster1Ptr" );
369 "Invalid m_inRaster1Ptr" );
377 "Invalid m_inMaskRaster1Ptr" );
380 "Invalid m_inMaskRaster1Ptr" );
384 "Invalid m_inMaskRaster1Ptr" );
388 "Invalid m_inMaskRaster1Ptr" );
395 "Invalid m_raster1TargetAreaLineStart" );
399 "Invalid m_raster1TargetAreaColStart" );
423 "Invalid m_raster1TargetAreaWidth" );
425 "Invalid m_raster1TargetAreaHeight" );
429 for(
unsigned int bandIdx = 0 ; bandIdx <
435 "Invalid m_inRaster1Bands" );
442 "Invalid m_inRaster2Ptr" );
445 "Invalid m_inRaster2Ptr" );
453 "Invalid m_inMaskRaster2Ptr" );
456 "Invalid m_inMaskRaster2Ptr" );
460 "Invalid m_inMaskRaster2Ptr" );
464 "Invalid m_inMaskRaster2Ptr" );
471 "Invalid m_raster2TargetAreaLineStart" );
475 "Invalid m_raster2TargetAreaColStart" );
499 "Invalid m_raster2TargetAreaWidth" );
501 "Invalid m_raster2TargetAreaHeight" );
506 for(
unsigned int bandIdx = 0 ; bandIdx <
512 "Invalid m_inRaster2Bands" );
520 "Invalid strategy" );
525 "Invalid m_pixelSizeXRelation" )
528 "Invalid m_pixelSizeYRelation" )
531 "Invalid m_geomTransfMaxError" )
535 "Invalid m_geomTransfName" );
539 "Invalid m_geometryFilterAssurance" );
543 "Invalid m_subSampleOptimizationRescaleFactor" );
547 "Invalid m_subSampleOptimizationMinTPAreaCoverage" );
550 "Invalid m_subSampleOptimizationMinTPNumber" );
553 "Invalid m_tiePointsSubSectorsSplitFactor" );
567 std::vector< te::gm::GTParameters::TiePoint >& tiePoints,
568 std::vector< double >& tiePointsWeights )
571 tiePointsWeights.clear();
574 te::rp::TiePointsLocatorStrategy::MatchedInterestPointsSetT::const_iterator
575 itB = matchedInterestPoints.begin();
576 const te::rp::TiePointsLocatorStrategy::MatchedInterestPointsSetT::const_iterator
577 itE = matchedInterestPoints.end();
581 auxTP.first.x = itB->m_point1.m_x;
582 auxTP.first.y = itB->m_point1.m_y;
583 auxTP.second.x = itB->m_point2.m_x;
584 auxTP.second.y = itB->m_point2.m_y;
585 tiePoints.push_back( auxTP );
587 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.
Base exception class for plugin module.
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.
Raster Processing algorithm output parameters base interface.
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
Raster tie points locator strategy factory base class.
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).
std::unique_ptr< te::gm::GeometricTransformation > m_transformationPtr
The generated geometric transformation with the base mininum required tie-points set ( depending on t...
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.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
static te::rp::TiePointsLocatorStrategy * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
TiePointsLocator output parameters.
bool m_isInitialized
Tells if this instance is initialized.
Abstract parameters base interface.
const OutputParameters & operator=(const OutputParameters ¶ms)
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.
Raster Processing functions.
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::unique_ptr< GeometricTransformation > &outTransf)
Apply a RANSAC based outliers remotion strategy.
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
virtual void reset() _NOEXCEPT_OP(false)
Clear all internal allocated objects and reset the algorithm to its initial state.
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
#define TERP_INSTANCE_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged, the current instance erro...
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.