2011-11-24 387 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