SVO笔记 - Feature alignment

SVO - Feature alignment

主要计算集中在 Reprojector 中。

  // map reprojection & feature alignment
  SVO_START_TIMER("reproject");
  reprojector_.reprojectMap(new_frame_, overlap_kfs_);
  SVO_STOP_TIMER("reproject");
Reprojector::reprojectMap()
    map_.getCloseKeyframes(frame, close_kfs);
        [kf_loop]
            frame->isVisible();
    [kf_loop]
        [fts_loop]
            reprojectPoint(frame, (*it_ftr)->point);
                frame->cam_->isInFrame(px.cast<int>(), 8)
    ---
    [cell_loop]
        reprojectCell(*grid_.cells.at(grid_.cell_order[i]), frame);

Map Reprojection

map 中的 3D 点投影到图片中,并找到对应的 feature
每个 grid 一个 3D 点。既保证均匀分布,又减小计算量。

// 通过 isVisible() 判断 map 点是否在视野内;找到与当前帧视场重叠的关键帧;
  map_.getCloseKeyframes(frame, close_kfs);
  //close_kfs < 关键帧,与 cur 距离>
// sort(); 按照 当前帧 与 关键帧 的**位移**,对找到的 关键帧 排序;
for(; options_.max_n_kfs ;){
   
   
    //将 close_kfs 中前 max_n_kfs 个关键帧取出;
    overlap_kfs.push_back(pair<FramePtr,size_t>(ref_frame,0));
        ...
    //重投影到像素坐标系,判断其是否 isInFrame();
    reprojectPoint(frame, (*it_ftr)->point)
}

// reproject candidates 略

Feature Align

  • reprojectPoint() 中,为 cellpt 建立指针链接;
  SVO_START_TIMER("feature_align");
  for(size_t i=0; i<grid_.cells.size(); ++i)
  {
     
     
    if(reprojectCell(*grid_.cells.at(grid_.cell_order[i]), frame))
      ++n_matches_;
    if(n_matches_ > (size_t) Config::maxFts())
      break;
  }
  SVO_STOP_TIMER("feature_align");

reprojectCell();

    found_match = matcher_.findMatchDirect(*it->pt, *frame, it->px);
        //找到视角偏差最小的 kf, 返回对应的 &ftr; [closest observation angle]
        pt.getCloseViewObs(cur_frame.pos(), ref_ftr_);
        //判断 patch 是否在视野内;排除边缘点;
        ref_ftr_->frame->cam_->isInFrame(像素坐标, halfpatch_size_+2, ref_ftr_->level)
        // 计算放射矩阵
        warp::getWarpMatrixAffine(...);
        //找到 cur 与 ref 缩放比例一致的 level;
        warp::getBestSearchLevel(A_cur_ref_, Config::nPyrLevels()-1);
        //得到 ref 中平行四边形状的 patch 图像;
        warp::warpAffine(...);
            //双线性插值函数
            vk::interpolateMat_8u(img_ref, px[0], px[1]);
        feature_alignment::align2D();
        
    Feature* new_feature = new Feature(frame.get(), it->px, matcher_.search_level_);
    frame->addFeature(new_feature);

    new_feature->point = it->pt;
warp::getWarpMatrixAffine();

ref 中特征点对应的 5x5 half_patchT 转换到 cur,通过 half_patch 上三点,计算 Affine 矩阵。

参考:https://blog.youkuaiyun.com/xbcreal/article/details/52549629

getBestSearchLevel()

找到 curref patch 缩放比例一致的 level

A=[cosθ−sinθsinθcosθ][s00s] A = \begin{bmatrix}cos\theta & -sin\theta\\ sin\theta & cos\theta \end{bmatrix} \begin{bmatrix}s & 0 \\ 0 & s \end{bmatrix} A=[cosθsinθ

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值