繁体   English   中英

如何找到两个脚本之间的距离?

[英]How to find the distance between the two discriptos?

我从一组图像的yml文件中有一个词汇表(簇的质心)。现在我已经从一个图像中获取了一个新的SURF描述符。现在我想检查这个新的关键点描述符与词汇表有多远或接近,并保存好和不好的匹配项。一旦我有了好和不好的描述符,我该如何在图像上将它们标记为关键点。我对opencv还是一个新手。有人通过建议或示例代码帮助我。

这是我的示例代码

  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

您可以使用Euclidian距离d = sqrt(a1 ^ 2 + a2 ^ 2 + ... an ^ 2),但在这种情况下,最好使用马氏距离,因为它考虑了分布参数(协方差)。 但是您需要为每个聚类计算协方差,您可以在训练阶段获得协方差。 您有聚类中心,每个聚类都有点,足以进行协方差评估。

暂无
暂无

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

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