As I said before OpenSURF is an open source implementation of SURF library, which is being used for feature extraction and matching. In my last post I have provided the results of my experimentation. This post is for description of the methods and how to do it all by yourself.

Well, first of all you need to configure your IDE for using openCV dlls and libs. Then add the openSURF library to your project(else for testing you can create inside openSURF project e.g. see main.cpp). All you need is to include "surflib.h" from the openSURF library which contains all the main function you need for the implementation.

The main functions are :

//! Library function builds vector of described interest points  (from surflib.h)
inline void surfDetDes(IplImage *img,  /* image to find Ipoints in */  
std::vector<Ipoint> &ipts, /* reference to vector of Ipoints */  
bool upright = false, /* run in rotation invariant mode? */  
int octaves = OCTAVES, /* number of octaves to calculate */  
int intervals = INTERVALS, /* number of intervals per octave */  
int init_sample = INIT_SAMPLE, /* initial sampling step */  
float thres = THRES /* blob response threshold */)

//To get matches between two Ipoints (from ipoints.h)
void getMatches(IpVec &ipts1, IpVec &ipts2, IpPairVec &matches);

//! Draw all the Ipoints in the provided vector (from utils.h)
void drawIpoints(IplImage *img, std::vector<Ipoint> &ipts, int tailSize = 0);

//! Save the SURF features to file (from utils.h)
void saveSurf(char *filename, std::vector<Ipoint> &ipts);

//! Load the SURF features from file ( from utils.h)
void loadSurf(char *filename, std::vector<Ipoint> &ipts);  

So as the very first function says, it calculates all the ipoints(Interest Points) from the image and stores them in the ipts vector.

As indicated by comments, the drawIpoints(...) method draws the interest points found by the previous method, saveSurf(...) saves the ipoints to a file and loadSurf(...) loads the ipoints from a file to a variable.

So once all interest points of the image are found, you can match them to the interest points of another image by the getMatches(), which stores all the matched points to the matches variable. The definition of IpPairVec is

typedef std::vector<std::pair<Ipoint, Ipoint> > IpPairVec;

So in case you want to connect all the match points by cvLine you can use the following code snippet (see the 5th procedure in main.cpp)

  for (unsigned int i = 0; i < matches.size(); ++i)

    const int & w = img1->width;
    cvLine(img1,cvPoint(matches[i].first.x,matches[i].first.y),cvPoint(matches[i].second.x+w,matches[i].second.y), cvScalar(255,255,255),1);
    cvLine(img2,cvPoint(matches[i].first.x-w,matches[i].first.y),cvPoint(matches[i].second.x,matches[i].second.y), cvScalar(255,255,255),1);

So this is all for now, I will keep you updated about my work !

So as the very first function says, it calculates all the ipoints(Interest Points) from the image and stores them in the ipts vector.