SURF 和无失真图像匹配 OpenCV C++
SURF and Matching with Undistorted Image OpenCV C++
我正在研究 ROS Melodic 中的 OpenCV 4。在 undistort()
之后,图像具有由 SURF 检测到的黑色背景。我怎样才能解决这个问题?
感谢 Micka 的评论,我找到了解决方案。我在低比率测试中过滤了特征:
//-- Filter matches using the Lowe's ratio test
//Default ratio_thresh: 0.7f;
vector<DMatch> matches;
size_t i = 0;
bool lowe_condition = false;
bool black_background_condition = false;
//Filter matches in black background
for (i; i < knn_matches.size(); i++)
{
lowe_condition = (knn_matches[i][0].distance < ratio_thresh * knn_matches[i][1].distance);
black_background_condition = ((keypoints1[i].pt.x >= width_low ) && (keypoints1[i].pt.x <= width_high)) && ((keypoints1[i].pt.y >= height_low ) && (keypoints1[i].pt.y <= height_high));
if (lowe_condition && black_background_condition)
{
matches.push_back(knn_matches[i][0]);
}
}
我正在研究 ROS Melodic 中的 OpenCV 4。在 undistort()
之后,图像具有由 SURF 检测到的黑色背景。我怎样才能解决这个问题?
感谢 Micka 的评论,我找到了解决方案。我在低比率测试中过滤了特征:
//-- Filter matches using the Lowe's ratio test
//Default ratio_thresh: 0.7f;
vector<DMatch> matches;
size_t i = 0;
bool lowe_condition = false;
bool black_background_condition = false;
//Filter matches in black background
for (i; i < knn_matches.size(); i++)
{
lowe_condition = (knn_matches[i][0].distance < ratio_thresh * knn_matches[i][1].distance);
black_background_condition = ((keypoints1[i].pt.x >= width_low ) && (keypoints1[i].pt.x <= width_high)) && ((keypoints1[i].pt.y >= height_low ) && (keypoints1[i].pt.y <= height_high));
if (lowe_condition && black_background_condition)
{
matches.push_back(knn_matches[i][0]);
}
}