#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat srcImage = imread("C:/Users/BIN/Desktop/1.png");
Ptr<ORB> dectector = ORB::create(100,//特征点数
1.2f,//“金字塔”层级之间缩放比例
8,//“金字塔”图像层数系数
31,//边缘阈值
0,//原图在金字塔中的层数
2,//生成描述子时用到的像素点数目
ORB::HARRIS_SCORE,//使用的评价方法
31,//生成描述子时关键点周围邻域的尺寸
20//计算角点时像素值差值的阈值
);
//计算ORB关键点
vector<KeyPoint> Keypoints;
dectector->detect(srcImage, Keypoints);
printf("Total keypoints: %d\n", Keypoints.size());
//计算描述子
Mat descriptions;
dectector->compute(srcImage, Keypoints, descriptions);
//绘制
Mat imgnoAngel;
Mat imgAngel;
srcImage.copyTo(imgAngel);
drawKeypoints(srcImage, Keypoints, imgnoAngel, Scalar(0,0,255), DrawMatchesFlags::DEFAULT);
imshow("imgnoAngel", imgnoAngel);
drawKeypoints(srcImage, Keypoints, imgAngel, Scalar(0, 0, 255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
imshow("imgAngel", imgAngel);
waitKey(0);
return 0;
}