25 #ifndef __TERRALIB_RP_INTERNAL_TIEPOINTSLOCATORSURFSTRATEGY_H
26 #define __TERRALIB_RP_INTERNAL_TIEPOINTSLOCATORSURFSTRATEGY_H
32 #include <boost/thread.hpp>
77 AbstractParameters*
clone()
const;
87 const double subSampleOptimizationRescaleFactor,
89 std::unique_ptr< TiePointsLocatorStrategyParameters >& subSampledSpecParamsPtr )
const;
93 std::unique_ptr< TiePointsLocatorStrategyParameters >& defaultSpecParamsPtr )
const;
179 const double raster1ToRaster2TransfDMapError,
220 const unsigned int maxInterestPoints,
276 const double raster1ToRaster2TransfDMapError,
300 template<
typename BufferType >
302 const unsigned int& upperLeftX,
const unsigned int& upperLeftY,
303 const unsigned int& lowerRightX,
const unsigned int& lowerRightY )
305 return buffer[ lowerRightY ][ lowerRightX ]
306 - ( ( upperLeftY ) ? buffer[ upperLeftY - 1 ][ lowerRightX ] : 0 )
307 - ( ( upperLeftX ) ? buffer[ lowerRightY ][ upperLeftX - 1 ] : 0 )
308 + ( ( ( upperLeftX != 0 ) && ( upperLeftY != 0 ) ) ? buffer[ upperLeftY - 1 ][ upperLeftX - 1 ] : 0 );
325 const unsigned int& centerX,
const unsigned int& centerY,
326 const unsigned int& lobeWidth,
const unsigned int& lobeRadius )
331 ( centerX + 1 - lobeWidth ),
332 ( centerY - lobeWidth - lobeRadius ),
333 ( centerX + lobeWidth - 1 ),
334 ( centerY + lobeWidth + lobeRadius ) )
338 ( centerX + 1 - lobeWidth ),
339 ( centerY - lobeRadius ),
340 ( centerX + lobeWidth - 1 ),
341 ( centerY + lobeRadius ) ) );
358 const unsigned int& centerX,
const unsigned int& centerY,
359 const unsigned int& lobeWidth,
const unsigned int& lobeRadius )
364 ( centerX - lobeWidth - lobeRadius ),
365 ( centerY + 1 - lobeWidth ),
366 ( centerX + lobeWidth + lobeRadius ),
367 ( centerY + lobeWidth - 1 ) )
371 ( centerX - lobeRadius ),
372 ( centerY + 1 - lobeWidth ),
373 ( centerX + lobeRadius ),
374 ( centerY + lobeWidth - 1 ) );
389 const unsigned int& centerX,
const unsigned int& centerY,
390 const unsigned int& lobeWidth )
396 ( centerX - lobeWidth ),
397 ( centerY - lobeWidth ),
406 ( centerX + lobeWidth ),
407 ( centerY + lobeWidth ) )
413 ( centerY - lobeWidth ),
414 ( centerX + lobeWidth ),
420 ( centerX - lobeWidth ),
423 ( centerY + lobeWidth ) );
437 template<
typename BufferType >
439 const unsigned int& centerX,
const unsigned int& centerY,
440 const unsigned int& radius )
446 ( centerY - radius ),
447 ( centerX + radius ),
448 ( centerY + radius ) )
452 ( centerX - radius ),
453 ( centerY - radius ),
455 ( centerY + radius ) );
469 template<
typename BufferType >
471 const unsigned int& centerX,
const unsigned int& centerY,
472 const unsigned int& radius )
477 ( centerX - radius ),
478 ( centerY - radius ),
479 ( centerX + radius ),
484 ( centerX - radius ),
486 ( centerX + radius ),
487 ( centerY + radius ) );
497 return (
unsigned int)std::pow( 2.0, (
double)(octaveIndex + 1) );
507 return 3 + ( 3 * getSurfOctaveFilterStepSize( octaveIndex ) );
518 const unsigned int& scaleIndex )
520 return getSurfOctaveBaseFilterSize( octaveIndex ) +
521 ( 3 * ( getSurfOctaveFilterStepSize( octaveIndex ) * scaleIndex ) );
Raster tie points locator strategy factory base class.
Tie Points Locator strategy parameters.
Tie-Pointsr locator strategy.
A generic template matrix.
SURF tie-points locator strategy factory.
TiePointsLocatorSURFStrategyFactory()
~TiePointsLocatorSURFStrategyFactory()
te::rp::TiePointsLocatorStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
The parameters passed to the executeMatchingByEuclideanDistThreadEntry method.
~ExecuteMatchingByEuclideanDistThreadEntryParams()
unsigned int * m_nextFeatureIdx1ToProcessPtr
te::gm::GeometricTransformation const * m_raster1ToRaster2TransfPtr
A pointer to a transformation direct mapping raster 1 indexed coords into raster 2 indexed coords,...
InterestPointT const * m_interestPointsSet2Ptr
FloatsMatrix * m_distMatrixPtr
boost::mutex * m_syncMutexPtr
ExecuteMatchingByEuclideanDistThreadEntryParams()
double m_searchOptTreeSearchRadius
Optimization tree search radius (pixels).
FloatsMatrix const * m_featuresSet1Ptr
FloatsMatrix const * m_featuresSet2Ptr
InterestPointT const * m_interestPointsSet1Ptr
TiePointsLocator SURF strategy parameters.
AbstractParameters * clone() const
Create a clone copy of this instance.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
const Parameters & operator=(const Parameters ¶ms)
bool serialize(AlgorithmParametersSerializer &serializer) const
Returns a parameter serialization object.
unsigned int m_surfOctavesNumber
The number of octaves to generate, when applicable (default: 2, minimum:2).
Parameters(const Parameters &)
double m_surfMaxNormEuclideanDist
The maximum acceptable euclidean distance when matching features (when applicable),...
unsigned int m_surfScalesNumber
The number of sub-sampling scales to generate, when applicable (default:3, minimum:3).
The parameters passed to the surfLocatorThreadEntry method.
boost::mutex * m_interestPointsAccessMutexPtr
A pointer to a valid mutex to control the output interest points container access.
~SurfLocatorThreadParams()
boost::mutex * m_rastaDataAccessMutexPtr
A pointer to a valid mutex to controle raster data access.
unsigned int m_scalesNumber
Thread return value pointer.
UCharsMatrix const * m_maskRasterDataPtr
The loaded mask raster data pointer (or zero if no mask is avaliable).
unsigned int m_tiePointsSubSectorsSplitFactor
The number of sectors along each direction.
unsigned int * m_nextRasterLinesBlockToProcessValuePtr
A pointer to a valid counter to control the blocks processing sequence.
unsigned int m_octavesNumber
The number of octaves to generate (minimum:1).
unsigned int m_processingBlocksNumber
The raster data will be splitted into this number of blocks for processing.
SurfLocatorThreadParams()
unsigned int m_maxInterestPointsBySubSector
The maximum number of interest points by sub-sector.
FloatsMatrix const * m_integralRasterDataPtr
The integral image raster data.
std::vector< InterestPointsSetT > * m_interestPointsSubSectorsPtr
A pointer to a valid interest points container (one element by subsector)..
Tie-points locator SURF strategy.
static float getSurfDxyDerivative(float **bufferPtr, const unsigned int ¢erX, const unsigned int ¢erY, const unsigned int &lobeWidth)
Return a SURF box filter Dxy derivative centered over the given position from the given integral imag...
static float getIntegralBoxSum(BufferType &buffer, const unsigned int &upperLeftX, const unsigned int &upperLeftY, const unsigned int &lowerRightX, const unsigned int &lowerRightY)
Return a sum of all pixels inside a box over the given integral image buffer.
static unsigned int getSurfOctaveBaseFilterSize(const unsigned int &octaveIndex)
Return the surf octave base filter size (width).
void getSubSampledSpecStrategyParams(const double subSampleOptimizationRescaleFactor, const TiePointsLocatorStrategyParameters &inputSpecParams, std::unique_ptr< TiePointsLocatorStrategyParameters > &subSampledSpecParamsPtr) const
Returns a sub-sampled version of the given locator strategy specific input parameters.
static float getSurfDxxDerivative(float **bufferPtr, const unsigned int ¢erX, const unsigned int ¢erY, const unsigned int &lobeWidth, const unsigned int &lobeRadius)
Return a SURF box filter Dyy derivative centered over the given position from the given integral imag...
~TiePointsLocatorSURFStrategy()
static void executeMatchingByEuclideanDistThreadEntry(ExecuteMatchingByEuclideanDistThreadEntryParams *paramsPtr)
Correlation/Euclidean match thread entry.
bool m_isInitialized
true if this instance is initialized.
bool executeMatchingByEuclideanDist(const FloatsMatrix &featuresSet1, const FloatsMatrix &featuresSet2, const InterestPointsSetT &interestPointsSet1, const InterestPointsSetT &interestPointsSet2, te::gm::GeometricTransformation const *const raster1ToRaster2TransfPtr, const double raster1ToRaster2TransfDMapError, MatchedInterestPointsSetT &matchedPoints)
Match each feature using eucliean distance.
bool locateSurfInterestPoints(const unsigned int maxInterestPoints, const FloatsMatrix &integralRasterData, UCharsMatrix const *maskRasterDataPtr, InterestPointsSetT &interestPoints) const
SURF interest points locator.
TiePointsLocatorSURFStrategy()
static unsigned int getSurfOctaveFilterStepSize(const unsigned int &octaveIndex)
Return the surf octave filter step size (width).
static void locateSurfInterestPointsThreadEntry(SurfLocatorThreadParams *paramsPtr)
Surf locator thread entry.
unsigned int getAutoMaxTiePointsNumber() const
Returns a automatically calculated optimum maximum amount tie-points following the current parameters...
static bool generateSurfFeatures(const InterestPointsSetT &interestPoints, const FloatsMatrix &integralRasterData, InterestPointsSetT &validInterestPoints, FloatsMatrix &features)
Generate a Surf features matrix for the given interes points.
static float getSurfDyyDerivative(float **bufferPtr, const unsigned int ¢erX, const unsigned int ¢erY, const unsigned int &lobeWidth, const unsigned int &lobeRadius)
Return a SURF box filter Dxx derivative centered over the given position from the given integral imag...
static float getHaarXVectorIntensity(BufferType &buffer, const unsigned int ¢erX, const unsigned int ¢erY, const unsigned int &radius)
Return a Haar X intesity vector for the window centered at the given point.
bool getMatchedInterestPoints(te::gm::GeometricTransformation const *const raster1ToRaster2TransfPtr, const double raster1ToRaster2TransfDMapError, MatchedInterestPointsSetT &matchedInterestPoints)
Try to find matched interest points.
te::rp::TiePointsLocatorInputParameters m_inputParameters
Input parameters.
void reset()
Clear all internal allocated resources and go back to the initial not-initialized state.
static unsigned int getSurfFilterSize(const unsigned int &octaveIndex, const unsigned int &scaleIndex)
Return the surf octave filter size (width).
static bool createIntegralImage(const FloatsMatrix &inputData, FloatsMatrix &outputData)
Create an integral image.
void getDefaultSpecStrategyParams(std::unique_ptr< TiePointsLocatorStrategyParameters > &defaultSpecParamsPtr) const
Returns a sub-sampled version of the given locator strategy specific input parameters.
bool initialize(const te::rp::TiePointsLocatorInputParameters &inputParameters)
Initialize the strategy.
static float getHaarYVectorIntensity(BufferType &buffer, const unsigned int ¢erX, const unsigned int ¢erY, const unsigned int &radius)
Return a Haar Y intesity vector for the window centered at the given point.
Raster tie-points locator strategy factory base class.
TiePointsLocator strategy parameters.
Tie-points locator strategy.
std::multiset< InterestPointT > InterestPointsSetT
std::multiset< MatchedInterestPointsT > MatchedInterestPointsSetT
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.