Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

flann RadiusSearch

I'm trying to test how radiusSearch work.I put 1 points as argument and expecting that in id vector it will first, but it doesn't and sometimes it'snt even present in id. maybe this happens because of flann give aproccimate solution, but I use LinearIndexParams. And another question is how can I know how many points it return?

vector<cv::Point2f> scheme_pts;
//cv::flann::Index tree= cv::flann::Index(cv::Mat(scheme_pts).reshape(1),cv::flann::KDTreeIndexParams(1));
cv::flann::Index tree= cv::flann::Index(cv::Mat(scheme_pts).reshape(1),cv::flann::LinearIndexParams());
//cv::flann::Index tree= cv::flann::Index(cv::Mat(scheme_pts).reshape(1),cv::flann::AutotunedIndexParams(1,0,0,1));

vector<float> vec_f(2);
vector<int> id(scheme_pts.size()); //size?
vector<float> dists(scheme_pts.size());//size?
cv::flann::SearchParams params; //32 //precision? what if use LinearIndexParams?
float radius=10;//metric?
for(int i=0;i<scheme_pts.size();++i)
{
  vec_f[0]= scheme_pts[i].x;
  vec_f[1]= scheme_pts[i].y;
  tree.radiusSearch(vec_f,id,dists,radius,params);
}

flann RadiusSearch

I'm trying to test how radiusSearch work.I put 1 points as argument and expecting that in id vector it will be first, but it doesn't and sometimes it'snt even present in id. id vector, maybe this happens because of flann give aproccimate approximate solution, but I use LinearIndexParams. And another question is how can I know how many points it RadiusSearch return?

vector<cv::Point2f> scheme_pts;
//cv::flann::Index tree= cv::flann::Index(cv::Mat(scheme_pts).reshape(1),cv::flann::KDTreeIndexParams(1));
cv::flann::Index tree= cv::flann::Index(cv::Mat(scheme_pts).reshape(1),cv::flann::LinearIndexParams());
//cv::flann::Index tree= cv::flann::Index(cv::Mat(scheme_pts).reshape(1),cv::flann::AutotunedIndexParams(1,0,0,1));

vector<float> vec_f(2);
vector<int> id(scheme_pts.size()); //size?
vector<float> dists(scheme_pts.size());//size?
cv::flann::SearchParams params; //32 //precision? what if use LinearIndexParams?
float radius=10;//metric?
for(int i=0;i<scheme_pts.size();++i)
{
  vec_f[0]= scheme_pts[i].x;
  vec_f[1]= scheme_pts[i].y;
  tree.radiusSearch(vec_f,id,dists,radius,params);
}