ORB-SLAM3 GetFeaturesInArea

📅 2026/8/15 10:59:04
ORB-SLAM3 GetFeaturesInArea
// 在图像指定矩形区域内搜索特征点,返回符合条件的特征点索引 // 参数: // x, y : 搜索中心坐标(像素) // r : 搜索窗口半边长(像素),最终搜索区域为 [x-r, x+r] × [y-r, y+r] // minLevel, maxLevel : 金字塔层级范围(只保留在此层级内的特征点) // bRight : 是否使用右目特征点(双目/双相机模式) vectorsize_t Frame::GetFeaturesInArea(const float x, const float y, const float r, const int minLevel, const int maxLevel, const bool bRight) const { vectorsize_t vIndices; // 存放结果:符合条件的特征点索引 vIndices.reserve(N); // 预分配空间,N为当前帧特征点总数 float factorX = r; // X方向搜索半宽 float factorY = r; // Y方向搜索半高(与X相同,方形窗口) // 计算搜索区域覆盖的网格列范围 [nMinCellX, nMaxCellX] // 网格坐标转换公式:cell = floor((pixel - mnMinX) * mfGridElementWidthInv)