Isis 3 Developer Reference
|
Workhorse of stereo matcher. More...
#include <SmtkMatcher.h>
Public Member Functions | |
SmtkMatcher () | |
Construct default matcher. More... | |
SmtkMatcher (const QString ®def) | |
Construct with Gruen definintions file. More... | |
SmtkMatcher (const QString ®def, Cube *lhImage, Cube *rhImage) | |
Construct with Gruen definintions file and camera objects. More... | |
SmtkMatcher (Cube *lhImage, Cube *rhImage) | |
~SmtkMatcher () | |
Free random number generator in destructor. More... | |
void | setImages (Cube *lhImage, Cube *rhImage) |
Assign cubes for matching. More... | |
void | setGruenDef (const QString ®def) |
Initialize Gruen algorithm with definitions in Pvl file provided. More... | |
bool | isValid (const Coordinate &pnt) |
Determine if a point is valid in both left/right images. More... | |
bool | isValid (const SmtkPoint &spnt) |
Valid a point prior to insertion. More... | |
Chip * | PatternChip () const |
Return pattern chip. More... | |
Chip * | SearchChip () const |
Return search chip. More... | |
Chip * | FitChip () const |
Returns the fit chip. More... | |
void | setWriteSubsearchChipPattern (const QString &fileptrn="SmtkMatcher") |
Set file pattern for output subsearch chips. More... | |
SmtkQStackIter | FindSmallestEV (SmtkQStack &stack) |
Find the smallest eigen value on the given stack. More... | |
SmtkQStackIter | FindExpDistEV (SmtkQStack &stack, const double &seedsample, const double &minEV, const double &maxEV) |
Find the best eigen value using exponential distribution formula. More... | |
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. More... | |
SmtkPoint | Register (const PointPair &pnts, const AffineRadio &affrad=AffineRadio()) |
Register a defined left/right point pair. More... | |
SmtkPoint | Register (const SmtkPoint &spnt, const AffineRadio &affrad=AffineRadio()) |
Register an SmtkPoint. More... | |
SmtkPoint | Register (const PointGeometry &lpg, const PointGeometry &rpg, const AffineRadio &affrad=AffineRadio()) |
Applies registration of two points. More... | |
SmtkPoint | Create (const Coordinate &left, const Coordinate &right) |
Create a valid, unregistered SmtkPoint. More... | |
SmtkPoint | Clone (const SmtkPoint &point, const Coordinate &left) |
Clone a point set from a nearby (left image) point and Gruen affine. More... | |
BigInt | OffImageErrorCount () const |
BigInt | SpiceErrorCount () const |
PvlGroup | RegTemplate () |
Return Gruen template parameters. More... | |
Pvl | RegistrationStatistics () |
Return Gruen registration statistics. More... | |
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.
Isis::SmtkMatcher::SmtkMatcher | ( | ) |
Construct default matcher.
Isis::SmtkMatcher::SmtkMatcher | ( | const QString & | regdef | ) |
Construct with Gruen definintions file.
References setGruenDef().
Construct with Gruen definintions file and camera objects.
References setGruenDef().
Isis::SmtkMatcher::~SmtkMatcher | ( | ) |
Free random number generator in destructor.
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.
point | Chip center location |
newpoint | New point to clone to via application of affine transform |
affine | The affine transform to apply to get new (right) clone point |
References Isis::SmtkPoint::getAffine(), Isis::SmtkPoint::getLeft(), Isis::AffineRadio::getPoint(), Isis::SmtkPoint::getRight(), Isis::SmtkPoint::m_isValid, Isis::SmtkPoint::m_matchpt, Isis::MatchPoint::m_point, and Isis::SmtkPoint::m_registered.
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.
left | Left point |
right | Right point |
References Isis::Coordinate::isValid(), Isis::MatchPoint::m_analysis, Isis::SmtkPoint::m_isValid, Isis::SmtkPoint::m_matchpt, and Isis::Analysis::setZeroState().
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
stack | Stack to find the best value in |
seedsample | The point within the exponential distribution of interest |
minEV | Minimum occuring eigen value |
maxEV | Maximum occuring eigen value |
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.
stack | Stack to find the best point in. |
|
inline |
Returns the fit chip.
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.
pnt | Line/Sample coordinate in left image |
References Isis::Coordinate::isValid().
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.
spnt | SmtkPoint to check for valid coordiantes |
References Isis::SmtkPoint::getLeft(), Isis::Coordinate::getLine(), Isis::SmtkPoint::getRight(), Isis::Coordinate::getSample(), and Isis::SmtkPoint::isValid().
|
inline |
|
inline |
Return pattern chip.
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.
Referenced by Register().
SmtkPoint Isis::SmtkMatcher::Register | ( | const PointPair & | pnts, |
const AffineRadio & | affrad = AffineRadio() |
||
) |
Register a defined left/right point pair.
pnts | Points to register |
affrad | Affine/Radiometric parameters to use |
References Isis::PointPair::getLeft(), Isis::PointPair::getRight(), and Register().
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.
spnt | SmtkPoint to register |
affrad | Affine/Radiometrics to use for registration |
References Isis::SmtkPoint::getLeft(), Isis::SmtkPoint::getRight(), Isis::SmtkPoint::isRegistered(), and Register().
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.
lpg | |
rpg | |
affrad |
References _FILEINFO_, Isis::PointGeometry::getGeometry(), Isis::Coordinate::getLine(), Isis::PointGeometry::getPoint(), Isis::Coordinate::getSample(), Isis::PointGeometry::isValid(), Isis::Coordinate::isValid(), and Isis::IException::Programmer.
|
inline |
Return search chip.
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.
Referenced by SmtkMatcher().
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.
pattern | Set the file pattern of the output cube search chips. |
|
inline |