无时间戳延迟时,残差计算流程:
世界坐标系中的第 l l l 个地图点变换到相机坐标系下为
f l w = [ x , y , z ] T f_l^w=[x,y,z]^T flw=[x,y,z]T
变换到相机坐标系下为
f l c i = R c b R w b i T ( f l w − p w b i ) + p c b f_l^{c_i}=R_{cb}R_{wb_i}^T(f_l^w - p_{wb_i}) + p_{cb} flci=RcbRwbiT(flw−pwbi)+pcb
观察上式,易知转换的过程为先从世界坐标系转换到body坐标系,再从body坐标系转换到相机坐标系
再投影到图像平面,并计算重投影残差:
r c = [ x l i / z l i − u l i , y l i / z l i − v l i ] T r_c = [x_l^i/z_l^i - u_l^i, y_l^i/z_l^i-v_l^i]^T rc=[xli/zli−uli,yli/zli−vli]T
u l i , v l i u_l^i,v_l^i uli,vli为相机成像像素位置。
考虑时间戳延迟时,特征坐标进行补偿
Z l i ( t d ) = [ u l i , v l i ] T + t d V l i Z_l^i(t_d)=[u_l^i, v_l^i]^T + t_dV_l^i Zli(td)=[uli,vli]T+tdVli
其中
V l k = ( [ u l k + 1 , v l k + 1 ] T − [ u l k , v l k ] T ) / ( t k + 1 − t k ) V_l^k = ([u_l^{k+1}, v_l^{k+1}]^T - [u_l^{k}, v_l^{k}]^T)/(t_{k+1}-t_k) Vlk=([ulk+1,vlk+1]T−[ulk,vlk]T)/(tk+1−tk)
回顾相机投影矩阵,我们有
[ u v 1 ] = [ − f x 0 u 0 0 f y v 0 0 0 1 ] [ x / z y / z 1 ] \begin{bmatrix} u \\ v \\ 1 \end{bmatrix}= \begin{bmatrix} -f_x & 0 & u_0 \\ 0 & f_y & v_0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x/z \\ y/z \\ 1 \end{bmatrix} uv1 = −fx000fy0u0v01 x/zy/z1
令 [ − f x 0 u 0 0 f y v 0 0 0 1 ] = K \begin{bmatrix} -f_x & 0 & u_0 \\ 0 & f_y & v_0 \\ 0 & 0 & 1 \end{bmatrix}=K −fx000fy0u0v01 =K, [ u v 1 ] = p c \begin{bmatrix} u \\v \\1 \end{bmatrix}=p^c uv1 =pc, [ x y z ] = p w \begin{bmatrix} x \\ y \\ z \end{bmatrix}=p^w xyz =pw, z = 1 λ z = \frac{1}{\lambda} z=λ1
有
p c = 1 λ K − 1 p c p_{c} = \frac{1}{\lambda} K^{-1} p^c pc=λ1K−1pc
其中。 p c p^c pc为特征点在相机归一化平面内的成像坐标。 p c p_{c} pc为相机坐标系下特征点的坐标。
标记 i i i时刻对特征点的观测 Z i Z_i Zi在相机坐标系下的坐标值为 p c i p_{c}^i pci
p c i = 1 λ K − 1 p i c p_{c}^i = \frac{1}{\lambda} K^{-1} p_i^c pci=λ1K−1pic
p b i = R b c p c i + t b c p_{b}^i = R_{bc}p_c^i+t_{bc} pbi=Rbcpci+tbc
p w i = R w b i p b i + t w b i p_{w}^i = R_{wb}^ip_b^i+t_{wb}^i pwi=Rwbipbi+twbi
p w i = R w b i ( R b c p c i + t b c ) + t w b i p_{w}^i = R_{wb}^i(R_{bc}p_c^i+t_{bc})+t_{wb}^i pwi=Rwbi(Rbcpci+tbc)+twbi
从 i i i时刻到 j j j时刻,观测点 Z Z Z在相机坐标系下的位置如下
p w i = p w j p_w^i=p_w^j pwi=pwj
p c j = R c b p b j + t c b p_c^j = R_{cb}p_b^j+t_{cb} pcj=Rcbpbj+tcb
p b j = R b w j p w j + t b w j p_b^j = R_{bw}^jp_w^j+t_{bw}^j pbj=Rbwjpwj+tbwj
p c j = R c b ( R b w j p w j + t b w j ) + t c b p_c^j = R_{cb}(R_{bw}^jp_w^j+t_{bw}^j)+t_{cb} pcj=Rcb(Rbwjpwj+tbwj)+tcb
由此可得在相机成像坐标系下的坐标
p j c = λ K p c j p_j^c = \lambda K p_c^j pjc=λKpcj
p j c = λ K R c b ( R b w j p w j + t b w j ) + t c b p_j^c = \lambda K R_{cb}(R_{bw}^jp_w^j+t_{bw}^j)+t_{cb} pjc=λKRcb(Rbwjpwj+tbwj)+tcb
p j c = λ K R c b ( R b w j p w i + t b w j ) + t c b p_j^c = \lambda K R_{cb}(R_{bw}^jp_w^i+t_{bw}^j)+t_{cb} pjc=λKRcb(Rbwjpwi+tbwj)+tcb
有因为
p w i = R w b i ( R b c p c i + t b c ) + t w b i p_{w}^i = R_{wb}^i(R_{bc}p_c^i+t_{bc})+t_{wb}^i pwi=Rwbi(Rbcpci+tbc)+twbi
p j c = λ K R c b ( R b w j ( R w b i ( R b c p c i + t b c ) + t w b i ) + t b w j ) + t c b p_j^c = \lambda K R_{cb}(R_{bw}^j(R_{wb}^i(R_{bc}p_c^i+t_{bc})+t_{wb}^i)+t_{bw}^j)+t_{cb} pjc=λKRcb(Rbwj(Rwbi(Rbcpci+tbc)+twbi)+tbwj)+tcb
其中
p c i = 1 λ K − 1 p i c p_{c}^i = \frac{1}{\lambda} K^{-1} p_i^c pci=λ1K−1pic
p j c = λ K R c b ( R b w j ( R w b i ( R b c ( 1 λ K − 1 p i c ) + t b c ) + t w b i ) + t b w j ) + t c b p_j^c = \lambda K R_{cb}(R_{bw}^j(R_{wb}^i(R_{bc}(\frac{1}{\lambda} K^{-1} p_i^c)+t_{bc})+t_{wb}^i)+t_{bw}^j)+t_{cb} pjc=λKRcb(Rbwj(Rwbi(Rbc(λ1K−1pic)+tbc)+twbi)+tbwj)+tcb
残差为
r = [ 1 0 0 0 1 0 ] ( p j c − [ u j v j 1 ] ) r = \begin{bmatrix}1 & 0 & 0\\ 0 & 1 & 0 \end{bmatrix} (p_j^c -\begin{bmatrix} u_j \\ v_j \\ 1 \end{bmatrix}) r=[100100](pjc− ujvj1 )
令 [ 1 0 0 0 1 0 ] = D \begin{bmatrix}1 & 0 & 0\\ 0 & 1 & 0 \end{bmatrix}=D [100100]=D
r = D ( p j c − [ u j v j 1 ] ) r = D(p_j^c -\begin{bmatrix} u_j \\ v_j \\ 1 \end{bmatrix}) r=D(pjc− ujvj1 )
考虑时间戳延迟时,特征坐标进行补偿
Z l j ( t d ) = [ u l j , v l j ] T + t d V l j Z_l^j(t_d)=[u_l^j, v_l^j]^T + t_dV_l^j Zlj(td)=[ulj,vlj]T+tdVlj
其中
V l k = ( [ u l k + 1 , v l k + 1 ] T − [ u l k , v l k ] T ) / ( t k + 1 − t k ) V_l^k = ([u_l^{k+1}, v_l^{k+1}]^T - [u_l^{k}, v_l^{k}]^T)/(t_{k+1}-t_k) Vlk=([ulk+1,vlk+1]T−[ulk,vlk]T)/(tk+1−tk)
r = D p j c − Z l j ( t d ) r = Dp_j^c - Z_l^j(t_d) r=Dpjc−Zlj(td)