2011-11-24 392 views
5

我嘗試使用cvMatchShapes()來匹配兩個標記模式。正如你可以在Best way to count number of "White Blobs" in a Thresholded IplImage in OpenCV 2.3.0看到的那樣,信息源的圖像質量很差。提高OpenCV中cvMatchShapes的匹配精度

我對從該函數返回的結果不滿意,大多數時候它給出了不正確的匹配。如何使用此功能(或某些合適的功能)進行有效匹配?

注意:我的備用解決方案是更改標記圖案以具有相當大/清晰可見的形狀。請訪問上面的鏈接查看我目前的標記模式。

編輯

我發現在OpenCV中實施的各種特徵檢測算法,這種全面的比較。 http://computer-vision-talks.com/2011/01/comparison-of-the-opencvs-feature-detection-algorithms-2。據說FAST似乎是一個不錯的選擇。

我會給+1給誰可以分享一個很好的教程在OpenCV中實現FAST(否則STAR/SURF/SIFT)的任何人。我無法谷歌認爲速度 :(

+0

在您的編輯中,您可以鏈接到OpenCV中提供的各種特徵檢測器測試。然後你要求一個特徵探測器。在OpenCV中 – Sam

回答

3

Here是FAST發明者的網站。FAST代表來自加速段測試特色:Here是基於AST短的維基百科條目算法。此外,here是不同功能的探測器的一個很好的調查目前正在使用的今天。

FAST實際上已經被OpenCV的實現,如果你想使用它們的實現。

編輯:這裏是我創建向你展示瞭如何使用快速檢測儀短的例子:

#include <opencv2/core/core.hpp> 
#include <opencv2/highgui/highgui.hpp> 
#include <opencv2/imgproc/imgproc.hpp> 
#include <opencv2/features2d/features2d.hpp> 
#include <vector> 

using namespace std; 
using namespace cv; 

int main(int argc, char* argv[]) 
{ 
    Mat far = imread("far.jpg", 0); 
    Mat near = imread("near.jpg", 0); 

    Ptr<FeatureDetector> detector = FeatureDetector::create("FAST"); 

    vector<KeyPoint> farPoints; 
    detector->detect(far, farPoints); 

    Mat farColor; 
    cvtColor(far, farColor, CV_GRAY2BGR); 
    drawKeypoints(farColor, farPoints, farColor, Scalar(255, 0, 0), DrawMatchesFlags::DRAW_OVER_OUTIMG); 
    imshow("farColor", farColor); 
    imwrite("farPoints.jpg", farColor); 

    vector<KeyPoint> nearPoints; 
    detector->detect(near, nearPoints); 

    Mat nearColor; 
    cvtColor(near, nearColor, CV_GRAY2BGR); 
    drawKeypoints(nearColor, nearPoints, nearColor, Scalar(0, 255, 0), DrawMatchesFlags::DRAW_OVER_OUTIMG); 
    imshow("nearColor", nearColor); 
    imwrite("nearPoints.jpg", nearColor); 

    waitKey(); 
    return 0; 
} 

這個代碼是找到後續的特徵點的遠近圖像:
near imagefar image

正如您所看到的,近距離圖像具有更多特徵,但看起來像是使用遠距離圖像檢測到相同的基本結構。所以,你應該能夠匹配這些。看看descriptor_extractor_matcher.cpp。這應該讓你開始。

希望有幫助!

+0

這些特徵檢測算法是否可以處理質量較差的圖像以及http://stackoverflow.com/questions/8259655/best-way-to-count-number-of-white-blobs-in-a -thresholded-iplimage-in-opencv-2? – coder9