DSO附件
Direct Sparse Model
特點:優化時把相機內參,相機外參,和地圖點的逆深度全放在一起優化,使用滑動窗口策略邊緣化掉舊的變量,滑動窗口內用 BA 進行優化,BA 優化兩個特點,一個是地圖點優化只有逆深度,而不是3維坐標,另一個是損失函數是photometric error(像素值相減),而不是 geometric error(圖像坐標相減)。
光度相機模型
對于直接法來說,在求解的時候把 photometric camera model(map real-world energy received by a pixel on the sensor(irradiance) to the respective intensity value)考慮進去比非直接法好處大,因為非直接法像提特征,特征對于光照明暗變化等因素本身就具備不變性。
photometric camera model 標定
Ii(x)=G(tiV(x)Bi(x))?
其中?Ii(x)?表示像素?x?處相機獲取到的像素值。ti?表示相機的曝光時間,V(x)?表示像素點處能量衰減函數,Bi(x)?表示輻照度(像素點處接收到的能量),G(x)?表示 gamma 矯正(將接收到的能量轉換成像素值)。
photometric correction 關系式如下:?
矯正過的圖像是?tiBi(x)?的形式,后續在計算 photometric derror 實際計算的是?Bi(x)?誤差,所以還需要把曝光時間考慮在內。
Model Formulation
每個點的能量函數如下:?
其中?Np?是點?p?的鄰域點,Np?分布如下:?
?
Note that in terms of the contained information, evaluating the SSD over such a small neighborhood of pixels is similar to adding first- and second-order irradiance derivative con-stancy terms (in addition to irradiance constancy) for the central pixel.
圖像?Ii,Ij?的曝光時間為?ti,tj,||?||r?是 Huber norm。p′?是點?P?根據逆深度參數?dp?得到的,如下:?
?
其中:?
?
公式 6 中,Ti,Tj?是待求的位姿參數。?
為了讓方法能在不知道曝光時間的情況下工作,算法還加了一個 affine brightness transfer function:?e?ai(Ii?bi),ai,bi?也是待優化的參數。
除了用 robust Huber norm,還對能量函數加了權值,權值計算方式如下:?
?
權值會減弱梯度大的地方的影響。?
This weighting function can be probabilistically interpreted as adding small, independent geometric noise on the projected point position p , and immediately marginalizing it – approximating small geometric error.?
所以待優化的參數有:每個點的逆深度,相機內參,每幀圖像的 pose,每幀圖像的 brightness transfer function 參數?ai,bi,aj,bj。
系統總優化的能量函數包括:?
?
其中?i?是當期存在的圖像,p?是圖像?Pi?中的點,j?是點?p?在 active keyframe 中的觀測。?
有上述關系式形成的 factor graph 如下:?
和一般的重投影誤差不同,公式 4 中的重投影誤差取決于兩個圖像的 pose,而不是一個圖像的 pose。?
The only difference to the classical reprojection error is the additional dependency of each residual on the pose of the host frame, i.e., each term depends on two frames instead of only one. While this adds off-diagonal entries to the pose-pose block of the Hessian, it does not affect the sparsity pattern after application of the Schur complement to marginalize point parameters.
如果曝光時間已知,還會添加下面一項,放在能量函數中使得 brightness transfer function?ai,bi?趨于 0(只有曝光時間就夠了)。?
?
如果曝光時間不已知,則將?λa?和?λb?設為 0,這時?ai,bi?用來對變化的曝光時間進行建模。
Point Dimensionality
和 indirect 方法不同,算法只用逆深度一個參數來表示地圖點待優化參數,如果像素坐標已知,地圖點的未知量只有深度值,使用逆深度一個參數的好處:better suited to represent uncertainty from stereo-based depth estimation, in particular for far-away points.
consistency
對于地圖點的同一個點可能會初始化好幾次(盡管算法盡量把地圖點均勻分布在空間中,這種情況也難以避免),這時對于一個圖像中的點可能會有多個觀測,這種情況在實際中也可以通過消除對同一個點的多個觀測消除掉。
Windowed Optimization
Gauss-Newton Optimization
每個點優化的誤差項:?
?
對于 additive increment?x?雅各比:?
?
注意,這里是對增量的雅各比。
在邊緣化的時候跟 okvis 一樣也是使用 First Estimate Jacobians 形式。?
優化的時候用高斯牛頓法而不是 LM 算法,We found that since we never start far-away from the minimum – a Levenberg-Marquad dampening (which slows down convergence) is not required.?
LM 算法綜合了梯度下降和高斯牛頓法,在距離極小值近時,高斯牛頓二階近似比梯度下降一階近似好,這里離極小值近,直接選用高斯牛頓法。
Marginalization
目標函數近似如下:?
?
上式中,H?是根據對 additive increment?x?的雅各比計算的,所以寫成?x?x0?形式。?
15 式去掉常數項化為:?
?
執行舍而補得到?Hαα?xα=b′α??
其中:?
?
所以誤差變為:?
?
誤差 19 can be trivially added to the full photometric error during all subsequent optimization and marginalization operations. 這里的?b′α??的表達式和 okvis 里更新?b?的表達式還不同。
Visual Odometry Front-End
Frame management
initial frame tracking
當一個新關鍵幀初始化時,所有的 active point 向新關鍵幀做投影,并且在新關鍵幀創建一個 semi-dense depht map,新來的幀和新關鍵幀匹配計算位姿時,用 constant motion model 初始化新來幀的位姿,和新關鍵幀用金字塔直接法匹配計算精確位姿。
如果新來的幀跟丟了,則在 27 個方向上初始化位姿,檢驗 27 個方向上初始化的位姿是否有有效的。
Keyframe creation
系統保留 5-10 個 active keyframe(系統用來匹配和參與優化的關鍵幀)。上一幀關鍵幀和上一幀圖像相似度較小時,相機位移較大時,或者曝光時間變化較大時,創建新的關鍵幀。
Keyframe Marginalization
假設有?I1,I2,In...?個 active keyframe,假設?I1?是最新的一幀關鍵幀,In?是最老的一幀關鍵幀,active keyframe 管理方法如下:?
1,總是保留最近的兩幀關鍵幀?I1,I2。?
2,邊緣化掉和?I1?有小于 5% 共視點的關鍵幀。?
3,如果比系統設定的 active keyframe 關鍵幀數目多,則邊緣掉除了?I1,I2?外的某個關鍵幀,某個關鍵幀是公式 20 得分最高的關鍵幀。?
?
公式 20 設計是為了把關鍵幀均與分布在空間中。?
選取關鍵幀示意圖:?
在進行邊緣化某一幀時,先邊緣化掉幀里的所有點(如 Figure 5 所示,地圖點是有從屬關系的),然后再邊緣掉幀的其他參數(位姿,affine transfer function)。為了保持 Hessian 矩陣的稀疏結構,被邊緣化掉幀所有的觀測被直接舍棄掉(觀測對應損失函數中的誤差項,有些點不屬于被邊緣掉的幀,但是在幀中有觀測)。
Point Management
選取點的策略?
heavily sub-sample data to allow processing it in real time in a joint optimization framework. In fact, our experiments show that image data is highly redundant, and the benefit of simply using more data points quickly flattens off.
在優化的時候保持 2000 個 active points。開始的時候在新的關鍵幀中生成候選點,候選點并不立即放到優化中,而是和后面的幀跟蹤初始化得到 3D 坐標。2,當需要插入新的優化點時(參與到目標函數中的點),從候選點中選取插入進來。
candidate point selection
選擇的候選點盡量在圖像中均與分布,而且是梯度值較大的點。
Candidate point tracking
候選點在新關鍵幀后用 discrete search 的策略在極線上搜索,選取使得 photometric error 最小的點計算深度和方差,深度和方差用于后續幀的匹配。
Candidata Point Activation
當舊的變量被邊緣化掉后,初始化新的點來代替他們,將所有的候選點向最近的關鍵幀做投影,在候選點中選取和圖像中存在的地圖點最遠的點初始化(為了使得選擇的候選點均勻分布在圖像和空間中)。
Outline and Occusion Detection
在極線搜索候選點跟蹤時,誤差不夠小的點被剔除。?
地圖點的觀測 photometric error 大于一定值的被剔除。
參考文獻:?
Engel J, Koltun V, Cremers D. Direct sparse odometry[J]. arXiv preprint arXiv:1607.02565, 2016.
總結
- 上一篇: 霸气爱情个性签名超酷
- 下一篇: 通草炖猪蹄怎么那么难吃?