简体   繁体   English

OpenCV代码,用于将列表中存储的描述符与新的图像描述符进行比较

[英]OpenCV Code to compare descriptors stored in a list with new image descriptors

I'm currently doing a research on Automatic traffic sign detection using SIFT algorithm for final year University project. 我目前正在针对大学最后一年的项目,使用SIFT算法进行自动交通标志检测的研究。 I am using OpenCV and at the moment I have reached until find Descriptors of an image. 我正在使用OpenCV,目前为止,直到找到图像的描述符为止。 I am storing this SIFT features in a list using following code, 我使用以下代码将这个SIFT功能存储在列表中,

vector<Descriptor> m_keyDescs;

m_keyDescs.push_back(Descriptor(descxi, descyi, fv));

Now I want to use this features to compare with a new image and I want to recognize whether the new image is same as the previous image. 现在,我想使用此功能与新图像进行比较,并且想要识别新图像是否与先前图像相同。 But I have no idea how to use this features that stored in a list to identify new image. 但是我不知道如何使用存储在列表中的此功能来识别新图像。 How can I retrieve this stored list and compare with newly created Descriptors of an image?? 如何检索此存储的列表并与新创建的图像描述符进行比较?

I am so glad if you can help me as I'm new to OpenCV. 我很高兴能为您提供帮助,因为我是OpenCV的新手。 :) :)

I have defined Descriptor class as, 我已经定义了Descriptor类,

 class Descriptor
 {
 public:
 float xi, yi;      
 vector<double> fv; // Feature vector

Descriptor()
{
}

Descriptor(float x, float y, vector<double> const& f)
{
    xi = x;
    yi = y;
    fv = f;
}
};

Thanks for your kind consideration... 感谢您的友好考虑...

To match Descriptors you need a DescriptorMatcher (like BruteForceMatcher in this example ). 要匹配Descriptor,您需要一个DescriptorMatcher (例如本示例中的 BruteForceMatcher )。 More documentation on those can be found on OpenCV site here 可以在OpenCV网站上找到有关这些文件的更多文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM