
#if !defined(_GSURF_MATCH_H_)
#define _GSURF_MATCH_H_ 

//*******************************************************************************
//*******************************************************************************

// System Libraries
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <sys/time.h>

// OpenCV Libraries
#include <cv.h>
#include <highgui.h>
#include <cvaux.h>
#include <ml.h>

// SURFlib (OpenGSURF) Library
#include "surflib.h"
#include "utils.h"

//*******************************************************************************
//*******************************************************************************

// Namespace
using namespace std;

//*******************************************************************************
//*******************************************************************************

// Some global variables
const double MIN_H_ERROR = 2.50; // Pixelic error to accept a correspondence
const double DRATIO = .75; // Distance ratio between the two closests neighbors
#define NMAX_CHARACTERS 400 // Maximum number of characters
#define VERBOSE 1 // For displaying verbosity information

//*******************************************************************************
//*******************************************************************************

// Declaration of functions
unsigned int Matching_Descriptor(IpVec &ipts_orig, IpVec &ipts, vector<int> &indexes);
double Compute_SURF_Descriptor_Distance(Ipoint &p1, Ipoint &p2, double best);
void Compute_Inliers_GT_Homography(IpVec &ipts_orig, IpVec &ipts, vector<int> &indexes, vector<int> &inliers, double H[3][3]);
void Compute_Inliers_Homography_RANSAC(IpVec &ipts_orig, IpVec &ipts, vector<int> &indexes, vector<int> &inliers, double H[3][3]);
void Read_Homography_Parameters(char *calib_file, double HG[3][3]);
double Compute_Homography_Error( double H[3][3], double HG[3][3]);
void Composite_Image_with_Line(IplImage *img1,IplImage *imgN,IplImage *img_composite,IpVec &ipts1, IpVec &iptsN, vector<int> ptpairs);
void Save_Matching_Results(double ratio, double niliers, double ehomo, IplImage *img_com);
void SaveIpoints(char *sFileName, const IpVec &ipts, bool bVerbose, bool bLaplacian, unsigned int mode, int extended);
void LoadIpoints(char *sFileName,IpVec & ipts, bool bVerbose);
void SaveIpoints_for_SIFT(char *sFileName, const IpVec &ipts);

//*******************************************************************************
//*******************************************************************************

#endif

