SLAM代码(一):直方图投票

mac2026-01-20  6

SLAM惯用代码学习

参考链接1 ORB-SLAM2 代码块1.1 直方图投票机制

参考链接

暂时无

1 ORB-SLAM2 代码块

1.1 直方图投票机制

const int ORBmatcher::HISTO_LENGTH = 30; ----------------------------------------------------------------- // Rotation Histogram (to check rotation consistency) 旋转直方图(检查旋转一致性) vector<int> rotHist[HISTO_LENGTH]; for(int i=0;i<HISTO_LENGTH;i++) rotHist[i].reserve(500); const float factor = HISTO_LENGTH/360.0f; ---------------------------------------------------------------- if(mbCheckOrientation) { float rot = LastFrame.mvKeysUn[i].angle-CurrentFrame.mvKeysUn[bestIdx2].angle; if(rot<0.0) rot+=360.0f; int bin = round(rot*factor); if(bin==HISTO_LENGTH) bin=0; assert(bin>=0 && bin<HISTO_LENGTH); rotHist[bin].push_back(bestIdx2); } ---------------------------------------------------- //Apply rotation consistency // 旋转一致检测 if(mbCheckOrientation) { int ind1=-1; int ind2=-1; int ind3=-1; ComputeThreeMaxima(rotHist,HISTO_LENGTH,ind1,ind2,ind3); for(int i=0; i<HISTO_LENGTH; i++) { /**wyp * 如果不属于三个里面的统计直方图里面最大的三个,那么就把这个点进行删除 * */ if(i!=ind1 && i!=ind2 && i!=ind3) { for(size_t j=0, jend=rotHist[i].size(); j<jend; j++) { CurrentFrame.mvpMapPoints[rotHist[i][j]]=static_cast<MapPoint*>(NULL); nmatches--; } } } }
最新回复(0)