main函数
#include<opencv2/opencv.hpp>
#include"PC_SIFT.h"
using namespace std;
using namespace cv;
int main(int argc,char*argv[])
{
struct feature *feat;
int n;
Mat img1=cv::imread("E://corner.jpg",-1);
if(!img1.data)
{cout<<"Error!No such file!"<<endl;
return -1;
}
cv::namedWindow("test1",CV_WINDOW_AUTOSIZE);
imshow("test1",img1);
n=pc_sift_features(img1, &feat);
cv::waitKey(0);
return 0;
}
CPP文件
#include<opencv2/opencv.hpp>
#include<math.h>
#include "PC_SIFT.h"
using namespace std;
using namespace cv;
Size Wsize(5,5); // the size of gaussain smooth kernel
/*************************Static Function Feclaration**************************/
static int _sift_features( Mat, struct feature**, int ,double , double , int ,int , int );
static Mat create_init_img( Mat, double );
static void build_gauss_pyr( Mat,vector<Mat>&, int,int, double );
static Mat downsample( Mat);
static void build_dog_pyr(vector<Mat>&dog_pyr,vector<Mat>&gauss_pyr, int octvs, int intvls );
/************************Main function pc_sift_features************************/
/*we skipped the first ocatve */
int pc_sift_features(Mat img,struct feature