图像坐标导数的表达式 Expression for Image Coordinate Derivate

Title: 图像坐标导数的表达式 Expression for Image Coordinate Derivate



多视图几何读书笔记

[1] 对极约束及其性质 —— 公式详细推导

[2] [笔记] 仿射变换性质的代数证明

[3] 多视图几何中向量叉乘的矩阵转换恒等式 Matrix Transformation for Cross Product in MVG

[4] 相机标定中绝对二次曲线、圆环点、配极关系之详细推导

[5] 图像坐标导数的表达式 Expression for Image Coordinate Derivate ← \leftarrow 本篇


简单推导一下多视图几何中图像坐标导数的表达式[1].


I. 图像坐标 Image Coordinates

给定二维射影平面 P 2 \mathbb{P}^2 P2 内的一组点集 { x i } \{\mathbf{x}_i\} {xi} 以及另一二维射影平面 P 2 \mathbb{P}^2 P2 内的一组点集 { x i ′ } \{\mathbf{x}'_i\} {xi}. 这两组点集就代表两张不同图片上的像素点.

如果图像之间存在对应关系 x i ↔ x i ′ \mathbf{x}_i \leftrightarrow \mathbf{x}'_i xixi. 则满足如下关系的 3 × 3 3\times 3 3×3 矩阵称为二维单应矩阵 (2D Homography),
H x i = x i ′ for each    i (I-1) H \mathbf{x}_i = \mathbf{x}'_i \quad \text{for each}\; i \tag{I-1} Hxi=xifor eachi(I-1)
假设二维射影平面上存在一点 x \mathbf{x} x 的其次坐标为 x = ( x y w ) \mathbf{x}=\begin{pmatrix}x \\ y \\ w\end{pmatrix} x= xyw , 非齐次坐标为 x ~ = ( x ~ y ~ ) = ( x / w y / w ) \tilde{\mathbf{x}}= \begin{pmatrix}\tilde{x} \\ \tilde{y} \end{pmatrix} =\begin{pmatrix} {x}/{w} \\ {y}/{w} \end{pmatrix} x~=(x~y~)=(x/wy/w).

另一二维射影平面上的对应点 x ′ \mathbf{x}' x 的其次坐标为 x ′ = ( x ′ y ′ w ′ ) \mathbf{x}'=\begin{pmatrix}x' \\ y' \\ w'\end{pmatrix} x= xyw , 非齐次坐标为 x ~ ′ = ( x ~ ′ y ~ ′ ) = ( x ′ / w ′ y ′ / w ′ ) \tilde{\mathbf{x}}'= \begin{pmatrix}\tilde{x}' \\ \tilde{y} ' \end{pmatrix} = \begin{pmatrix}{x'}/{w'} \\ {y'}/{w'} \end{pmatrix} x~=(x~y~)=(x/wy/w).

存在单应矩阵
x ′ = H x ⇒ ( x ′ y ′ w ′ ) = [ h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 ] ( x y w ) (I-2) \mathbf{x}' = H \mathbf{x}\quad \Rightarrow \\ \begin{pmatrix} x' \\ y'\\w' \end{pmatrix} = \begin{bmatrix}h_{11} & h_{12} &h_{13} \\ h_{21} & h_{22} &h_{23} \\ h_{31} & h_{32} &h_{33} \end{bmatrix} \begin{pmatrix} x \\ y \\w \end{pmatrix} \tag{I-2} x=Hx xyw = h11h21h31h12h22h32h13h23h33 xyw (I-2)
H H H 的第 i i i 行行向量记为 h i T = [ h i 1 , h i 2 , h i 3 ] \mathbf{h}^{i\rm{T}} = \begin{bmatrix} h_{i1}, h_{i2}, h_{i3}\end{bmatrix} hiT=[hi1,hi2,hi3], 则
( x ′ y ′ w ′ ) = [ h 1 T x h 2 T x h 3 T x ] (I-3) \begin{pmatrix} x' \\ y'\\w' \end{pmatrix} = \begin{bmatrix} \mathbf{h}^{1\rm{T}} \mathbf{x} \\ \mathbf{h}^{2\rm{T}} \mathbf{x}\\ \mathbf{h}^{3\rm{T}} \mathbf{x} \end{bmatrix} \tag{I-3} xyw = h1Txh2Txh3Tx (I-3)
那么非齐次坐标的表达式为
x ~ ′ = ( x ~ ′ y ~ ′ ) = ( x ′ / w ′ y ′ / w ′ ) = [ h 1 T x h 3 T x h 2 T x h 3 T x ] (I-4) \tilde{\mathbf{x}}'= \begin{pmatrix}\tilde{x}' \\ \tilde{y} ' \end{pmatrix} = \begin{pmatrix}{x'}/{w'} \\ {y'}/{w'} \end{pmatrix} =\left[ \begin{aligned} \frac{\mathbf{h}^{1\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}} \\ \frac{\mathbf{h}^{2\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}} \end{aligned}\right] \tag{I-4} x~=(x~y~)=(x/wy/w)= h3Txh1Txh3Txh2Tx (I-4)
另外 H H H 写成 9 维向量形式
h = [ h 1 h 2 h 3 ] = [ h 11   h 12 h 13 h 21 ⋮ h 33 ] (I-5) \mathbf{h} = \begin{bmatrix} \mathbf{h}^{1} \\ \mathbf{h}^{2} \\ \mathbf{h}^{3} \end{bmatrix} = \begin{bmatrix} h_{11} \\\ h_{12} \\ h_{13} \\ h_{21} \\ \vdots \\ h_{33} \end{bmatrix} \tag{I-5} h= h1h2h3 = h11 h12h13h21h33 (I-5)


II. 关于 x \mathbf{x} x 的导数 Derivative wrt x \mathbf{x} x

由向量的导数的分子布局 (参考之前博文 Derivative of Vector with Respect to Vector (Numerator-Layout Notation - in common use) ) 可知
∂ x ~ ′ ∂ x = [ ∂ x ~ ′ / ∂ x ∂ y ~ ′ / ∂ x ] (II-1) \frac{\partial \tilde{\mathbf{x}}'}{\partial\mathbf{x}} = \begin{bmatrix} {\partial \tilde{{x}}'}/{\partial\mathbf{x}} \\ {\partial \tilde{{y}}'}/{\partial\mathbf{x}} \end{bmatrix} \tag{II-1} xx~=[x~/xy~/x](II-1)
上式分为两部分分别计算.


1. 第一部分

∂ x ~ ′ ∂ x = ∂ ( h 1 T x h 3 T x ) / ∂ x = ( ∂ h 1 T x / ∂ x ) ( h 3 T x ) − ( h 1 T x ) ( ∂ h 3 T x / ∂ x ) ( h 3 T x ) ( h 3 T x ) = 1 w ′ h 1 T ( h 3 T x ) − ( h 1 T x ) h 3 T h 3 T x = 1 w ′ ( h 1 T − h 1 T x h 3 T x h 3 T ) = 1 w ′ ( h 1 T − x ~ ′ h 3 T ) (II-1-1) \begin{aligned} \frac{\partial \tilde{{x}}'}{\partial\mathbf{x}} &= \partial \left(\frac{\mathbf{h}^{1\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/\partial \mathbf{x}\\ &= \frac{\left({\partial {\mathbf{h}^{1\rm{T}} \mathbf{x}}}/{\partial \mathbf{x}}\right) \left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right) - \left({\mathbf{h}^{1\rm{T}} \mathbf{x}}\right) \left({\partial {\mathbf{h}^{3\rm{T}} \mathbf{x}}}/{\partial \mathbf{x}}\right) }{\left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right) \left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)}\\ &=\frac{1}{w'} \frac{ \mathbf{h}^{1\rm{T}} \left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right) - \left({\mathbf{h}^{1\rm{T}} \mathbf{x}}\right) {\mathbf{h}^{3\rm{T}}} } {{\mathbf{h}^{3\rm{T}} \mathbf{x}}}\\ & = \frac{1}{w'} \left(\mathbf{h}^{1\rm{T}} - \frac{\mathbf{h}^{1\rm{T}}\mathbf{x}}{\mathbf{h}^{3\rm{T}}\mathbf{x}}\mathbf{h}^{3\rm{T}} \right)\\ & = \frac{1}{w'} \left(\mathbf{h}^{1\rm{T}} - \tilde{x}' \mathbf{h}^{3\rm{T}} \right) \end{aligned} \tag{II-1-1} xx~=(h3Txh1Tx)/x=(h3Tx)(h3Tx)(h1Tx/x)(h3Tx)(h1Tx)(h3Tx/x)=w1h3Txh1T(h3Tx)(h1Tx)h3T=w1(h1Th3Txh1Txh3T)=w1(h1Tx~h3T)(II-1-1)


2. 第二部分

∂ y ~ ′ ∂ x = ∂ ( h 2 T x h 3 T x ) / ∂ x = ( ∂ h 2 T x / ∂ x ) ( h 3 T x ) − ( h 2 T x ) ( ∂ h 3 T x / ∂ x ) ( h 3 T x ) ( h 3 T x ) = 1 w ′ h 2 T ( h 3 T x ) − ( h 2 T x ) h 3 T h 3 T x = 1 w ′ ( h 2 T − h 2 T x h 3 T x h 3 T ) = 1 w ′ ( h 2 T − y ~ ′ h 3 T ) (II-2-1) \begin{aligned} \frac{\partial \tilde{{y}}'}{\partial\mathbf{x}} &= \partial \left(\frac{\mathbf{h}^{2\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/\partial \mathbf{x}\\ &= \frac{\left({\partial {\mathbf{h}^{2\rm{T}} \mathbf{x}}}/{\partial \mathbf{x}}\right) \left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right) - \left({\mathbf{h}^{2\rm{T}} \mathbf{x}}\right) \left({\partial {\mathbf{h}^{3\rm{T}} \mathbf{x}}}/{\partial \mathbf{x}}\right) }{\left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right) \left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)}\\ &=\frac{1}{w'} \frac{ \mathbf{h}^{2\rm{T}} \left({\mathbf{h}^{3\rm{T}} \mathbf{x}}\right) - \left({\mathbf{h}^{2\rm{T}} \mathbf{x}}\right) {\mathbf{h}^{3\rm{T}}} } {{\mathbf{h}^{3\rm{T}} \mathbf{x}}}\\ & = \frac{1}{w'} \left(\mathbf{h}^{2\rm{T}} - \frac{\mathbf{h}^{2\rm{T}}\mathbf{x}}{\mathbf{h}^{3\rm{T}}\mathbf{x}}\mathbf{h}^{3\rm{T}} \right)\\ & = \frac{1}{w'} \left(\mathbf{h}^{2\rm{T}} - \tilde{y}' \mathbf{h}^{3\rm{T}} \right) \end{aligned} \tag{II-2-1} xy~=(h3Txh2Tx)/x=(h3Tx)(h3Tx)(h2Tx/x)(h3Tx)(h2Tx)(h3Tx/x)=w1h3Txh2T(h3Tx)(h2Tx)h3T=w1(h2Th3Txh2Txh3T)=w1(h2Ty~h3T)(II-2-1)


3. 两部分合并

所以有
∂ x ~ ′ ∂ x = [ ∂ x ~ ′ / ∂ x ∂ y ~ ′ / ∂ x ] = 1 w ′ [ h 1 T − x ~ ′ h 3 T h 2 T − y ~ ′ h 3 T ] (II-3-1) \frac{\partial \tilde{\mathbf{x}}'}{\partial\mathbf{x}} = \begin{bmatrix} {\partial \tilde{{x}}'}/{\partial\mathbf{x}} \\ {\partial \tilde{{y}}'}/{\partial\mathbf{x}} \end{bmatrix} = \frac{1}{w'} \begin{bmatrix} \mathbf{h}^{1\rm{T}} - \tilde{x}' \mathbf{h}^{3\rm{T}} \\ \mathbf{h}^{2\rm{T}} - \tilde{y}' \mathbf{h}^{3\rm{T}} \end{bmatrix} \tag{II-3-1} xx~=[x~/xy~/x]=w1[h1Tx~h3Th2Ty~h3T](II-3-1)


III. 关于 H H H 的导数 Derivative wrt H H H

由向量的导数的分子布局, 可知
∂ x ~ ′ ∂ h = [ ∂ x ~ ′ / ∂ h ∂ y ~ ′ / ∂ h ] (III-1) \frac{\partial \tilde{\mathbf{x}}'}{\partial\mathbf{h}} = \begin{bmatrix} {\partial \tilde{{x}}'}/{\partial\mathbf{h}} \\ {\partial \tilde{{y}}'}/{\partial\mathbf{h}} \end{bmatrix} \tag{III-1} hx~=[x~/hy~/h](III-1)
上式分为两部分分别计算.


1. 第一部分

由向量的导数的分子布局, 可知
∂ x ~ ′ ∂ h = [ ∂ x ~ ′ / ∂ h 1 T ∂ x ~ ′ / ∂ h 2 T ∂ x ~ ′ / ∂ h 3 T ] = [ ∂ ( h 1 T x h 3 T x ) / ∂ h 1 T ∂ ( h 1 T x h 3 T x ) / ∂ h 2 T ∂ ( h 1 T x h 3 T x ) / ∂ h 3 T ] = [ x T h 3 T x 0 T − ( h 1 T x ) x T ( h 3 T x ) ( h 3 T x ) ] = 1 w ′ [ x T 0 T − h 1 T x h 3 T x x T ] = 1 w ′ [ x T 0 T − x ~ ′ x T ] (III-1-1) \begin{aligned} \frac{\partial \tilde{{x}}'}{\partial\mathbf{h}} &= \begin{bmatrix} {\partial \tilde{{x}}'}/{\partial\mathbf{h}^{1\rm{T}}} & {\partial \tilde{{x}}'}/{\partial\mathbf{h}^{2\rm{T}}} & {\partial \tilde{{x}}'}/{\partial\mathbf{h}^{3\rm{T}}} \end{bmatrix}\\ & = \begin{bmatrix} \partial\left(\frac{\mathbf{h}^{1\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/{\partial\mathbf{h}^{1\rm{T}}} &\partial\left(\frac{\mathbf{h}^{1\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/{\partial\mathbf{h}^{2\rm{T}}} &\partial\left(\frac{\mathbf{h}^{1\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/{\partial\mathbf{h}^{3\rm{T}}} \end{bmatrix}\\ & = \begin{bmatrix} \frac{\mathbf{x}^{\rm{T}}}{\mathbf{h}^{3\rm{T}} \mathbf{x}} & \mathbf{0}^{\rm{T}} & -\frac{\left(\mathbf{h}^{1\rm{T}} \mathbf{x}\right) \mathbf{x}^{\rm T}}{\left(\mathbf{h}^{3\rm{T}} \mathbf{x}\right)\left(\mathbf{h}^{3\rm{T}} \mathbf{x}\right)} \end{bmatrix}\\ & = \frac{1}{w'} \begin{bmatrix} {\mathbf{x}^{\rm{T}}} & \mathbf{0}^{\rm{T}} & -\frac{\mathbf{h}^{1\rm{T}} \mathbf{x} }{\mathbf{h}^{3\rm{T}} \mathbf{x}} \mathbf{x}^{\rm{T}} \end{bmatrix}\\ & = \frac{1}{w'} \begin{bmatrix} {\mathbf{x}^{\rm{T}}} & \mathbf{0}^{\rm{T}} & - \tilde{x}' \mathbf{x}^{\rm{T}} \end{bmatrix} \end{aligned} \tag{III-1-1} hx~=[x~/h1Tx~/h2Tx~/h3T]=[(h3Txh1Tx)/h1T(h3Txh1Tx)/h2T(h3Txh1Tx)/h3T]=[h3TxxT0T(h3Tx)(h3Tx)(h1Tx)xT]=w1[xT0Th3Txh1TxxT]=w1[xT0Tx~xT](III-1-1)


2. 第二部分

∂ y ~ ′ ∂ h = [ ∂ y ~ ′ / ∂ h 1 T ∂ y ~ ′ / ∂ h 2 T ∂ y ~ ′ / ∂ h 3 T ] = [ ∂ ( h 2 T x h 3 T x ) / ∂ h 1 T ∂ ( h 2 T x h 3 T x ) / ∂ h 2 T ∂ ( h 2 T x h 3 T x ) / ∂ h 3 T ] = [ 0 T x T h 3 T x − ( h 2 T x ) x T ( h 3 T x ) ( h 3 T x ) ] = 1 w ′ [ 0 T x T − h 2 T x h 3 T x x T ] = 1 w ′ [ 0 T x T − y ~ ′ x T ] (III-2-1) \begin{aligned} \frac{\partial \tilde{{y}}'}{\partial\mathbf{h}} &= \begin{bmatrix} {\partial \tilde{{y}}'}/{\partial\mathbf{h}^{1\rm{T}}} & {\partial \tilde{{y}}'}/{\partial\mathbf{h}^{2\rm{T}}} & {\partial \tilde{{y}}'}/{\partial\mathbf{h}^{3\rm{T}}} \end{bmatrix}\\ & = \begin{bmatrix} \partial\left(\frac{\mathbf{h}^{2\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/{\partial\mathbf{h}^{1\rm{T}}} &\partial\left(\frac{\mathbf{h}^{2\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/{\partial\mathbf{h}^{2\rm{T}}} &\partial\left(\frac{\mathbf{h}^{2\rm{T}} \mathbf{x}}{\mathbf{h}^{3\rm{T}} \mathbf{x}}\right)/{\partial\mathbf{h}^{3\rm{T}}} \end{bmatrix}\\ & = \begin{bmatrix} \mathbf{0}^{\rm{T}} &\frac{\mathbf{x}^{\rm{T}}}{\mathbf{h}^{3\rm{T}} \mathbf{x}} & -\frac{\left(\mathbf{h}^{2\rm{T}} \mathbf{x}\right) \mathbf{x}^{\rm T}}{\left(\mathbf{h}^{3\rm{T}} \mathbf{x}\right)\left(\mathbf{h}^{3\rm{T}} \mathbf{x}\right)} \end{bmatrix}\\ & = \frac{1}{w'} \begin{bmatrix} \mathbf{0}^{\rm{T}} & {\mathbf{x}^{\rm{T}}} & -\frac{\mathbf{h}^{2\rm{T}} \mathbf{x} }{\mathbf{h}^{3\rm{T}} \mathbf{x}} \mathbf{x}^{\rm{T}} \end{bmatrix}\\ & = \frac{1}{w'} \begin{bmatrix} \mathbf{0}^{\rm{T}} & {\mathbf{x}^{\rm{T}}} & - \tilde{y}' \mathbf{x}^{\rm{T}} \end{bmatrix} \end{aligned} \tag{III-2-1} hy~=[y~/h1Ty~/h2Ty~/h3T]=[(h3Txh2Tx)/h1T(h3Txh2Tx)/h2T(h3Txh2Tx)/h3T]=[0Th3TxxT(h3Tx)(h3Tx)(h2Tx)xT]=w1[0TxTh3Txh2TxxT]=w1[0TxTy~xT](III-2-1)


3. 合并

∂ x ~ ′ ∂ h = [ ∂ x ~ ′ / ∂ h ∂ y ~ ′ / ∂ h ] = 1 w ′ [ x T 0 T − x ~ ′ x T 0 T x T − y ~ ′ x T ] (III-3-1) \frac{\partial \tilde{\mathbf{x}}'}{\partial\mathbf{h}} = \begin{bmatrix} {\partial \tilde{{x}}'}/{\partial\mathbf{h}} \\ {\partial \tilde{{y}}'}/{\partial\mathbf{h}} \end{bmatrix} = \frac{1}{w'} \begin{bmatrix} {\mathbf{x}^{\rm{T}}} & \mathbf{0}^{\rm{T}} & - \tilde{x}' \mathbf{x}^{\rm{T}} \\ \mathbf{0}^{\rm{T}} & {\mathbf{x}^{\rm{T}}} & - \tilde{y}' \mathbf{x}^{\rm{T}} \end{bmatrix} \tag{III-3-1} hx~=[x~/hy~/h]=w1[xT0T0TxTx~xTy~xT](III-3-1)


参考文献

[1] Richard Hartley, Andrew Zisserman, Multiple View Geometry in Computer Vision, 2nd edition, Cambridge University Press, 2004


版权声明:本文为博主原创文章,遵循 CC 4.0 BY 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.youkuaiyun.com/woyaomaishu2/article/details/144831870
本文作者:wzf@robotics_notes

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值