与立体摄像头实时特征匹配
Real time feature matching with stereo camera
我有一个立体相机设置,我正在尝试匹配两帧之间的特征,以便我可以将相应的点三角测量成3d点云。使用SURF可以工作,但是对于实时使用来说太慢了。有更快的方法吗?或者,一个解决问题的方法?
这是我的代码:
bool matchFeatures(Mat img_1, Mat img_2)
{
points_2D_left.clear();
points_2D_right.clear();
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400; SurfFeatureDetector detector(minHessian);
std::vector<KeyPoint> keypoints_1, keypoints_2;
detector.detect(img_1, keypoints_1);
detector.detect(img_2, keypoints_2);
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2;
extractor.compute(img_1, keypoints_1, descriptors_1);
extractor.compute(img_2, keypoints_2, descriptors_2);
//-- Step 3: Matching descriptor vectors using FLANN matcher
FlannBasedMatcher matcher;
std::vector< DMatch > matches;
matcher.match(descriptors_1, descriptors_2, matches);
double max_dist = 0; double min_dist = 100;
//-- Quick calculation of max and min distances between keypoints
for (int i = 0; i < descriptors_1.rows; i++)
{
double dist = matches[i].distance;
if (dist < min_dist) min_dist = dist;
if (dist > max_dist) max_dist = dist;
}
std::vector< DMatch > good_matches;
for (int i = 0; i < descriptors_1.rows; i++)
{
if (matches[i].distance <= max(2 * min_dist, 0.02))
{
good_matches.push_back(matches[i]);
}
}
for (int i = 0; i < good_matches.size(); i++)
{
//-- Get the keypoints from the good matches
points_2D_left.push_back(keypoints_1[good_matches[i].queryIdx].pt);
points_2D_right.push_back(keypoints_2[good_matches[i].trainIdx].pt);
}
return true;
}
SURF太慢了。尝试使用实时运行的ORB。OrbFeatureDetector
相关文章:
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- 特征::矩阵<双精度,1,3> 结构类型函数中的返回类型函数
- 有没有一种方法可以通过"typedef"为重新定义的基本类型定义特征和强制转换运算符
- 从数据库实时显示QT c++中的数据
- 特征命名访问向量段
- 将特征矩阵的向量设置为0
- 特征:模板函数中矩阵的平面图
- basic_string的前导/尾部不区分空格的特征
- 特征 3 类的模板专用化
- 特征 c++:复矩阵的面积双曲正切(atanh)
- C++ 中的特征向量计算
- 在 Windows 8/10 技术中完全实时的屏幕捕获,没有延迟
- 根据C++标准的定义实现"is_similar"类型特征
- C++类型特征,以查看是否可以<uint32_t>对类型"K"的任何变量调用"static_cast(k)"
- 有没有办法找到特征矩阵系数的中值?
- 如何将高维数据映射到特征类型?
- 将平面阵列重塑为复杂的特征类型
- 有没有办法使用 c++ 实时阅读文本?
- 在本地网络中通过OpenCV(C++)实时流式传输图像
- 与立体摄像头实时特征匹配