【问题标题】:MLESAC isntead of RANSAC with OpenCVPLESAC 代替 RANSAC 与 OpenCV
【发布时间】:2014-05-03 21:05:09
【问题描述】:

是否有任何可用代码可以使用 MLESAC 而不是 RANSAC 和 OpenCV 来查找已知对象?

MLESAC 应该比 RANSAC 更强大。这里提供了一个使用示例:

http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html

【问题讨论】:

    标签: c++ opencv sift


    【解决方案1】:

    您可以使用 PCL 库中的 MLESAC(以及 PROSAC 等)。 http://docs.pointclouds.org/trunk/a02954.html 我不使用 PCL,所以无法举例。

    我正在使用来自 Karel Lebeda 的 LO-RANSAC http://cmp.felk.cvut.cz/software/LO-RANSAC/index.xhtml

    int do_lo = 1; //local optimization
    unsigned int tent_size = tentatives.size();
    double err_threshold = 2.0; //in pixels
    double confidence = 0.99;
    int max_samples = 100000;//max trials
    int inl_limit = 0;//no limit
    if (tent_size >= 5)
    {
      double H[3*3];
      unsigned stats[3];
      double *u2Ptr = new double[tent_size*6], *u2; u2=u2Ptr;
      typedef unsigned char uchar;
      unsigned char *inl2 = new uchar[tent_size];
    
      for( int i = 0; i < tentatives.size(); i++ )
        {
          *u2Ptr =  keypoints_object[ tentatives[i].queryIdx ].pt.x;
          u2Ptr++;
    
          *u2Ptr =  keypoints_object[ tentatives[i].queryIdx ].pt.y;
          u2Ptr++;
          *u2Ptr =  1.;
          u2Ptr++;
    
          *u2Ptr =   keypoints_scene[ tentatives[i].trainIdx ].pt.x;
          u2Ptr++;
    
          *u2Ptr =   keypoints_scene[ tentatives[i].trainIdx ].pt.y;
          u2Ptr++;
          *u2Ptr =  1.;
          u2Ptr++;
        }
      ransacH(u2, tent_size, err_threshold*err_threshold, confidence, max_samples, do_lo, , H, inl2,stats);
      for(i=0; i < tent_size; i++)
        if (inl2[i])
          inliers.push_back(good_matches[i]);
    
      delete[] u2; delete[] inl2;
    

    【讨论】:

    猜你喜欢
    • 2015-03-30
    • 2016-03-05
    • 1970-01-01
    • 2016-11-24
    • 2012-09-12
    • 2015-11-09
    • 2012-08-16
    • 2016-04-15
    • 1970-01-01
    相关资源
    最近更新 更多