对于特征点匹配算法,特征点的提取计算消耗的时间决定了算法是否能达到实时的要求,在速度提升上面做了一些工作总结
特点和区别
SIFT特征是图像的局部特征,对平移、旋转、尺度缩放、亮度变化、遮挡和噪声等具有良好的不变性,对视觉变化、仿射变换也保持一定程度的稳定性。ORB:An Efficient Alternative to SIFT or SURF”的文章中提出:http://ieeexplore.ieee.org/document/6126544/?reload=true&arnumber=6126544
具体的请参考:http://www.cnblogs.com/ronny/p/4083537.html
相关的配置
SSE:项目--属性--C/C++--代码生成:
GPU:需要NVIDIA显卡,结合CUDA对opencv重新编译,详见:
http://blog.csdn.net/dlphay/article/details/79007815
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/legacy/legacy.hpp"
#include <iostream>
#include <vector>
#include <time.h>
// GPU
#include "opencv2/gpu/gpu.hpp"
using namespace cv;
using namespace std;
using namespace cv::gpu;
int main()
{
int num_devices = gpu::getCudaEnabledDeviceCount();
cout << num_devices << endl;
if (num_devices <= 0)
{
std::cerr << "There is no device." << std::endl;
return - 1;
}
int enable_device_id = -1;
for (int i = 0; i < num_devices; i++)
{
cv::gpu::DeviceInfo dev_info(i);
if (dev_info.isCompatible())
{
enable_device_id = i;
}
}
if (enable_device_id < 0)
{
std::cerr << "GPU module isn't built for GPU" << std::endl;
return - 1;
}
gpu::setDevice(enable_device_id);
//Mat img_1 = imread("E:\\capture\\images5\\A005.mpg3700.jpg", 0);
//Mat img_2 = imread("E:\\capture\\images5\\A005.mpg3701.jpg", 0);
Mat img_1 = imread("E:\\capture\\images5\\A0001.jpg", 0);
Mat img_2 = imread("E:\\capture\\images5\\A0002.jpg", 0);
GpuMat dimg_1(img_1);
GpuMat dimg_2(img_2);
ORB_GPU orb_gpu;
clock_t start, end;
vector<KeyPoint> dkeyPoints_1, dkeyPoints_2;
GpuMat ddescriptors_1, ddescriptors_2;
Mat des_1, des_2;
start = clock();
orb_gpu(dimg_1, GpuMat(), dkeyPoints_1, ddescriptors_1);
orb_gpu(dimg_2, GpuMat(), dkeyPoints_2, ddescriptors_2);
end = clock();
cout << (double)(end - start)/2 << endl;
return 0;
}
结果
配置:i7-7700HQ + GTX1050
上面是具体的数据,有什么问题欢迎留言或私信交流。