C++ 带有OpenCV的RANSAC的MLESAC isntead
是否有可用的代码使用MLESAC而不是RANSAC与OpenCV一起查找已知对象 MLESAC应该比RANSAC更加健壮。此处提供了一个使用示例: 您可以使用PCL库中的MLESAC(以及PROSAC等)。 我不使用PCL,因此无法举例说明 我用的是Karel Lebeda的LO-RANSACC++ 带有OpenCV的RANSAC的MLESAC isntead,c++,opencv,sift,C++,Opencv,Sift,是否有可用的代码使用MLESAC而不是RANSAC与OpenCV一起查找已知对象 MLESAC应该比RANSAC更加健壮。此处提供了一个使用示例: 您可以使用PCL库中的MLESAC(以及PROSAC等)。 我不使用PCL,因此无法举例说明 我用的是Karel Lebeda的LO-RANSAC int do_lo=1//局部优化 无符号int tent_size=tentives.size(); 双误差阈值=2.0//以像素为单位 双置信度=0.99; int max_样本=100000//最
int do_lo=1//局部优化
无符号int tent_size=tentives.size();
双误差阈值=2.0//以像素为单位
双置信度=0.99;
int max_样本=100000//最高审判
int inl_limit=0//无限制
如果(帐篷大小>=5)
{
双H[3*3];
未签名统计数据[3];
双人床*u2Ptr=新双人床[帐篷大小*6],*u2;u2=u2Ptr;
typedef无符号字符;
unsigned char*inl2=新的uchar[tent_size];
for(int i=0;i
您是否将其与OpenCV一起使用?您能否举例说明一些要点,例如:添加了一个与LO-RANSAC一起使用的示例。关于PCL-这只是一个建议,我不使用该库。
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;