Isis Developer Reference
Isis::SmtkMatcher Class Reference

Workhorse of stereo matcher. More...

#include <SmtkMatcher.h>

Collaboration diagram for Isis::SmtkMatcher:
Collaboration graph

Public Member Functions

 SmtkMatcher ()
 Construct default matcher.
 
 SmtkMatcher (const QString &regdef)
 Construct with Gruen definintions file.
 
 SmtkMatcher (const QString &regdef, Cube *lhImage, Cube *rhImage)
 Construct with Gruen definintions file and camera objects

 
 SmtkMatcher (Cube *lhImage, Cube *rhImage)
 
 ~SmtkMatcher ()
 Free random number generator in destructor.
 
void setImages (Cube *lhImage, Cube *rhImage)
 Assign cubes for matching.
 
void setGruenDef (const QString &regdef)
 Initialize Gruen algorithm with definitions in Pvl file provided.
 
bool isValid (const Coordinate &pnt)
 Determine if a point is valid in both left/right images.
 
bool isValid (const SmtkPoint &spnt)
 Valid a point prior to insertion.
 
ChipPatternChip () const
 Return pattern chip.
 
ChipSearchChip () const
 Return search chip.
 
ChipFitChip () const
 Returns the fit chip.
 
void setWriteSubsearchChipPattern (const QString &fileptrn="SmtkMatcher")
 Set file pattern for output subsearch chips.
 
SmtkQStackIter FindSmallestEV (SmtkQStack &stack)
 Find the smallest eigen value on the given stack.
 
SmtkQStackIter FindExpDistEV (SmtkQStack &stack, const double &seedsample, const double &minEV, const double &maxEV)
 Find the best eigen value using exponential distribution formula.
 
SmtkPoint Register (const Coordinate &lpnt, const AffineRadio &affrad=AffineRadio())
 This method takes a sample, line from the left-hand image and tries to find the matching point in the right-hand image.
 
SmtkPoint Register (const PointPair &pnts, const AffineRadio &affrad=AffineRadio())
 Register a defined left/right point pair.
 
SmtkPoint Register (const SmtkPoint &spnt, const AffineRadio &affrad=AffineRadio())
 Register an SmtkPoint.
 
SmtkPoint Register (const PointGeometry &lpg, const PointGeometry &rpg, const AffineRadio &affrad=AffineRadio())
 Applies registration of two points.
 
SmtkPoint Create (const Coordinate &left, const Coordinate &right)
 Create a valid, unregistered SmtkPoint.
 
SmtkPoint Clone (const SmtkPoint &point, const Coordinate &left)
 Clone a point set from a nearby (left image) point and Gruen affine.
 
BigInt OffImageErrorCount () const
 
BigInt SpiceErrorCount () const
 
PvlGroup RegTemplate ()
 Return Gruen template parameters.
 
Pvl RegistrationStatistics ()
 Return Gruen registration statistics.
 

Detailed Description

Workhorse of stereo matcher.

This class provides stereo matching functionality to the SMTK toolkit. It registers points, clones them by adjusting parameters to nearby point locations and manages point selection processes.

The Gruen algorithm is initialized here and maintained for use in the stereo matching process.

Author
2011-05-28 Kris Becker

Constructor & Destructor Documentation

◆ SmtkMatcher() [1/4]

Isis::SmtkMatcher::SmtkMatcher ( )

Construct default matcher.

◆ SmtkMatcher() [2/4]

Isis::SmtkMatcher::SmtkMatcher ( const QString & regdef)

Construct with Gruen definintions file.

References setGruenDef().

◆ SmtkMatcher() [3/4]

Isis::SmtkMatcher::SmtkMatcher ( const QString & regdef,
Cube * lhImage,
Cube * rhImage )

Construct with Gruen definintions file and camera objects

References setGruenDef().

◆ SmtkMatcher() [4/4]

Isis::SmtkMatcher::SmtkMatcher ( Cube * lhImage,
Cube * rhImage )

◆ ~SmtkMatcher()

Isis::SmtkMatcher::~SmtkMatcher ( )

Free random number generator in destructor.

Member Function Documentation

◆ Clone()

SmtkPoint Isis::SmtkMatcher::Clone ( const SmtkPoint & point,
const Coordinate & left )

Clone a point set from a nearby (left image) point and Gruen affine.

This method is used to clone a PointPair from a new point and an Affine transform. Assume the left point in the set is at the center of the box and compute the offset of the point using the Affine. Apply it the right point.

Parameters
pointChip center location
newpointNew point to clone to via application of affine transform
affineThe affine transform to apply to get new (right) clone point
Returns
PointPair The clone point from the original

References Isis::SmtkPoint::getAffine(), Isis::SmtkPoint::getLeft(), Isis::SmtkPoint::getRight(), Isis::SmtkPoint::m_matchpt, and Isis::MatchPoint::m_point.

◆ Create()

SmtkPoint Isis::SmtkMatcher::Create ( const Coordinate & left,
const Coordinate & right )

Create a valid, unregistered SmtkPoint.

This method is typically used to create a point from a control point network. The point is deemed registered, but not necessarily by Gruen. Therefore, it is set as unregistered.

The left and right coordinates are deemed valid and geometry for both points is computed and verified (either the points are off image or does not map to a lat/long).

The points is set as valid and when Register() is called it will likely be run through the Gruen algorithm.

In essence, a valid, but unregistered SmtkPoint is returned if all the line/sample coordinates and geometry check out.

Author
Kris Becker - 5/30/2011
Parameters
leftLeft point
rightRight point
Returns
SmtkPoint

◆ FindExpDistEV()

SmtkQStackIter Isis::SmtkMatcher::FindExpDistEV ( SmtkQStack & stack,
const double & seedsample,
const double & minEV,
const double & maxEV )

Find the best eigen value using exponential distribution formula.

This method has the same objective as FindSmallestEV, but uses a different test to find the best value. It uses s randomly generated value within an exponential distribution from the minimum to maximum occuring eigen value.

Upon each call to this routine, the random seed is regenerated.

NOTE: This implementation differs somewhat from the ISIS2 version in that the value of the computed eigenvalue is used as the best eigenvalue. This implementation produced better distributoion of points

Parameters
stackStack to find the best value in
seedsampleThe point within the exponential distribution of interest
minEVMinimum occuring eigen value
maxEVMaximum occuring eigen value
Returns
SmtkQStackIter Stack interator

◆ FindSmallestEV()

SmtkQStackIter Isis::SmtkMatcher::FindSmallestEV ( SmtkQStack & stack)

Find the smallest eigen value on the given stack.

This static method iterates through a stack to find the best (smallest) eigen value as computed by the Gruen registration algorithm. If the stack is empty or if for some unapparent reason why the best point cannot be found, stack.end() is returned.

Parameters
stackStack to find the best point in.
Returns
SmtkQStackIter Returns an iterator with the best value

◆ FitChip()

Chip * Isis::SmtkMatcher::FitChip ( ) const
inline

Returns the fit chip.

◆ isValid() [1/2]

bool Isis::SmtkMatcher::isValid ( const Coordinate & pnt)

Determine if a point is valid in both left/right images.

This method accepts a point from the left hand image and determines if it maps to a valid lat/lon coordinate in the left image. It then takes the lat/lon from the left and determines if it maps to a valid line/sample int the right image.

Both images must have cameras associated with them or an exception is thrown.

Author
kbecker (5/25/2011)
Parameters
pntLine/Sample coordinate in left image
Returns
bool True if valid in both images, otherwise false

◆ isValid() [2/2]

bool Isis::SmtkMatcher::isValid ( const SmtkPoint & spnt)

Valid a point prior to insertion.

This method can be used to valid a point prior to adding it to a point stack. It is a final validation check and should not be used in production but used to debug.

Author
kbecker (6/2/2011)
Parameters
spntSmtkPoint to check for valid coordiantes
Returns
bool True if valid, false if not

◆ OffImageErrorCount()

BigInt Isis::SmtkMatcher::OffImageErrorCount ( ) const
inline

◆ PatternChip()

Chip * Isis::SmtkMatcher::PatternChip ( ) const
inline

Return pattern chip.

◆ Register() [1/4]

SmtkPoint Isis::SmtkMatcher::Register ( const Coordinate & lpnt,
const AffineRadio & affrad = AffineRadio() )

This method takes a sample, line from the left-hand image and tries to find the matching point in the right-hand image.

References Register().

Referenced by Register(), Register(), and Register().

◆ Register() [2/4]

SmtkPoint Isis::SmtkMatcher::Register ( const PointGeometry & lpg,
const PointGeometry & rpg,
const AffineRadio & affrad = AffineRadio() )

Applies registration of two points.

This method applies the registration of a left and right point set. The points sets may only have the left point defined. This method determines the valid geometry of the left point. If the right point is not defined, it uses the left geometry to determine the right point to register the left point with. If the right point is defined, it verifies the point has valid geometry mapping in the right image. All points and geometry must fall within the boundaries of the image and be valid or the point is deemed invalid.

Once the points is validated, registration is applied to the two points using the left point as truth (or the pattern chip) and the right point (search chip) is loaded according to the geometry of the left chip. An affine transform is immediately applied in the Gruen algorithm to apply the user supplied state of the affine and radiometric parameters.

Author
Kris Becker - 6/4/2011
Parameters
lpg
rpg
affrad
Returns
SmtkPoint

References _FILEINFO_, and Isis::IException::Programmer.

◆ Register() [3/4]

SmtkPoint Isis::SmtkMatcher::Register ( const PointPair & pnts,
const AffineRadio & affrad = AffineRadio() )

Register a defined left/right point pair.

Author
Kris Becker - 5/30/2011
Parameters
pntsPoints to register
affradAffine/Radiometric parameters to use
Returns
SmtkPoint Result of point registration

References Register().

◆ Register() [4/4]

SmtkPoint Isis::SmtkMatcher::Register ( const SmtkPoint & spnt,
const AffineRadio & affrad = AffineRadio() )

Register an SmtkPoint.

This method will register an established SmtkPoint. It will determine what parts of the point need to be completed in order for the registration to be valid. For instance, a default initialization of an SmtkPoint may only requre the left point to be defined. Or both points are defined but it has been registered but cloned (see Clone()).

It the point is deemed registered it will simply be returned as is without further processing. So to register a point ensure it the m_register flag is set to false.

Author
Kris Becker - 5/30/2011
Parameters
spntSmtkPoint to register
affradAffine/Radiometrics to use for registration
Returns
SmtkPoint A registered point. Test for validity on return to evaluate success.

References Register().

◆ RegistrationStatistics()

Pvl Isis::SmtkMatcher::RegistrationStatistics ( )
inline

Return Gruen registration statistics.

◆ RegTemplate()

PvlGroup Isis::SmtkMatcher::RegTemplate ( )
inline

Return Gruen template parameters.

◆ SearchChip()

Chip * Isis::SmtkMatcher::SearchChip ( ) const
inline

Return search chip.

◆ setGruenDef()

void Isis::SmtkMatcher::setGruenDef ( const QString & regdef)

Initialize Gruen algorithm with definitions in Pvl file provided.

This method will initialize the Gruen algorithm with a standard AutoReg definitions file. It is re-entrant in that should an existing Gruen object be present, it is freed and replaced by the one resulting from the instantion with the regdef file provided.

Author
Kris Becker - 5/26/2011
Parameters
regdefGruen definitions Pvl file

Referenced by SmtkMatcher(), and SmtkMatcher().

◆ setImages()

void Isis::SmtkMatcher::setImages ( Cube * lhImage,
Cube * rhImage )

Assign cubes for matching.

◆ setWriteSubsearchChipPattern()

void Isis::SmtkMatcher::setWriteSubsearchChipPattern ( const QString & fileptrn = "SmtkMatcher")

Set file pattern for output subsearch chips.

This method should be used to set the output subsearch chip file pattern that will be used to write the transformed chip at each Gruen iteration. This is handy to test the pattern chip with the Gruen algorithm search chip. A chip will be generated for each search chip that is transformed for the current iteration.

Note this pattern is only validate for the next call to Register(). It will be reset so that chips are not automatically written for every call to Register().

The pattern can be complete directory path and a file pattern. See Gruen for a complete description.

Author
kbecker (9/15/2011)
Parameters
patternSet the file pattern of the output cube search chips.

◆ SpiceErrorCount()

BigInt Isis::SmtkMatcher::SpiceErrorCount ( ) const
inline

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