64,636
社区成员
发帖
与我相关
我的任务
分享
int RobustMatcher::ratioTest(std::vector<std::vector<cv::DMatch> >
&matches)
{
int removed = 0;
// for all matches
for (std::vector<std::vector<cv::DMatch> >::iterator
matchIterator = matches.begin();
matchIterator != matches.end(); ++matchIterator)
{
// if 2 NN has been identified
if (matchIterator->size() > 1)
{
// check distance ratio
if ((*matchIterator)[0].distance /
(*matchIterator)[1].distance > ratio)
{
matchIterator->clear(); // remove match
removed++;
}
}
else
{ // does not have 2 neighbours
matchIterator->clear(); // remove match
removed++;
}
}
return removed;//返回被删除的点数量
}
typename std::vector<int> CIntArr;
std::vector<CIntArr> vec; // 你就把CIntArr看成一个 int arr[n];就是一个新的数据结构
std::vector<CIntArr>::iterator iter; // 这里就是 CIntArr*;
CIntArr* pArr = iter;
CIntArr& arr = *iter;
arr.push_back(0); // 即 CIntArr中加入一个元素
arr.push_back(1);
int n = arr[0];