ICE-BA架构总结
Backend
App
main()
Config
param.txt
BundleAdjustment
GlobalBundleAdjustor
LocalBundleAdjustor
Geometry
Camera: info, intrinsic, depth
IMU
Coordinate Trans
Map
Feature
Frame
LocalMap
GlobalMap
Utility
Aligned Vector/Matrix
IBA (Incremental Bundle Adjustment)
SIMD
IBA: info, keyframe, point, … etc
Parameter Set
LinearAlgebra
Matrix MXN.h
VectorN.h
MultiThread
Timer
……
Visualization
Frontend
cameras
Camera Base
Distortion
Feature track & operation
ORB feature
pyramid
quaternion
timer
parameter load
draw and view
new image & imu
均值滤波3X3
main()
build_img_pyramids
build_pyramids
fast_pyra_down
快速建⽴4层⾦字塔, ratio = 2
IntegrateQuaternion
optical_flow_and_detect
仅预积分四元数部分
光流跟踪old feature并新增new feature, 在key_pnts中更新
slave_img_feat_propagator.PropagateFeatures
寻找Right Image对应feature, 在key_pnts_slave中更新
create_iba_frame
PushCurrentFrame
PushCurrentFrame
建⽴ new CF, 更新 mp measurement zs;
若超过20个new feature被发现或者跟踪到的feature总数⼩于20,创
建KF;
建⽴新KF, 更新zs,push_back new MP to Xs;
更新m_ILF,预处理光流跟踪的MP并转化为m_ILF的m_zs, m_Zs
imu预处理并更新m_us,
PushKeyFrame
更新m_IKF,预处理new MP并转化为m_IKF的GlobalMap:Point m_Xs
更新所有index关联信息,m_xs、m_ds信息
m_LM.IBA_PushCurrentFrame
更新IBA中的m_CsLF, m_CsKF, m_iKF2d, m_ds,为新帧处理做准备
display
m_LBA.WakeUp
唤醒LocalBA线程
optical_flow_and_detect()
标记所有feature点为未跟踪
mark_all_feature_tracks_dead ()
光流跟踪
propagate_with_optical_flow ()
在⾦字塔level 1进⾏跟踪,
计算harris response并反畸变,
选择response⾼的strong features
判断是否需要再检测新feature点
判断条件:特征点过于集中;特征点过少
XPTrackerInvoker()
光流法跟踪feature
XPcalcOpticalFlowPyrLK()
redo
若为true,检测新feature点
detect->detect_orb_features()
在level1层⾦字塔,利⽤fast在25*25⽅格
内寻找feature,⾼斯平滑,之后⽤harris
重新计算response,
根据光流移动dist排除outlier点
filter_outlier_flows()
清除未被跟踪到的feature点
feature_tracks_map_.erase(ft_it)
排序并排除过于靠近的feature点
XpEnforceKeyPointUniformity()
若需要orb描述⼦,则计算feature⽅向
computeOrientation()
计算前后帧亮度变化
特征响应排序并排除分布集中
或重合在⼀起的feature点;
在level0根据⼩范围response做加权平均
修正feature; refine_kp_in_larger_img()
滤除前后帧位置变化过⼤feature;
将⻓时间跟踪的feature更新为new
feature; 更新feature track状态
在level1 计算response并排除weak
feature;
计算orb描述⼦
计算orb描述⼦
Incremental, Consistent and Efficient Bundle Adjustment
(ICE-BA)
Global BA:
并⾏优化所有被选为keyframe的帧
Local BA:
并⾏优化在sliding window中的50个local frame
Cost Function:
where
we solve δφ by normal equation:
Thus, we incrementally update:
where
By Schur complement, we divide δφ into δφc and δφp
We efficiently compute S & s corresponding to (i1, i2) camera pair:
We only update Sij & si which has changed after last iter:
Then by PCG, we solve δφc, back-substituting δφc, δφp solved:
An improvement for Local BA:
To make S sparser and keep the number of features to be re-liearization smaller, we split the
origin long feature track into several short overlapping sub-tracks. we solving Schur
complement with this sub-tracks point and finally update 3D feature points with origin point.
Result: 2~10 times faster than original IBA.
Incremental PCG for IBA
We use PCG to iterately solve function above. For one frame, if δφc is not large enough, the
result of the next iteration δφc+ will be very close to the presions one δφc-. To accelerate
convergence of PCG, we initialize these kinds of frames δφc+ = δφc- instead of δφc+ =0.
Result: 20% due to better convergence.
Relative Marginalization
LocalBundleAdjustor::Run()
SynchronizeData()
synchronize preintegration, iLF/iKF info, Feature measurement info, push keyframe to
GBA init or update new MP/iLF/iKF m_d, LF/KF matching info, MP tracking info, ST info,
many u
while (!
max_iteration)
UpdateFactors()
update vision/imu/prior factors
UpdateSchurComplement()
更新与frame pos相关的Schur部分
SolveSchurComplement()
求解Schur Complement
SolveBackSubstitution()
SolveGradientDescent()
SolveDogLeg()
UpdateStatesPropose()
ComputeReduction()
UpdateStatesDecide()
EmbeddedPointIteration()
UpdateData()
m_callback()
preintegration, m_C updated
判断new MP的m_d是否可⽤,通常不可⽤
while (!new frame/keyframe .empty())
resize and update m_ic2LF
find measurement matches in last ST
and update ST in these pre_frames
and corresponding first find KF
if frame
if keyframe
create new ST
更新ILF的m_d为其所有
feature点深度的加权平均
根据相同的
frame,更新IKF的
参数
SearchMatchingKeyFrames()
SearchMatchingKeyFrames()
update preintegration delta D
MakeZero
PushKeyFrame()
resize and init IKF, update us
寻找关联最紧密的
keyframe, update
m_iKFNearest
PushLocalFrame()
m_GBA->WakeUp()
将SlidingWindow中所有frame的坐标
转换到Nearest KeyFrame坐标系
更新相关的us
若为同时的LF, update LF new MP, add new ST;
若为其他LF, 更新两者之间的match关系
m_GBA->PushKeyFrame()