簡體   English   中英

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]);
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM