SiftMatch.cc
Go to the documentation of this file.00001 #include "SiftMatch.h"
00002 #include "Vision/SIFT/SIFTDatabase/keypoint.h"
00003 #include <iostream>
00004
00005 using namespace std;
00006
00007 SiftMatch::SiftMatch()
00008 : objectID(-1), objectName(), modelID(-1), modelName(), probOfMatch(), error(),
00009 scale(), orientation(), columnTranslation(), rowTranslation(), inliers(),
00010 topLeft(), topRight(), bottomLeft(), bottomRight()
00011 {}
00012
00013 void SiftMatch::print(const char* frontpadding) {
00014 cout << frontpadding << "objectID: " << objectID << endl;
00015 cout << frontpadding << "objectName: " << objectName << endl;
00016 cout << frontpadding << "modelID: " << modelID << endl;
00017 cout << frontpadding << "modelName: " << modelName << endl;
00018 cout << frontpadding << "probOfMatch: " << probOfMatch << endl;
00019 cout << frontpadding << "error: " << error << endl;
00020 cout << frontpadding << "scale: " << scale << endl;
00021 cout << frontpadding << "orientation: " << orientation << endl;
00022 cout << frontpadding << "columnTranslation: " << columnTranslation << endl;
00023 cout << frontpadding << "rowTranslation: " << rowTranslation << endl;
00024 cout << frontpadding << "topLeft: " << topLeft << endl;
00025 cout << frontpadding << "topRight: " << topRight << endl;
00026 cout << frontpadding << "bottomLeft: " << bottomLeft << endl;
00027 cout << frontpadding << "bottomRight: " << bottomRight << endl;
00028 }
00029
00030 void SiftMatch::computeBoundingBox() {
00031 double minX = inliers[0].getKey1()->modelX;
00032 double minY = inliers[0].getKey1()->modelY;
00033 double maxX = minX, maxY = minY;
00034 for ( vector<keypointPair>::const_iterator it = inliers.begin(); it != inliers.end(); it++ ) {
00035 double x = it->getKey1()->modelX;
00036 double y = it->getKey1()->modelY;
00037 if ( x < minX )
00038 minX = x;
00039 else if ( x > maxX )
00040 maxX = x;
00041 if ( y < minY )
00042 minY = y;
00043 else if ( y > maxY )
00044 maxY = y;
00045 }
00046 topLeft = DualCoding::Point(minX,minY,0,DualCoding::camcentric);
00047 topRight = DualCoding::Point(maxX,minY,0,DualCoding::camcentric);
00048 bottomLeft = DualCoding::Point(minX,maxY,0,DualCoding::camcentric);
00049 bottomRight = DualCoding::Point(maxX,maxY,0,DualCoding::camcentric);
00050 }