OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ATP::AtpTileSource Class Referenceabstract

Base class for tile sources performing auto tie point extraction. More...

#include <AtpTileSource.h>

Inheritance diagram for ATP::AtpTileSource:
ossimImageCombiner ossimImageSource ossimConnectableObjectListener ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced ATP::ossimCorrelationSource ATP::ossimDescriptorSource

Classes

struct  ParallaxInfo
 Convenience struct for use between filterWithParallax( and computeParallaxStatistics() More...
 

Public Member Functions

 AtpTileSource (AtpGenerator *generator)
 
virtual ~AtpTileSource ()
 
virtual void initialize ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &origin, ossim_uint32 rLevel=0)=0
 Derived classes implement their particular tiepoint matching algorithms for the requested tile. More...
 
AtpListgetTiePoints ()
 This list resets with every getTile() call , so make sure tiepoints from previous getTile() calls are being accumulated. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
void filterPoints ()
 
void setTiePoints (ossim::TiePointList &atpList)
 Used for testing. More...
 
- Public Member Functions inherited from ossimImageCombiner
 ossimImageCombiner ()
 
 ossimImageCombiner (ossimObject *owner, int numberOfInputs, int numberOfOutputs, bool inputListIsFixedFlag, bool outputListIsFixedFlag)
 
 ossimImageCombiner (ossimConnectableObject::ConnectableObjectList &inputSources)
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 This will return the bounding rect of the source. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=NULL)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=NULL) const
 Method to save the state of an object to a keyword list. More...
 
virtual void updateRects ()
 This will go through and precompute the bounding rects of each input image. More...
 
virtual ossim_uint32 getNumberOfInputBands () const
 Returns the number of bands available from the input. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual double getMinPixelValue (ossim_uint32 band=0) const
 Returns the min pixel of the band. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual ossim_uint32 getNumberOfOverlappingImages (const ossimIrect &rect, ossim_uint32 resLevel=0) const
 Used to retrieve the number of overlapping images withint the given rect. More...
 
virtual void getOverlappingImages (std::vector< ossim_uint32 > &result, const ossimIrect &rect, ossim_uint32 resLevel=0) const
 Used to populate the result with the index of the overlapping images. More...
 
virtual ossimRefPtr< ossimImageDatagetNextTile (ossim_uint32 &returnedIdx, const ossim_uint32 startIdx, const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual ossimRefPtr< ossimImageDatagetNextTile (ossim_uint32 &returnedIdx, const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual bool getNextTile (ossim_uint32 &returnedIdx, const ossim_uint32 startIdx, ossimImageData *tile, ossim_uint32 resLevel=0)
 
virtual ossimRefPtr< ossimImageDatagetNextNormTile (ossim_uint32 &returnedIdx, const ossim_uint32 index, const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual ossimRefPtr< ossimImageDatagetNextNormTile (ossim_uint32 &returnedIdx, const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual void refreshEvent (ossimRefreshEvent &event)
 
virtual bool hasDifferentInputs () const
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
virtual ossimObjectgetObject ()
 For RTTI support. More...
 
virtual const ossimObjectgetObject () const
 For RTTI support. More...
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 Will return the decimation factor for the given resolution level. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Will return the number of resolution levels. More...
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 Initializes bandList. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if not defined. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual void saveImageGeometry () const
 Default method to call input's saveImageGeometry. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Default method to call input's saveImageGeometry. More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Protected Member Functions

 AtpTileSource ()
 
 AtpTileSource (ossimConnectableObject::ConnectableObjectList &inputSources)
 
virtual void allocate ()
 
void filterWithParallax ()
 
void computeParallax ()
 
void computeParallaxStatistics ()
 
void filterWithoutParallax ()
 
void pruneList ()
 Caps the max number of TPs given the list, which is the list of filtered TPs for the tile. More...
 
void initializeStaticMembers ()
 
- Protected Member Functions inherited from ossimImageCombiner
virtual ~ossimImageCombiner ()
 
void precomputeBounds () const
 
- Protected Member Functions inherited from ossimImageSource
 ossimImageSource (const ossimImageSource &rhs)
 
const ossimImageSourceoperator= (const ossimImageSource &)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

std::shared_ptr< AtpGeneratorm_generator
 
AtpList m_tiePoints
 
ossimRefPtr< ossimImageDatam_tile
 
ParallaxInfo m_paxInfo
 
bool m_considerParallax
 
- Protected Attributes inherited from ossimImageCombiner
ossim_uint32 theLargestNumberOfInputBands
 
ossim_uint32 theInputToPassThrough
 
bool theHasDifferentInputs
 
ossimRefPtr< ossimImageDatatheNormTile
 
std::vector< ossimIrecttheFullResBounds
 
bool theComputeFullResBoundsFlag
 
ossim_uint32 theCurrentIndex
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Static Protected Attributes

static double s_minVectorResDiff = 0
 
static double s_maxDiffRatio = 1.0
 
static double s_cosMaxAngleDiff = 0
 
static double s_maxPaxDev = 1.0
 
static double s_maxPaxPix = 2.0
 
static unsigned int s_minNumConsistent = 3
 
static unsigned int s_percentConsistent = 50
 
static unsigned int s_numTpsPerTile = 2
 
static bool s_useRasterMode = false
 
static bool s_initialized = false
 
static unsigned int s_numFilterIterations = 0
 

Additional Inherited Members

- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Detailed Description

Base class for tile sources performing auto tie point extraction.

Implemented as a combiner that establishes the overlap between input sources, and computes tie-points in the getTile() call.

Definition at line 26 of file AtpTileSource.h.

Constructor & Destructor Documentation

◆ AtpTileSource() [1/3]

ATP::AtpTileSource::AtpTileSource ( AtpGenerator generator)

Definition at line 44 of file AtpTileSource.cpp.

References ossimListenerManager::addListener(), ossimConnectableObject::connectMyInputTo(), initialize(), m_generator, and ossimImageCombiner::theComputeFullResBoundsFlag.

45 : m_generator(generator),
46  m_considerParallax (true)
47 {
49  if (m_generator)
50  {
51  connectMyInputTo(0, m_generator->getRefChain().get());
52  connectMyInputTo(1, m_generator->getCmpChain().get());
53  }
55  initialize();
56 }
virtual bool addListener(ossimListener *listener)
std::shared_ptr< AtpGenerator > m_generator
Definition: AtpTileSource.h:85
virtual void initialize()
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.

◆ ~AtpTileSource()

virtual ATP::AtpTileSource::~AtpTileSource ( )
inlinevirtual

Definition at line 31 of file AtpTileSource.h.

31 {}

◆ AtpTileSource() [2/3]

ATP::AtpTileSource::AtpTileSource ( )
protected

Definition at line 32 of file AtpTileSource.cpp.

33 : m_considerParallax (true)
34 {
35 }

◆ AtpTileSource() [3/3]

ATP::AtpTileSource::AtpTileSource ( ossimConnectableObject::ConnectableObjectList inputSources)
protected

Definition at line 37 of file AtpTileSource.cpp.

38 : ossimImageCombiner(inputSources),
39  m_considerParallax (true)
40 
41 {
42 }

Member Function Documentation

◆ allocate()

void ATP::AtpTileSource::allocate ( )
protectedvirtual

Definition at line 70 of file AtpTileSource.cpp.

References ossimImageDataFactory::create(), ossimConnectableObject::getNumberOfInputs(), ossimImageData::initialize(), ossimImageDataFactory::instance(), m_tile, and ossimConnectableObject::theInputObjectList.

Referenced by ATP::ossimCorrelationSource::getTile(), and ATP::ossimDescriptorSource::getTile().

71 {
72  // The AtpTileSources cannot be relied on to return valid pixel data, since their main product
73  // are the tie points, not pixels. However, the tile is used to communicate scalar type, rect,
74  // and other tile metadata, so is still needed:
75  m_tile = NULL;
76  if ( getNumberOfInputs() > 1)
77  {
78  ossimImageSource* firstSource = dynamic_cast<ossimImageSource*>(theInputObjectList[0].get());
79  m_tile = ossimImageDataFactory::instance()->create(this, firstSource);
80  m_tile->initialize();
81  }
82 }
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > m_tile
Definition: AtpTileSource.h:87
ConnectableObjectList theInputObjectList
Holds a list of input objects.
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.

◆ computeParallax()

void ATP::AtpTileSource::computeParallax ( )
protected

Definition at line 261 of file AtpTileSource.cpp.

References ATP::AtpTileSource::ParallaxInfo::denom, ATP::AtpTileSource::ParallaxInfo::dx_dH, ATP::AtpTileSource::ParallaxInfo::dy_dH, ossimIrect::getCenter(), ossimDataObject::getDataObjectStatus(), ossimElevManager::getHeightAboveEllipsoid(), ossimImageData::getImageRectangle(), ossimGpt::hgt, ossimElevManager::instance(), ossimGpt::isHgtNan(), ossimImageGeometry::localToWorld(), m_generator, m_paxInfo, m_tiePoints, m_tile, ossim::nan(), OSSIM_STATUS_UNKNOWN, ATP::AtpTileSource::ParallaxInfo::parallaxSlope, ossimImageGeometry::worldToLocal(), ossimDpt::x, and ossimDpt::y.

Referenced by filterPoints().

262 {
263  // Use the point at tile center to establish reference ground point at two different elevations:
264  static const double DELTA_HEIGHT = 500.0;
265  ossimDpt vpt, ipt0, ipt1;
266  ossimGpt gpt0, gpt1;
267 
268  // Possible debug mode will not have a tile assigned:
270  m_tiePoints[0]->getRefViewPoint(vpt);
271  else
273  ossimImageGeometry *geom = m_generator->m_refIVT->getViewGeometry();
274  geom->localToWorld(vpt, gpt0);
275  if (gpt0.isHgtNan())
277  gpt1 = gpt0;
278  gpt1.hgt += DELTA_HEIGHT;
279 
280  // Determine dx/dh and dy/dh for ref image:
281  geom = m_generator->m_refIVT->getImageGeometry();
282  geom->worldToLocal(gpt0, ipt0);
283  geom->worldToLocal(gpt1, ipt1);
284  double dx_ref = (ipt1.x - ipt0.x);
285  double dy_ref = (ipt1.y - ipt0.y);
286 
287  // Determine dx/dh and dy/dh for cmp image:
288  geom = m_generator->m_cmpIVT->getImageGeometry();
289  geom->worldToLocal(gpt0, ipt0);
290  geom->worldToLocal(gpt1, ipt1);
291  double dx_cmp = (ipt1.x - ipt0.x);
292  double dy_cmp = (ipt1.y - ipt0.y);
293 
294  // Compute parallax direction REF-->CMP
295  m_paxInfo.dx_dH = dx_cmp - dx_ref;
296  m_paxInfo.dy_dH = dy_cmp - dy_ref;
297  if (m_paxInfo.dx_dH != 0)
298  {
301  }
302  else
303  {
306  }
307  //CINFO << "### dx_dH: " << m_paxInfo.dx_dH << endl; // TODO REMOVE
308  //CINFO << "### dy_dH: " << m_paxInfo.dy_dH << endl; // TODO REMOVE
309  //CINFO << "### parallaxSlope: " << m_paxInfo.parallaxSlope << endl; // TODO REMOVE
310 }
std::shared_ptr< AtpGenerator > m_generator
Definition: AtpTileSource.h:85
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
double y
Definition: ossimDpt.h:165
virtual ossimDataObjectStatus getDataObjectStatus() const
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
bool isHgtNan() const
Definition: ossimGpt.h:143
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
ParallaxInfo m_paxInfo
Definition: AtpTileSource.h:88
virtual double getHeightAboveEllipsoid(const ossimGpt &gpt)
virtual ossimIrect getImageRectangle() const
ossimRefPtr< ossimImageData > m_tile
Definition: AtpTileSource.h:87
Container class that holds both 2D transform and 3D projection information for an image Only one inst...
double x
Definition: ossimDpt.h:164
bool worldToLocal(const ossimGpt &world_pt, ossimDpt &local_pt) const
Exposes the 3D world-to-local image coordinate reverse projection.
void getCenter(ossimDpt &center_point) const
Definition: ossimIrect.cpp:672

◆ computeParallaxStatistics()

void ATP::AtpTileSource::computeParallaxStatistics ( )
protected

Definition at line 313 of file AtpTileSource.cpp.

References ATP::AtpTileSource::ParallaxInfo::denom, distance(), ATP::AtpTileSource::ParallaxInfo::distanceMap, ATP::AtpTileSource::ParallaxInfo::dx_dH, ATP::AtpTileSource::ParallaxInfo::dy_dH, m_paxInfo, m_tiePoints, ATP::AtpTileSource::ParallaxInfo::maxDistance, ATP::AtpTileSource::ParallaxInfo::parallaxOffset, ATP::AtpTileSource::ParallaxInfo::parallaxSlope, s_maxPaxDev, s_maxPaxPix, ossimDpt::x, and ossimDpt::y.

Referenced by filterWithParallax().

314 {
315  // Determining the parallax direction (slope) is easy. It is the offset (y-intercept) that
316  // depends on the collection of residuals.
317  // Use the point at tile center to establish dx/dH and dy/dH in view-space:
318  // Compute parallax slope and intercept:
319  ossimDpt residual;
320  if (m_paxInfo.dx_dH != 0.0)
321  {
322  // Compute parallax intercept using collection of all primary matches:
323  double sum_c_i = 0;
324  for (auto &tiePoint : m_tiePoints)
325  {
326  tiePoint->getVectorResidual(residual);
327  sum_c_i += residual.y - m_paxInfo.parallaxSlope * residual.x;
328  }
329  m_paxInfo.parallaxOffset = sum_c_i/m_tiePoints.size();
330  }
331 
332  // Compute statistics of residual vector distribution, saving individual distance samples:
333  m_paxInfo.distanceMap.clear();
334  double distance, sumDistance2=0.0;
335  for (auto &tiePoint : m_tiePoints)
336  {
337  tiePoint->getVectorResidual(residual);
338  if (m_paxInfo.dx_dH == 0)
339  distance = residual.x;
340  else if (m_paxInfo.dy_dH == 0)
341  distance = residual.y;
342  else
343  {
344  distance = fabs(m_paxInfo.parallaxOffset + m_paxInfo.parallaxSlope*residual.x - residual.y)/m_paxInfo.denom;
345  }
346  sumDistance2 += distance*distance;
347  m_paxInfo.distanceMap.emplace(tiePoint->getTiePointId(), distance);
348  //CINFO << "### TP: "<<tiePoint->getTiePointId()<<" distance: " << distance << endl; // TODO REMOVE
349 
350  }
351  double sigmaDistance = sqrt(sumDistance2/(m_tiePoints.size()-1));
352  m_paxInfo.maxDistance = s_maxPaxDev*sigmaDistance;
355 
356  //CINFO << "### sigmaDistance: " << sigmaDistance << endl; // TODO REMOVE
357  //CINFO << "### maxDistance: " << m_paxInfo.maxDistance << endl; // TODO REMOVE
358 }
double y
Definition: ossimDpt.h:165
std::map< std::string, double > distanceMap
Definition: AtpTileSource.h:66
ParallaxInfo m_paxInfo
Definition: AtpTileSource.h:88
double x
Definition: ossimDpt.h:164
static double s_maxPaxPix
Definition: AtpTileSource.h:96
float distance(double lat1, double lon1, double lat2, double lon2, int units)
static double s_maxPaxDev
Definition: AtpTileSource.h:95

◆ filterPoints()

void ATP::AtpTileSource::filterPoints ( )

Definition at line 84 of file AtpTileSource.cpp.

References ossim::JsonParam::asBool(), CINFO, computeParallax(), ossim::JsonConfig::diagnosticLevel(), ATP::AtpTileSource::ParallaxInfo::dx_dH, ATP::AtpTileSource::ParallaxInfo::dy_dH, filterWithoutParallax(), filterWithParallax(), ossim::JsonConfig::getParameter(), ATP::AtpConfig::instance(), m_considerParallax, m_generator, m_paxInfo, m_tiePoints, ossim::JsonConfig::paramExists(), pruneList(), s_minNumConsistent, s_numFilterIterations, and s_useRasterMode.

Referenced by ATP::ossimCorrelationSource::getTile(), ATP::ossimDescriptorSource::getTile(), and main().

85 {
86  const char* MODULE = "AtpTileSource::filterPoints() -- ";
87  AtpConfig& config = AtpConfig::instance();
88 
89  // First remove points with no matches:
90  auto tiePoint = m_tiePoints.begin();
91  while (tiePoint != m_tiePoints.end())
92  {
93  if ((*tiePoint) && (*tiePoint)->hasValidMatch())
94  ++tiePoint;
95  else
96  tiePoint = m_tiePoints.erase(tiePoint);
97  }
98 
99  // No filtering done for raster mode:
100  if (s_useRasterMode)
101  return;
102 
103  if (config.diagnosticLevel(3))
104  {
105  // Annotate red before filtering:
106  m_generator->m_annotatedRefImage->annotateResiduals(m_tiePoints, 255, 0, 0);
107  m_generator->m_annotatedCmpImage->annotateCorrelations(m_tiePoints, 255, 0, 0);
108  }
109 
110  // Check for consistency check override
111  if (s_minNumConsistent == 0)
112  return;
113 
114  // Don't accept any if there are an insufficient number of neighbors:
115  if (m_tiePoints.size() < s_minNumConsistent)
116  {
117  m_tiePoints.clear();
118  return;
119  }
120 
121  if (config.paramExists("considerParallax"))
122  m_considerParallax = config.getParameter("considerParallax").asBool();
123  if (m_considerParallax)
124  {
125  // If the perspective differences are small, fall back to non-parallax check:
126  computeParallax();
127  if ((fabs(m_paxInfo.dx_dH) < 1.0) && (fabs(m_paxInfo.dy_dH) < 1.0))
128  {
129  if (config.diagnosticLevel(5))
130  CINFO << MODULE << "Insignificant parallax, falling back to non-parallax filtering."
131  << endl;
133  }
134  else
135  {
138  }
139  }
140  else
142 
143  if (config.diagnosticLevel(3))
144  {
145  // Annotate yellow before pruning:
146  m_generator->m_annotatedRefImage->annotateResiduals(m_tiePoints, 255, 255, 0);
147  m_generator->m_annotatedCmpImage->annotateCorrelations(m_tiePoints, 255, 255, 0);
148  }
149 
150  pruneList();
151 
152  if (config.diagnosticLevel(2))
153  {
154  CINFO<<MODULE<<"After filtering & pruning: num TPs in tile = "<<m_tiePoints.size()<<endl;
155  if (config.diagnosticLevel(3))
156  {
157  // Annotate Green after accepting TP:
158  m_generator->m_annotatedRefImage->annotateResiduals(m_tiePoints, 0, 255, 0);
159  m_generator->m_annotatedCmpImage->annotateCorrelations(m_tiePoints, 0, 255, 0);
160  //m_annotatedRefImage->annotateTPIDs(m_tiePoints, 180, 180, 0);
161  }
162  }
163 }
std::shared_ptr< AtpGenerator > m_generator
Definition: AtpTileSource.h:85
static bool s_useRasterMode
static unsigned int s_minNumConsistent
Definition: AtpTileSource.h:97
ParallaxInfo m_paxInfo
Definition: AtpTileSource.h:88
void pruneList()
Caps the max number of TPs given the list, which is the list of filtered TPs for the tile...
static unsigned int s_numFilterIterations
static AtpConfig & instance()
Singleton implementation.
Definition: AtpConfig.cpp:20
#define CINFO

◆ filterWithoutParallax()

void ATP::AtpTileSource::filterWithoutParallax ( )
protected

Definition at line 360 of file AtpTileSource.cpp.

References CINFO, ossim::JsonConfig::diagnosticLevel(), ATP::AtpConfig::instance(), ossimDpt::length(), m_tiePoints, s_cosMaxAngleDiff, s_maxDiffRatio, s_minNumConsistent, s_minVectorResDiff, s_percentConsistent, ossimDpt::x, and ossimDpt::y.

Referenced by filterPoints().

361 {
362  const char* MODULE = "AtpTileSource::filterWithoutParallax() ";
363  AtpConfig& config = AtpConfig::instance();
364 
365  // Loop to eliminate bad peaks and inconsistent ATPs in tile:
366  auto tiePoint = m_tiePoints.begin();
367  while (tiePoint != m_tiePoints.end())
368  {
369  // The "tiepoint" may not have any matches -- it may be just a feature:
370  ossimDpt r_atp, r_nbr;
371  (*tiePoint)->getVectorResidual(r_atp);
372 
373  if (config.diagnosticLevel(5))
374  {
375  ossimDpt refPt;
376  (*tiePoint)->getRefImagePoint(refPt);
377  CINFO<<"AutoTiePoint::checkConsistency() -- Processing TP "<<(*tiePoint)->getTiePointId()
378  <<" at REF image pt: ("<<refPt.x<<", "<<refPt.y<<")"<<endl;
379  }
380 
381  // Loop over all of the TPs neighbors to count the number that are consistent:
382  unsigned int num_consistent_neighbors = 0;
383  for(auto &neighbor : m_tiePoints)
384  {
385  if ((*tiePoint)->getTiePointId() == neighbor->getTiePointId())
386  continue;
387 
388  // Check for simple minimum vector difference:
389  neighbor->getVectorResidual(r_nbr);
390  double diff = (r_nbr - r_atp).length();
391  if (diff < s_minVectorResDiff)
392  {
393  num_consistent_neighbors++;;
394  continue;
395  }
396 
397  // Compute angle and magnitude ratio between residuals. Note no check for valid peak:
398  double cos_theta=1.0, mag_ratio=0;
399  double r0 = r_atp.length();
400  double r1 = r_nbr.length();
401  mag_ratio = 2.0*fabs(r1-r0)/(r0+r1);
402  if ((r1 > 0.0) && (r0 > 0.0))
403  cos_theta = (r_atp.x*r_nbr.x + r_atp.y*r_nbr.y)/(r0*r1);
404 
405  // Test for consistency with this neighbor's peak:
406  if ((mag_ratio < s_maxDiffRatio) && (cos_theta > s_cosMaxAngleDiff))
407  num_consistent_neighbors++;;
408  }
409 
410  // Decide if this peak was good or out there:
411  int minConsistent = (int) ceil(s_percentConsistent*(m_tiePoints.size()-1)/100);
412  if (minConsistent < (int)s_minNumConsistent)
413  minConsistent = s_minNumConsistent;
414  if (num_consistent_neighbors < minConsistent)
415  {
416  // Peak was bad, fetch next strongest match or exit loop if no more available:
417  if (!(*tiePoint)->bumpActiveMatch())
418  {
419  if (config.diagnosticLevel(5))
420  CINFO << MODULE << "Removing TP " << (*tiePoint)->getTiePointId() << endl;
421  tiePoint = m_tiePoints.erase(tiePoint);
422  if (m_tiePoints.empty())
423  break;
424  }
425  }
426  else
427  {
428  // Match is consistent, keep the tiepoint in the list an advance to the next tiepoint
429  tiePoint++;
430  }
431  }
432 }
double y
Definition: ossimDpt.h:165
double length() const
Definition: ossimDpt.h:81
static unsigned int s_minNumConsistent
Definition: AtpTileSource.h:97
static double s_maxDiffRatio
Definition: AtpTileSource.h:93
static unsigned int s_percentConsistent
Definition: AtpTileSource.h:98
static double s_minVectorResDiff
Definition: AtpTileSource.h:92
static double s_cosMaxAngleDiff
Definition: AtpTileSource.h:94
double x
Definition: ossimDpt.h:164
static AtpConfig & instance()
Singleton implementation.
Definition: AtpConfig.cpp:20
#define CINFO

◆ filterWithParallax()

void ATP::AtpTileSource::filterWithParallax ( )
protected

Definition at line 165 of file AtpTileSource.cpp.

References CINFO, computeParallaxStatistics(), ATP::AtpTileSource::ParallaxInfo::denom, ossim::JsonConfig::diagnosticLevel(), distance(), ATP::AtpTileSource::ParallaxInfo::distanceMap, ATP::AtpTileSource::ParallaxInfo::dx_dH, ATP::AtpConfig::instance(), m_paxInfo, m_tiePoints, ATP::AtpTileSource::ParallaxInfo::maxDistance, ATP::AtpTileSource::ParallaxInfo::parallaxOffset, ATP::AtpTileSource::ParallaxInfo::parallaxSlope, s_maxPaxPix, s_numFilterIterations, ossimDpt::x, and ossimDpt::y.

Referenced by filterPoints().

166 {
167  // May be called recursively, limited by s_numFilterIterations < 5
168 
169  const char* MODULE = "AtpTileSource::filterWithParallax() ";
170  AtpConfig& config = AtpConfig::instance();
171  if (m_tiePoints.size() < 2)
172  {
173  m_tiePoints.clear();
174  return;
175  }
176 
178 
179  // This is where recursion is stopped:
181  {
182  m_tiePoints.clear();
183  if (config.diagnosticLevel(5))
184  {
185  CINFO << MODULE << "Could not establish good parallax statistics for this set. "
186  << "Removing all points for this tile." << endl;
187  }
188  return;
189  }
190 
191  // Loop to eliminate bad peaks and inconsistent ATPs in tile:
192  ossimDpt residual;
193  bool statsChanged = false;
194  auto tiePoint = m_tiePoints.begin();
195  while (tiePoint != m_tiePoints.end())
196  {
197  // Check point's active peak against the set of residuals along parallax:
198  auto entry = m_paxInfo.distanceMap.find((*tiePoint)->getTiePointId());
199  if (entry == m_paxInfo.distanceMap.end())
200  { // Should never happen
201  tiePoint = m_tiePoints.erase(tiePoint);
202  continue;
203  }
204  double distance = entry->second;
205 
206  // Loop to find a match in this ATP that is consistent.
207  while (distance > m_paxInfo.maxDistance)
208  {
209  // This residual is outside the acceptable limit, try the next match in the tiepoint or
210  // remove it if it has no more peaks.
211  statsChanged = true;
212  if (!(*tiePoint)->bumpActiveMatch())
213  {
214  if (config.diagnosticLevel(5))
215  {
216  CINFO << MODULE << "Removing TP " << (*tiePoint)->getTiePointId() << endl;
217  CINFO << " distance: " << distance << ", maxDistance: " << m_paxInfo.maxDistance << endl;
218  }
219  tiePoint = m_tiePoints.erase(tiePoint);
220  break;
221  }
222  else if (config.diagnosticLevel(5))
223  {
224  CINFO << MODULE << "Bumping active match for TP " << (*tiePoint)->getTiePointId()
225  << endl;
226  CINFO << " distance: " << distance << ", maxDistance: " << m_paxInfo.maxDistance << endl;
227  }
228 
229  // A new peak is being used, will need to recompute statistics later.
230  (*tiePoint)->getVectorResidual(residual);
231  if (m_paxInfo.dx_dH == 0.0)
232  distance = residual.x;
233  else if (m_paxInfo.dx_dH == 0.0)
234  distance = residual.y;
235  else
236  {
238  residual.y) / m_paxInfo.denom;
239  }
240  }
242  {
243  // The match was deemed consistent. proceed to next point:
244  ++tiePoint;
245  }
246  }
247 
248  if (statsChanged)
249  {
250  // Recursive call to recompute statistics and eliminate suspect points
252  if (config.diagnosticLevel(5))
253  {
254  CINFO << MODULE << "Iterating filterWithParallax after ATP list change (N = "
255  << s_numFilterIterations << ")."<< endl;
256  }
258  }
259 }
double y
Definition: ossimDpt.h:165
std::map< std::string, double > distanceMap
Definition: AtpTileSource.h:66
ParallaxInfo m_paxInfo
Definition: AtpTileSource.h:88
static unsigned int s_numFilterIterations
void computeParallaxStatistics()
double x
Definition: ossimDpt.h:164
static AtpConfig & instance()
Singleton implementation.
Definition: AtpConfig.cpp:20
static double s_maxPaxPix
Definition: AtpTileSource.h:96
float distance(double lat1, double lon1, double lat2, double lon2, int units)
#define CINFO

◆ getNumberOfOutputBands()

virtual ossim_uint32 ATP::AtpTileSource::getNumberOfOutputBands ( ) const
inlinevirtual

Returns the number of bands in a tile returned from this TileSource.

Reimplemented from ossimImageSource.

Definition at line 48 of file AtpTileSource.h.

48 { return 2; }

◆ getOutputScalarType()

virtual ossimScalarType ATP::AtpTileSource::getOutputScalarType ( ) const
inlinevirtual

This will be used to query the output pixel type of the tile source.

Please ignore the argument. It will soon be removed.

Reimplemented from ossimImageCombiner.

Definition at line 47 of file AtpTileSource.h.

References OSSIM_DOUBLE.

47 { return OSSIM_DOUBLE; }
64 bit floating point

◆ getTiePoints()

AtpList& ATP::AtpTileSource::getTiePoints ( )
inline

This list resets with every getTile() call , so make sure tiepoints from previous getTile() calls are being accumulated.

Definition at line 45 of file AtpTileSource.h.

45 { return m_tiePoints; }

◆ getTile()

virtual ossimRefPtr<ossimImageData> ATP::AtpTileSource::getTile ( const ossimIrect origin,
ossim_uint32  rLevel = 0 
)
pure virtual

Derived classes implement their particular tiepoint matching algorithms for the requested tile.

It is not clear what the output tile needs to be, since the product of this filter is the list of tiepoints (available through the getTiePoints() method). Recommend simply passing through the corresponding REF image tile.

Reimplemented from ossimImageSource.

Implemented in ATP::ossimCorrelationSource, and ATP::ossimDescriptorSource.

◆ initialize()

void ATP::AtpTileSource::initialize ( )
virtual

Reimplemented from ossimImageCombiner.

Reimplemented in ATP::ossimCorrelationSource, and ATP::ossimDescriptorSource.

Definition at line 58 of file AtpTileSource.cpp.

References ossimConnectableObject::getNumberOfInputs(), ossimImageCombiner::initialize(), initializeStaticMembers(), m_tiePoints, and s_initialized.

Referenced by AtpTileSource(), ATP::ossimDescriptorSource::initialize(), and ATP::ossimCorrelationSource::initialize().

59 {
60  const char* MODULE = "AtpTileSource::initialize() -- ";
61  if (!s_initialized)
63 
65  m_tiePoints.clear();
66  if ( getNumberOfInputs() < 2)
67  return;
68 }
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
static bool s_initialized

◆ initializeStaticMembers()

void ATP::AtpTileSource::initializeStaticMembers ( )
protected

Definition at line 473 of file AtpTileSource.cpp.

References ossim::JsonParam::asBool(), ossim::JsonParam::asFloat(), ossim::JsonParam::asUint(), ossim::cosd(), CWARN, ossim::JsonConfig::getParameter(), ATP::AtpConfig::instance(), ossim::isnan(), ossim::JsonConfig::paramExists(), s_cosMaxAngleDiff, s_initialized, s_maxDiffRatio, s_maxPaxDev, s_maxPaxPix, s_minNumConsistent, s_minVectorResDiff, s_numTpsPerTile, s_percentConsistent, and s_useRasterMode.

Referenced by initialize().

474 {
475  static const char* MODULE = "AtpTileSource::initializeStaticMembers() -- ";
476 
477  AtpConfig& config = AtpConfig::instance();
478  s_maxDiffRatio = config.getParameter("maxResMagDiffRatio").asFloat();
480  {
481  CWARN<<MODULE<<"Bad or missing parameter in config: "
482  "maxResMagDiffRatio = "<<s_maxDiffRatio<<". Defaulting to 0.1."<<endl;
483  s_maxDiffRatio = 0.1;
484  }
485 
486  double theta = config.getParameter("maxResAngleDiff").asFloat();
487  if (ossim::isnan(theta) || (theta <= 0))
488  {
489  CWARN<<MODULE<<"Bad or missing parameter in config: "
490  "maxAngleDiff = "<<theta<<". Defaulting to 10 deg."<<endl;
491  theta = 10.0;
492  }
494 
495  s_minVectorResDiff = config.getParameter("minVectorResDiff").asFloat();
497  {
498  CWARN<<MODULE<<"Bad or missing parameter in config: "
499  "minVectorResDiff = "<<s_minVectorResDiff<<". Defaulting to 1.0."<<endl;
500  s_minVectorResDiff = 1.0;
501  }
502 
503  s_minNumConsistent = config.getParameter("minNumConsistentNeighbors").asUint();
504  if (s_minNumConsistent == 0)
505  {
506  CWARN<<MODULE<<"Bad or missing parameter in config: "
507  "minNumConsistentNeighbors = "<<s_minNumConsistent<<". Defaulting to 3."<<endl;
508  s_minNumConsistent = 3.0;
509  }
510 
511  s_percentConsistent = config.getParameter("percentConsistentThreshold").asUint();
512  if (s_percentConsistent == 0)
513  {
514  CWARN<<MODULE<<"Bad or missing parameter in config: "
515  "percentConsistentThreshold = "<<s_percentConsistent<<". Defaulting to 50."<<endl;
516  s_percentConsistent = 50;
517  }
518 
519  s_numTpsPerTile = config.getParameter("numTiePointsPerTile").asUint();
520  if (s_numTpsPerTile == 0)
521  {
522  CWARN<<MODULE<<"Bad or missing parameter in config: "
523  "numTiePointsPerTile = "<<s_numTpsPerTile<<". Defaulting to 2."<<endl;
524  s_numTpsPerTile = 2;
525  }
526 
527  s_maxPaxDev = config.getParameter("maxResParallaxDev").asFloat();
528  if (ossim::isnan(s_maxPaxDev) || (s_maxPaxDev <= 0))
529  {
530  CWARN<<MODULE<<"Bad or missing parameter in config: "
531  "maxResParallaxDev = "<<s_maxPaxDev<<". Defaulting to 1.0."<<endl;
532  s_maxPaxDev = 1.0;
533  }
534 
535  s_maxPaxPix = (double) config.getParameter("maxResParallaxPix").asUint();
536  if (ossim::isnan(s_maxPaxPix) || (s_maxPaxPix <= 0))
537  {
538  CWARN<<MODULE<<"Bad or missing parameter in config: "
539  "maxResParallaxPix = "<<s_maxPaxPix<<". Defaulting to 1.0."<<endl;
540  s_maxPaxPix = 2.0;
541  }
542 
543  if (config.paramExists("useRasterMode"))
544  s_useRasterMode = config.getParameter("useRasterMode").asBool();
545 
546  s_initialized = true;
547 }
static bool s_useRasterMode
static unsigned int s_minNumConsistent
Definition: AtpTileSource.h:97
static double s_maxDiffRatio
Definition: AtpTileSource.h:93
static unsigned int s_percentConsistent
Definition: AtpTileSource.h:98
static double s_minVectorResDiff
Definition: AtpTileSource.h:92
double cosd(double x)
Definition: ossimCommon.h:259
static unsigned int s_numTpsPerTile
Definition: AtpTileSource.h:99
static double s_cosMaxAngleDiff
Definition: AtpTileSource.h:94
static AtpConfig & instance()
Singleton implementation.
Definition: AtpConfig.cpp:20
static double s_maxPaxPix
Definition: AtpTileSource.h:96
static bool s_initialized
#define CWARN
static double s_maxPaxDev
Definition: AtpTileSource.h:95
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ pruneList()

void ATP::AtpTileSource::pruneList ( )
protected

Caps the max number of TPs given the list, which is the list of filtered TPs for the tile.

Definition at line 435 of file AtpTileSource.cpp.

References CWARN, ATP::AtpConfig::instance(), m_tiePoints, and s_numTpsPerTile.

Referenced by filterPoints().

436 {
437  const char* MODULE = "AtpTileSource::pruneList() ";
438  AtpConfig &config = AtpConfig::instance();
439 
440  // Use a map to sort by confidence measure:
441  multimap<double, shared_ptr<AutoTiePoint> > atpMap;
442  auto atp = m_tiePoints.begin();
443  double confidence;
444  while (atp != m_tiePoints.end())
445  {
446  if (!(*atp)) // Should never happen
447  {
448  CWARN<<MODULE<<"WARNING: Null AutoTiePoint encountred in list. Skipping point."<<endl;
449  ++atp;
450  continue;
451  }
452 
453  // The "tiepoint" may not have any matches -- it may be just a feature:
454  bool hasValidMatch = (*atp)->getConfidenceMeasure(confidence);
455  if (hasValidMatch)
456  atpMap.emplace(1.0/confidence, *atp);
457 
458  atp++;
459  }
460 
461  // Skim off the top best:
462  m_tiePoints.clear();
463  multimap<double, shared_ptr<AutoTiePoint> >::iterator tp = atpMap.begin();
464  while (tp != atpMap.end())
465  {
466  m_tiePoints.push_back(tp->second);
467  if (m_tiePoints.size() == s_numTpsPerTile)
468  break;
469  tp++;
470  }
471 }
static unsigned int s_numTpsPerTile
Definition: AtpTileSource.h:99
static AtpConfig & instance()
Singleton implementation.
Definition: AtpConfig.cpp:20
#define CWARN

◆ setTiePoints()

void ATP::AtpTileSource::setTiePoints ( ossim::TiePointList atpList)

Used for testing.

Definition at line 549 of file AtpTileSource.cpp.

References m_generator, and m_tiePoints.

Referenced by main().

550 {
551  // Engineering code for manually specifying TPs to test consistency checking
552  string id;
553  ossimDpt rip, cip;
554  NEWMAT::SymmetricMatrix cov;
555  m_tiePoints.clear();
556  for (auto &tp : tpList)
557  {
558  shared_ptr<AutoTiePoint> atp (new AutoTiePoint(m_generator, tp->getTiePointId()));
559  tp->getImagePoint(0,id,rip,cov);
560  tp->getImagePoint(1,id,cip,cov);
561  atp->setRefImagePt(rip);
562  atp->addImageMatch(cip);
563  m_tiePoints.emplace_back(atp);
564  }
565 }
std::shared_ptr< AtpGenerator > m_generator
Definition: AtpTileSource.h:85

Member Data Documentation

◆ m_considerParallax

bool ATP::AtpTileSource::m_considerParallax
protected

Definition at line 89 of file AtpTileSource.h.

Referenced by filterPoints().

◆ m_generator

std::shared_ptr<AtpGenerator> ATP::AtpTileSource::m_generator
protected

◆ m_paxInfo

ParallaxInfo ATP::AtpTileSource::m_paxInfo
protected

◆ m_tiePoints

AtpList ATP::AtpTileSource::m_tiePoints
protected

◆ m_tile

ossimRefPtr<ossimImageData> ATP::AtpTileSource::m_tile
protected

◆ s_cosMaxAngleDiff

double ATP::AtpTileSource::s_cosMaxAngleDiff = 0
staticprotected

Definition at line 94 of file AtpTileSource.h.

Referenced by filterWithoutParallax(), and initializeStaticMembers().

◆ s_initialized

bool ATP::AtpTileSource::s_initialized = false
staticprotected

Definition at line 101 of file AtpTileSource.h.

Referenced by initialize(), and initializeStaticMembers().

◆ s_maxDiffRatio

double ATP::AtpTileSource::s_maxDiffRatio = 1.0
staticprotected

Definition at line 93 of file AtpTileSource.h.

Referenced by filterWithoutParallax(), and initializeStaticMembers().

◆ s_maxPaxDev

double ATP::AtpTileSource::s_maxPaxDev = 1.0
staticprotected

Definition at line 95 of file AtpTileSource.h.

Referenced by computeParallaxStatistics(), and initializeStaticMembers().

◆ s_maxPaxPix

double ATP::AtpTileSource::s_maxPaxPix = 2.0
staticprotected

◆ s_minNumConsistent

unsigned int ATP::AtpTileSource::s_minNumConsistent = 3
staticprotected

Definition at line 97 of file AtpTileSource.h.

Referenced by filterPoints(), filterWithoutParallax(), and initializeStaticMembers().

◆ s_minVectorResDiff

double ATP::AtpTileSource::s_minVectorResDiff = 0
staticprotected

Definition at line 92 of file AtpTileSource.h.

Referenced by filterWithoutParallax(), and initializeStaticMembers().

◆ s_numFilterIterations

unsigned int ATP::AtpTileSource::s_numFilterIterations = 0
staticprotected

Definition at line 102 of file AtpTileSource.h.

Referenced by filterPoints(), and filterWithParallax().

◆ s_numTpsPerTile

unsigned int ATP::AtpTileSource::s_numTpsPerTile = 2
staticprotected

Definition at line 99 of file AtpTileSource.h.

Referenced by initializeStaticMembers(), and pruneList().

◆ s_percentConsistent

unsigned int ATP::AtpTileSource::s_percentConsistent = 50
staticprotected

Definition at line 98 of file AtpTileSource.h.

Referenced by filterWithoutParallax(), and initializeStaticMembers().

◆ s_useRasterMode

bool ATP::AtpTileSource::s_useRasterMode = false
staticprotected

Definition at line 100 of file AtpTileSource.h.

Referenced by filterPoints(), and initializeStaticMembers().


The documentation for this class was generated from the following files: