SURF源码分析之surflib.h
surflib.h有三个函数组成,第一个函数是第二个和第三个的合体
1、提取关键点并提取特征点描述因子surfDetDes()
2、提取关键点 surfDet()
3、提取特征点描述因子surfDes(()
#ifndef SURFLIB_H #define SURFLIB_H #include <cv.h> #include <highgui.h> #include "integral.h" #include "fasthessian.h" #include "surf.h" #include "ipoint.h" #include "utils.h" //! 提取描述因子 // img 待提取描述因子图像 // ipts 存储关键点信息的容器 // upright 是否适用于旋转不变模型 // octaves 尺度空间组数 // intervals 尺度空间每组包含的层数 // init_sample 初始抽样倍数 // thres blob 阀值 //! Library function builds vector of described interest points 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 */) { // 构造积分图 // Create integral-image representation of the image IplImage *int_img = Integral(img); // 创建快速hessian对象 // Create Fast Hessian Object FastHessian fh(int_img, ipts, octaves, intervals, init_sample, thres); // 提取兴趣点并保存于容器ipts中 // Extract interest points and store in vector ipts fh.getIpoints(); // 创建Surf des // Create Surf Descriptor Object Surf des(int_img, ipts); // 提取描述因子 // Extract the descriptors for the ipts des.getDescriptors(upright); // 释放积分图内存 // Deallocate the integral image cvReleaseImage(&int_img); } //! Library function builds vector of interest points //! 提取图像关键点 inline void surfDet(IplImage *img, /* image to find Ipoints in */ std::vector<Ipoint> &ipts, /* reference to vector of Ipoints */ 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 */) { // Create integral image representation of the image IplImage *int_img = Integral(img); // Create Fast Hessian Object FastHessian fh(int_img, ipts, octaves, intervals, init_sample, thres); // Extract interest points and store in vector ipts fh.getIpoints(); // Deallocate the integral image cvReleaseImage(&int_img); } //! Library function describes interest points in vector //! 提取图像特征描述因子 inline void surfDes(IplImage *img, /* image to find Ipoints in */ std::vector<Ipoint> &ipts, /* reference to vector of Ipoints */ bool upright = false) /* run in rotation invariant mode? */ { // Create integral image representation of the image IplImage *int_img = Integral(img); // Create Surf Descriptor Object Surf des(int_img, ipts); // Extract the descriptors for the ipts des.getDescriptors(upright); // Deallocate the integral image cvReleaseImage(&int_img); } #endif