【OpenCV】ORB特征检测

ORB特征检测的原理请参考链接:【目标检测】ORB特征学习记录。

#include 
#include 
#include 

#include 
#include 
#include 

using namespace cv;

double time = 0;
LARGE_INTEGER nFreq;
LARGE_INTEGER nBeginTime;
LARGE_INTEGER nEndTime;
QueryPerformanceFrequency(&nFreq);

Mat image;
image = imread("3.jpg");
Mat resizeImg;
resize(image, resizeImg, Size(), 0.5, 0.5, INTER_LINEAR);
// vector of keyPoints
std::vector keyPoints;
// construction of the orb feature detector object
Ptr orb = ORB::create();

QueryPerformanceCounter(&nBeginTime);
orb->detect(resizeImg, keyPoints);// feature point detection
QueryPerformanceCounter(&nEndTime);
time = (double)(nEndTime.QuadPart - nBeginTime.QuadPart) / (double)nFreq.QuadPart;
std::cout << "运行时间: " << time * 1000 << "ms" << std::endl;
drawKeypoints(resizeImg, keyPoints, resizeImg, Scalar(0, 0, 255), DrawMatchesFlags::DRAW_OVER_OUTIMG);

imshow("ORB feature 1", resizeImg);

运行时间是真的比SIFT和SURF快很多啊。

输出结果,

【OpenCV】ORB特征检测_第1张图片

 

你可能感兴趣的:(计算机视觉,opencv)