如何找到两个描述之间的距离
How to find the distance between the two discriptos?
我在yml文件中有一个来自一组图像的词汇表(簇的质心)。现在我已经从一个图像中获得了一个新的SURF描述符。现在,我想用一些阈值来检查这个新的关键点描述符与词汇表的距离,并保存好的和坏的匹配。一旦我有了好的和坏的描述,我怎么能在图像上把它们标记为关键点。我对opencv很陌生。我已经看过knnMatch,但它只通过指定k来提供良好的匹配。有人能通过建议或示例代码帮助我吗。
这是我的样本代码
Mat dictionary;
FileStorage fs("../bin/dictionary1.yml", FileStorage::READ);
fs["vocabulary"] >> dictionary;
fs.release();
std::vector<KeyPoint> keypoints_1;
detector.detect( img_1, keypoints_1 );
SurfDescriptorExtractor surfDesc;
Mat descriptors1;
surfDesc.compute(img_1, keypoints_1, descriptors1);
我想做一些事情,比如这个
for all image descriptor
for all vacabulary
if(dist is less)
goodmatch
cvcolor=blue
else
badmatch
cvcolor=red
您可以使用欧氏距离d=sqrt(a1^2+a2^2+…an^2),但在这种情况下,最好使用Mahalanobis距离,因为它考虑了分布参数(协方差)。但你需要计算每个集群的协方差,这可以在训练阶段得到。你有集群的中心,每个集群都有点,足以进行协方差评估。
相关文章:
- 如何在C++中从两个单独的for循环中添加两个数组
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 当在同一名称空间中有两个具有相同签名的函数时,会发生什么
- 如何返回一个类的两个对象相加的结果
- 如何在C++中将一个无符号的 int 转换为两个无符号的短裤?
- 如何将两个不同矢量的同一位置的两个元素组合在一起
- 两个字符串在 c++ 中不相等
- 在两个类中共享相同的函数调用,并在不需要时避免空实例化
- 两个文件使用彼此的功能-如何解决
- 为什么Mat类的两个对象可以在不重载运算符+的情况下添加
- 如何确保在使用基于布尔值的两个方法之一调用方法时避免分支预测错误
- 停止cmake target_link_libraries将插件中静态库的两个对象文件链接到静态库本身
- 将fold表达式与std::一起用于两个元组
- NTRUEncrypt:使用开源标准算法中的描述无法正确找到两个多项式的GCD,无法定义是否存在多边形的逆
- 如何找到两个描述之间的距离
- 计算两个描述符之间的距离
- 套接字调用在同时执行的两个或多个线程上提供重复的文件描述符(竞争条件)
- 是否有可能得到两个图像之间的旋转和缩放只有一个冲浪描述符
- 使用符号c++库:如何在objective C中打印矩阵输出描述?因为我加了两个矩阵.代码如下,谢谢
- 使用具有相同对象的两个线程向两个不同的文件描述符写入