41 m_offImage(0), m_spiceErr(0),
59 Cube *rhCube) : m_lhCube(lhCube),
61 m_gruen(0), m_offImage(0),
95 m_gruen = std::auto_ptr<Gruen> (
new Gruen(reg));
149 m_gruen->WriteSubsearchChips(fileptrn);
165 SmtkQStackIter best(stack.begin()), current(stack.begin());
166 while ( current != stack.end() ) {
167 if (current.value().GoodnessOfFit() < best.value().GoodnessOfFit() ) {
198 const double &seedsample,
200 const double &maxEV) {
202 if (stack.isEmpty())
return (stack.end());
203 SmtkQStackIter best(stack.begin()), current(stack.begin());
206 double randNum = gsl_rng_uniform (r);
207 double t1 = -std::log(1.0 - randNum *
208 (1.0 - std::exp(-seedsample)))/seedsample;
209 double pt = minEV + t1*(maxEV-minEV);
210 double best_ev(DBL_MAX);
211 while ( current != stack.end() ) {
212 double test_ev(std::fabs(current.value().GoodnessOfFit()-pt));
213 if ( test_ev < best_ev) {
239 std::cout <<
"Point status is invalid!\n";
245 std::cout <<
"Left point (" << spnt.
getLeft().getLine() <<
","
246 << spnt.
getLeft().getSample() <<
") is invalid!\n";
252 std::cout <<
"Right point (" << spnt.
getRight().getLine() <<
","
253 << spnt.
getRight().getSample() <<
") is invalid!\n";
318 return (
Register(left, right, affrad));
357 if (!lpg.getPoint().
isValid()) {
358 QString mess =
"Left point is not defined which is required";
372 if (!left.isValid()) {
395 if (!right.isValid()) {
402 m_gruen->PatternChip()->TackCube(lpnt.getSample(), lpnt.getLine());
403 m_gruen->PatternChip()->Load(*m_lhCube);
404 m_gruen->SearchChip()->TackCube(rpnt.getSample(), rpnt.getLine());
405 m_gruen->SearchChip()->Load(*m_rhCube, *m_gruen->PatternChip(),
414 m_gruen->setAffineRadio(affrad);
462 spnt.m_isValid =
true;
493 mpt.m_point = cpoint;
497 spnt.m_registered =
false;
498 spnt.m_isValid =
inCube(lhCamera(), left) &&
inCube(rhCamera(), right);
515 r = gsl_rng_alloc (T);
534 if (!m_lhCube) isGood =
false;
535 if (!m_rhCube) isGood =
false;
536 if (!m_gruen.get()) isGood =
false;
537 if ((!isGood) && throwError) {
538 QString mess =
"Images/match algorithm not initialized!";
556 if (!pnt.
isValid())
return (
false);
557 if ( (pnt.getSample() < 0.5) || (pnt.getLine() < 0.5) )
return false;
558 if ( (pnt.getSample() > (camera.
Samples() + 0.5)) ||
559 (pnt.getLine() > (camera.
Lines() + 0.5)) ) {
581 if (
inCube(camera, pnt)) {
582 if ( camera.
SetImage(pnt.getSample(), pnt.getLine()) ) {
641 PointPair(left.getGeometry(), right.getGeometry())));
659 if ( !rpoint.isValid() ) {
661 spnt.m_isValid =
false;
665 double dist = (rcorr - right.getPoint()).getDistance();
668 spnt.m_isValid =
false;
671 spnt.m_isValid = match.isValid();
Success registering to sub-pixel accuracy.
MatchPoint getLastMatch() const
Returns the register state of the last successful Gruen match.
void setZeroState()
Resets eigenvalues to 0.
SmtkPoint Clone(const SmtkPoint &point, const Coordinate &left)
Clone a point set from a nearby (left image) point and Gruen affine.
SmtkQStackIter FindExpDistEV(SmtkQStack &stack, const double &seedsample, const double &minEV, const double &maxEV)
Find the best eigen value using exponential distribution formula.
Define a generic Y/X container.
void setImages(Cube *lhImage, Cube *rhImage)
Assign cubes for matching.
SmtkPoint Create(const Coordinate &left, const Coordinate &right)
Create a valid, unregistered SmtkPoint.
Define a point set of left, right and geometry at that location.
bool isRegistered() const
Returns registration status.
SmtkMatcher()
Construct default matcher.
bool InCube()
This returns true if the current Sample() or Line() value is outside of the cube (meaning the point m...
static GSLUtility * getInstance()
Return a reference to the GSL (singleton) object.
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
const Coordinate & getLeft() const
Returns the left point.
const Coordinate & getRight() const
Returns the registered right coordinate.
const AffineRadio & getAffine() const
Returns the affine transform and radiometic results.
AutoReg::RegisterStatus Register()
Walk the pattern chip through the search chip to find the best registration.
Coordinate getLineSample(Camera &camera, const Coordinate &geom)
Compute line,sample from latitude, longitude.
Container for a point and its geometry.
This error is for when a programmer made an API call that was illegal.
void setLatLon(const double &latitude, const double &longitude)
Use Latitude/Longitude interface.
SmtkPoint makeRegisteredPoint(const PointGeometry &left, const PointGeometry &right, Gruen *gruen)
Create an SmtkPoint from Gruen match result.
void setGruenDef(const QString ®def)
Initialize Gruen algorithm with definitions in Pvl file provided.
Coordinate getPoint(const Coordinate &location) const
Applies the affine transfrom to a point and returns result.
bool SetUniversalGround(const double latitude, const double longitude)
Sets the lat/lon values to get the sample/line values.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
double CubeSample() const
Return the search chip cube sample that best matched.
int Samples() const
Returns the number of samples in the image.
#define _FILEINFO_
Macro for the filename and line number.
double Sample()
Returns the current sample number.
Coordinate getLatLon(Camera &camera, const Coordinate &pnt)
Compute latitude, longitude from line,sample.
void setLineSamp(const double &line, const double &sample)
Use the Line/Sample interface.
Container for cube-like labels.
Container for affine and radiometric parameters.
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...
bool inCube(const Camera &camera, const Coordinate &point) const
Determines if the line/sample is within physical cube boundaries.
Structure containing comprehensive registration info/results.
Gruen pattern matching algorithm.
SmtkQStackIter FindSmallestEV(SmtkQStack &stack)
Find the smallest eigen value on the given stack.
double getSpiceConstraint() const
Returns the SPICE tolerance constraint as read from config file.
void setWriteSubsearchChipPattern(const QString &fileptrn="SmtkMatcher")
Set file pattern for output subsearch chips.
double Line()
Returns the current line number.
double CubeLine() const
Return the search chip cube line that best matched.
bool isValid() const
Indicates the smtk portion of the point is valid.
int Lines() const
Returns the number of lines in the image.
~SmtkMatcher()
Free random number generator in destructor.
bool validate(const bool &throwError=true) const
Validates the state of the Camera and Gruen algoritm.
void randomNumberSetup()
Initialize the random number generator.
Container for SMTK match points.
bool isValid(const Coordinate &pnt)
Determine if a point is valid in both left/right images.
bool isValid() const
Check for goodness.
IO Handler for Isis Cubes.