OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ATP::ossimDescriptorSource Class Reference

Finds auto-tie-points using the descriptor-based matching algorithm. More...

#include <ossimDescriptorSource.h>

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

Classes

struct  SortFunc
 

Public Member Functions

 ossimDescriptorSource (AtpGenerator *generator)
 
virtual ~ossimDescriptorSource ()
 
virtual void initialize ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &origin, ossim_uint32 rLevel=0)
 Derived classes implement their particular tiepoint matching algorithms for the requested tile. More...
 
- Public Member Functions inherited from ATP::AtpTileSource
 AtpTileSource (AtpGenerator *generator)
 
virtual ~AtpTileSource ()
 
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
 

Private Member Functions

 ossimDescriptorSource ()
 
 ossimDescriptorSource (ossimConnectableObject::ConnectableObjectList &inputSources)
 

Private Attributes

struct ATP::ossimDescriptorSource::SortFunc sortFunc
 
unsigned int m_cmpPatchInflation
 

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
 
- Protected Member Functions inherited from ATP::AtpTileSource
 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 inherited from ATP::AtpTileSource
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 inherited from ATP::AtpTileSource
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
 

Detailed Description

Finds auto-tie-points using the descriptor-based matching algorithm.

Definition at line 23 of file ossimDescriptorSource.h.

Constructor & Destructor Documentation

◆ ossimDescriptorSource() [1/3]

ATP::ossimDescriptorSource::ossimDescriptorSource ( AtpGenerator generator)

Definition at line 32 of file ossimDescriptorSource.cpp.

33 : AtpTileSource(generator)
34 {
35  // PRIVATE, SHOULD NEVER BE CALLED. WOULD NEED TO CALL INITIALIZE
36 }

◆ ~ossimDescriptorSource()

ATP::ossimDescriptorSource::~ossimDescriptorSource ( )
virtual

Definition at line 38 of file ossimDescriptorSource.cpp.

39 {
40 }

◆ ossimDescriptorSource() [2/3]

ATP::ossimDescriptorSource::ossimDescriptorSource ( )
private

Definition at line 21 of file ossimDescriptorSource.cpp.

22 {
23  // PRIVATE, SHOULD NEVER BE CALLED. WOULD NEED TO CALL INITIALIZE
24 }

◆ ossimDescriptorSource() [3/3]

ATP::ossimDescriptorSource::ossimDescriptorSource ( ossimConnectableObject::ConnectableObjectList inputSources)
private

Definition at line 26 of file ossimDescriptorSource.cpp.

References initialize().

27 : AtpTileSource(inputSources)
28 {
29  initialize();
30 }

Member Function Documentation

◆ getTile()

ossimRefPtr< ossimImageData > ATP::ossimDescriptorSource::getTile ( const ossimIrect origin,
ossim_uint32  rLevel = 0 
)
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.

Implements ATP::AtpTileSource.

Definition at line 69 of file ossimDescriptorSource.cpp.

References ATP::AtpTileSource::allocate(), ossim::JsonParam::asString(), ossim::JsonParam::asUint(), CINFO, ATP::convertToIpl(), CWARN, ossim::JsonConfig::diagnosticLevel(), ossimIrect::expand(), ATP::AtpTileSource::filterPoints(), ossimRefPtr< T >::get(), ossimDataObject::getDataObjectStatus(), ossimConnectableObject::getNumberOfInputs(), ossim::JsonConfig::getParameter(), ATP::AtpConfig::instance(), m_cmpPatchInflation, ATP::AtpTileSource::m_generator, ATP::AtpTileSource::m_tiePoints, ATP::AtpTileSource::m_tile, n, OSSIM_EMPTY, ossim::JsonConfig::paramExists(), ossimImageData::setImageRectangle(), sortFunc, ossimString::upcase(), and ossimImageData::write().

71 {
72  static const char* MODULE = "ossimDescriptorSource::getTile() ";
73  AtpConfig& config = AtpConfig::instance();
74 
75  if (config.diagnosticLevel(2))
76  CINFO<<"\n\n"<< MODULE << " -- tileRect: "<<tileRect<<endl;
77  m_tiePoints.clear();
78  if (!m_tile)
79  allocate();
80 
81  // The tile rect (in view space) is referenced by the tiepoint filtering code:
82  m_tile->setImageRectangle(tileRect);
83 
84  // Make sure there are at least two images as input.
85  if(getNumberOfInputs() < 2)
86  {
87  CINFO << MODULE << " ERROR: wrong number of inputs " << getNumberOfInputs() << " when expecting at least 2 \n";
88  return 0;
89  }
90 
91  // The tileRect passed in is in a common map-projected view space. Need to transform the rect
92  // into image space for both ref and cmp images:
93  ossimIrect cmpViewRect (tileRect);
94  cmpViewRect.expand(ossimIpt(m_cmpPatchInflation, m_cmpPatchInflation));
95  ossimIrect refRect (m_generator->getRefIVT()->getViewToImageBounds(tileRect));
96  ossimIrect cmpRect (m_generator->getCmpIVT()->getViewToImageBounds(cmpViewRect));
97 
98  // Retrieve both the ref and cmp image data
99  ossimRefPtr<ossimImageData> ref_tile = m_generator->getRefChain()->getTile(refRect, resLevel);
100  if (ref_tile->getDataObjectStatus() == OSSIM_EMPTY)
101  {
102  CWARN << MODULE << " ERROR: could not get REF tile with rect " << refRect << "\n";
103  return m_tile;
104  }
105  if (config.diagnosticLevel(5))
106  ref_tile->write("REF_TILE.RAS");
107 
108 
109  ossimRefPtr<ossimImageData> cmp_tile = m_generator->getCmpChain()->getTile(cmpRect, resLevel);
110  if (cmp_tile->getDataObjectStatus() == OSSIM_EMPTY)
111  {
112  CWARN << MODULE << " ERROR: could not get CMP tile with rect " << cmpRect << "\n";
113  return m_tile;
114  }
115  if (config.diagnosticLevel(5))
116  cmp_tile->write("CMP_TILE.RAS");
117 
118  //m_tile = ref_tile;
119 
120  // Convert both into OpenCV Mat objects using the Ipl image.
121  IplImage* refImage = convertToIpl(ref_tile.get());
122  IplImage* cmpImage = convertToIpl(cmp_tile.get());
123  cv::Mat queryImg = cv::cvarrToMat(refImage);
124  cv::Mat trainImg = cv::cvarrToMat(cmpImage);
125 
126  // Get the KeyPoints using appropriate descriptor.
127  vector<cv::KeyPoint> kpA;
128  vector<cv::KeyPoint> kpB;
129  cv::Mat desA;
130  cv::Mat desB;
131 
132  ossimString descriptorType (config.getParameter("descriptor").asString());
133  descriptorType.upcase();
134 
135  // Search for features and compute descriptors for all:
136  cv::Ptr<cv::Feature2D> detector;
137  if(descriptorType == "AKAZE")
138  detector = cv::AKAZE::create();
139  else if(descriptorType == "KAZE")
140  detector = cv::KAZE::create();
141  else if(descriptorType == "ORB")
142  detector = cv::ORB::create();
143  else if(descriptorType == "SURF")
144  detector = cv::xfeatures2d::SURF::create();
145  else if(descriptorType == "SIFT")
146  detector = cv::xfeatures2d::SIFT::create();
147  else
148  {
149  CWARN << MODULE << " WARNING: No such descriptor as " << descriptorType << "\n";
150  return m_tile;
151  }
152 
153 #if 1
154  detector->detectAndCompute(queryImg, cv::noArray(), kpA, desA);
155  detector->detectAndCompute(trainImg, cv::noArray(), kpB, desB);
156 
157 #else
158  // Separate detect and compute to limit the number of features for which descriptors are
159  // computed... Perform detection:
160  detector->detect(queryImg, kpA);
161  detector->detect(trainImg, kpB);
162 
163  //CINFO<<"\n -- Ref tileRect: "<<refRect<<endl;
164  //CINFO<<"\n -- Cmp tileRect: "<<cmpRect<<endl;
165  CINFO << "DETECTIONS: "<<kpA.size() << ", "<<kpB.size() << endl;//TODO REMOVE
166 
167  // Limit strongest detections to max number of features per tile on query image:
168  unsigned int maxNumFeatures = config.getParameter("numFeaturesPerTile").asUint();
169  //CINFO << "\n numFeatures= "<<maxNumFeatures << endl;
170  if (kpA.size() > maxNumFeatures)
171  {
172  sort(kpA.begin(), kpA.end(), sortFunc);
173  kpA.resize(maxNumFeatures);
174  }
175 
176  //if (kpB.size() > maxNumFeatures)
177  //{
178  // sort(kpB.begin(), kpB.end(), sortFunc);
179  // kpB.resize(maxNumFeatures);
180  //}
181  //CINFO << "\nTRIM:\n kpA.size = "<<kpA.size() << endl;
182  //CINFO << " kpb.size = "<<kpA.size() << endl;
183 
184  // Now perform descriptor computations on remaining features:
185  detector->compute(queryImg, kpA, desA);
186  detector->compute(trainImg, kpB, desB);
187  //CINFO << "\nCOMPUTE:\n desA.size = "<<desA.size() << endl;
188  //CINFO << " desB.size = "<<desB.size() << endl;
189 
190 #endif
191 
192  if (config.diagnosticLevel(5))
193  {
194  CINFO << "\nDETECT:\n kpA.size = " << kpA.size() << endl;
195  CINFO << " kpb.size = " << kpA.size() << endl;
196  CINFO << "\nCOMPUTE:\n desA.size = " << desA.size() << endl;
197  CINFO << " desB.size = " << desB.size() << endl;
198  }
199 
200  // Get the DPoints using the appropriate matcher.
201  std::vector< std::vector<cv::DMatch> > matches;
202  if(!(desA.empty() || desB.empty()))
203  {
204  std::string matcherType = config.getParameter("matcher").asString();
205  uint k = config.getParameter("maxNumMatchesPerFeature").asUint();
206  if (config.paramExists("k")) // support legacy keywords
207  k = config.getParameter("k").asUint();
208  if (kpA.size() < k)
209  k = kpA.size();
210  transform(matcherType.begin(), matcherType.end(), matcherType.begin(),::toupper);
211 
212  shared_ptr<cv::DescriptorMatcher> matcher;
213  if(matcherType == "FLANN")
214  {
215  if(desA.type()!=CV_32F)
216  desA.convertTo(desA, CV_32F);
217  if(desB.type()!=CV_32F)
218  desB.convertTo(desB, CV_32F);
219 
220  matcher.reset(new cv::FlannBasedMatcher);
221  }
222  else if(matcherType == "BF")
223  {
224  if(desA.type()!=CV_8U)
225  desA.convertTo(desA, CV_8U);
226  if(desB.type()!=CV_8U)
227  desB.convertTo(desB, CV_8U);
228 
229  int normType;
230  std::string ErrorFunction = config.getParameter("normType").asString();
231  if(ErrorFunction == "NORM_L1"){
232  normType = cv::NORM_L1;
233  } else if(ErrorFunction == "NORM_L2") {
234  normType = cv::NORM_L2;
235  } else if(ErrorFunction == "NORM_HAMMING") {
236  normType = cv::NORM_HAMMING;
237  } else {
238  std::string descriptorUsed = config.getParameter("descriptor").asString();
239  if(descriptorUsed == "SURF" || descriptorUsed == "SIFT"){
240  normType = cv::NORM_L2;
241  } else {
242  normType = cv::NORM_HAMMING;
243  }
244  }
245 
246  matcher.reset(new cv::BFMatcher(normType, true));
247  }
248  else
249  {
250  CWARN << MODULE << " WARNING: No such matcher as " << matcherType << "\n";
251  return m_tile;
252  }
253 
254  matcher->knnMatch(desA, desB, matches, k);
255  }
256 
257  float minDistance = INT_MAX;
258  float maxDistance = 0;
259 
260  // Find the highest distance to compute the relative confidence of each match
261  for (auto &featureMatches : matches)
262  {
263  for (auto &match : featureMatches)
264  {
265  if (minDistance >match.distance)
266  minDistance = match.distance;
267  if (maxDistance < match.distance)
268  maxDistance = match.distance;
269  }
270  }
271 
272  // Experimental: force min distance to be the perfect match case = 0:
273  minDistance = 0.0;
274  float delta = maxDistance - minDistance;
275 
276  // Sort the matches in order of strength (i.e., confidence) using stl map:
277  multimap<double, shared_ptr<AutoTiePoint> > tpMap;
278 
279  // Convert the openCV match points to something Atp could understand.
280  string sid(""); // Leave blank to have it auto-assigned by CorrelationTiePoint constructor
281 
282  for (auto &featureMatches : matches)
283  {
284  if (featureMatches.empty())
285  continue;
286 
287  shared_ptr<AutoTiePoint> atp (new AutoTiePoint(m_generator, sid));
288  cv::KeyPoint cv_A = kpA[(featureMatches[0]).queryIdx];
289  cv::KeyPoint cv_B;
290 
291  ossimDpt refImgPt (refRect.ul().x + cv_A.pt.x, refRect.ul().y + cv_A.pt.y);
292  atp->setRefImagePt(refImgPt);
293 
294  // Create the match points
295  double strength = 0;
296  for (auto &match : featureMatches)
297  {
298  cv_B = kpB[(match).trainIdx];
299  ossimDpt cmpImgPt (cmpRect.ul().x + cv_B.pt.x, cmpRect.ul().y + cv_B.pt.y);
300  double strength_j = 1.0 - (match.distance-minDistance)/delta;
301  if (strength_j > strength)
302  strength = strength_j;
303  atp->addImageMatch(cmpImgPt, strength_j);
304  }
305 
306  // Insert into sorted map using one's complement as key since in ascending order:
307  tpMap.insert(pair<double, shared_ptr<AutoTiePoint> >(1.0-strength, atp));
308  sid.clear();
309  }
310 
311  if (config.diagnosticLevel(2))
312  {
313  CINFO<<" Detections R,C: "<<kpA.size() << ", "<<kpB.size() << endl;//TODO REMOVE
314  CINFO<<" Matches (Before filtering): "<<matches.size()<<endl;
315 
316  }
317 
318  // Now skim off the best matches and copy them to the list being returned:
319  unsigned int N = config.getParameter("numFeaturesPerTile").asUint();
320  unsigned int n = 0;
321  auto tp_iter = tpMap.begin();
322  while ((tp_iter != tpMap.end()) && (n < N))
323  {
324  m_tiePoints.push_back(tp_iter->second);
325  tp_iter++;
326  n++;
327  }
328 
329  if (config.diagnosticLevel(2))
330  CINFO<<" After capping to max num features ("<<N<<"), num TPs in tile = "<<n<<endl;
331 
332  filterPoints();
333  return m_tile;
334 }
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
virtual void setImageRectangle(const ossimIrect &rect)
struct ATP::ossimDescriptorSource::SortFunc sortFunc
std::shared_ptr< AtpGenerator > m_generator
Definition: AtpTileSource.h:85
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual bool write(const ossimFilename &f) const
Writes tile to stream.
os2<< "> n<< " > nendobj n
ossimRefPtr< ossimImageData > m_tile
Definition: AtpTileSource.h:87
IplImage * convertToIpl(const ossimImageData *data)
Converts an ossimImageData pointer to an IplImage for use in OpenCV.
Definition: AtpOpenCV.cpp:25
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
static AtpConfig & instance()
Singleton implementation.
Definition: AtpConfig.cpp:20
#define CWARN
virtual void allocate()
#define CINFO

◆ initialize()

void ATP::ossimDescriptorSource::initialize ( )
virtual

Reimplemented from ATP::AtpTileSource.

Definition at line 42 of file ossimDescriptorSource.cpp.

References ossimSensorModel::getNominalPosError(), ATP::AtpTileSource::initialize(), m_cmpPatchInflation, ATP::AtpTileSource::m_generator, ossimDpt::x, and ossimDpt::y.

Referenced by ossimDescriptorSource().

43 {
44  // Base class initializes ref and cmp chain datat members and associated IVTs. Subsequent call
45  // to base class setViewGeom() will initialize the associated IVTs:
47 
48  ossimDpt gsd = m_generator->getRefIVT()->getOutputMetersPerPixel();
49  double nominalGsd = (gsd.x + gsd.y)/2.0;
50 
51  // Fetch the CE90 of both images to determine cmp image search patch size:
52  ossimSensorModel* ref_sm = dynamic_cast<ossimSensorModel*>(
53  m_generator->getRefIVT()->getImageGeometry()->getProjection());
54  ossimSensorModel* cmp_sm = dynamic_cast<ossimSensorModel*>(
55  m_generator->getCmpIVT()->getImageGeometry()->getProjection());
56  if (ref_sm && cmp_sm)
57  {
58  double ref_ce = ref_sm->getNominalPosError();
59  double cmp_ce = cmp_sm->getNominalPosError();
60  double total_error = ref_ce + cmp_ce; // meters -- being conservative here and not doing rss
61  m_cmpPatchInflation = 2.0*total_error/nominalGsd;
62  }
63  else
64  {
65  m_cmpPatchInflation = 2.0*DEFAULT_NOMINAL_POSITION_ERROR/nominalGsd;
66  }
67 }
virtual const double & getNominalPosError() const
Returns the estimated Absolute horizontal position error (CE90) of the sensor model.
std::shared_ptr< AtpGenerator > m_generator
Definition: AtpTileSource.h:85
double y
Definition: ossimDpt.h:165
virtual void initialize()
double x
Definition: ossimDpt.h:164

Member Data Documentation

◆ m_cmpPatchInflation

unsigned int ATP::ossimDescriptorSource::m_cmpPatchInflation
private

Definition at line 44 of file ossimDescriptorSource.h.

Referenced by getTile(), and initialize().

◆ sortFunc

struct ATP::ossimDescriptorSource::SortFunc ATP::ossimDescriptorSource::sortFunc
private

Referenced by getTile().


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