/*************************************************************************** * Copyright (C) 2007 by Zoran Mesec * * zoran.mesec@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ //#define USE_OPENCV //#define USE_QT #define USE_VIGRA #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "APImage.h" #include "HessianDetector.h" #include "Descriptor.h" #include using namespace std; double getDistance(vector* d1,vector* d2) { double dist=0; for(int i=0; i >* interestPoints1=hd1.getPoints(); Descriptor d1(&im1,&hd1); d1.setPoints(interestPoints1); //d.orientate(); d1.createDescriptors(); //d1.generateAutopanoXML("test3.xml"); /*d1.printDescriptors(cout); return 0;*/ HessianDetector hd2(&im2,nrPoints, HD_BOX_FILTERS,1); if(!hd2.detect()) { cout << "Detection of points failed!"; return 1; } //print points and display image with the detected points(debugging only) //hd2.printPoints(); vector >* interestPoints2=hd2.getPoints(); Descriptor d2(&im2,&hd2); d2.setPoints(interestPoints2); //d.orientate(); d2.createDescriptors(); /*d2.generateAutopanoXML("test4.xml"); return 0;*/ vector >* descriptors1=d1.getDescriptors(); vector >::iterator iter1 = (*descriptors1).begin(); vector >* descriptors2=d2.getDescriptors(); int pointCount=0; int max; int maxId; //position int the vector of the nearest neighbour while( iter1 != (*descriptors1).end()) { vector current1 = *iter1; vector >::iterator iter2 =(*descriptors2).begin(); max=1; maxId=0; vector current2 = *iter2; double distance=getDistance(¤t1,¤t2); iter2++; double diff=distance; //nearest neighbour double diff2=std::numeric_limits::max(); //second nearest neighbour while( iter2 != (*descriptors2).end()) { current2 = *iter2; distance=getDistance(¤t1,¤t2); if(distance