對於特徵點匹配算法,特徵點的提取計算消耗的時間決定了算法是否能達到實時的要求,在速度提升上面做了一些工作總結
特點和區別
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
相關的配置
#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;
}
結果
上面是具體的數據,有什麼問題歡迎留言或私信交流。