一、SURF
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/nonfree/features2d.hpp>
using namespace cv;
int main()
{
Mat image=imread("CarType1_suv18.jpg");
vector<KeyPoint> keypoints;
SurfFeatureDetector surf(2500);
double t = getTickCount();//当前滴答数
//检测SURF特征
surf.detect(image,keypoints);
//描述surf特征点
SurfDescriptorExtractor surfDesc;
Mat descriptros1,descriptros2;
surfDesc.compute(image,keypoints,descriptros1);
t = ((double)getTickCount() - t)/getTickFrequency();
cout<<"Surf算法用时:"<<t<<"秒"<<endl;
drawKeypoints(image,keypoints,image,Scalar(255,0,0),
DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
namedWindow("result");
imshow("result",image);
waitKey();
return 0;
}
2.Fast角点检测
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#i