2014-05-03 94 views

回答

3

您可以從PCL庫使用MLESAC(以及PROSAC等)。 http://docs.pointclouds.org/trunk/a02954.html 我不使用PCL,所以不能舉個例子。

我真的使用LO-RANSAC從卡雷爾Lebeda 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; 
+0

你使用它與OpenCV的?你可以用KeyPoints做一個例子,例如:http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html – dynamic

+0

已經爲LO-RANSAC添加了一個例子。關於PCL - 這只是建議,我不會使用該庫。 –