当前位置: 代码迷 >> 综合 >> 图像对齐:Parametric Image Alignment Using Enhanced Correlation Coefficient Maximization
  详细解决方案

图像对齐:Parametric Image Alignment Using Enhanced Correlation Coefficient Maximization

热度:82   发布时间:2023-10-19 12:27:33.0

Parametric Image Alignment Using Enhanced Correlation Coefficient Maximization

文章目录

  • Parametric Image Alignment Using Enhanced Correlation Coefficient Maximization
      • Problem Formulation
      • Proposed Criterion and Main Results
        • Vectorization
        • Performance Measure Optimization
        • Closed-Form Expression:
        • Derive Forward Additive ECC
        • Forward Additive ECC Iterative Algorithm
        • Inverse Compositional ECC Iterative Algorithm

对齐的目的是找到两张图像像素点坐标间的对应关系,对于手持设备,首先假设两张图像间为简单的仿射变换,可以通过求解两张图像间的仿射变换矩阵,实现对齐图像的目的。作者导出ECC这个算法的两个核心思想,一个来源与作者本人的另一篇论文《An Enhanced Correlation-Based Method for Stereo Correspondence with Sub-Pixel Accuracy》中对增强相关系数的与残差之间的等同关系,一个来源与Takeo Kanade在其论文《An Iterative Image Registration Technique with an Application to Stereo Vision》中提出的Forward Additive迭代思想。

Problem Formulation

假设有一对图像,图像间仅存在像素点坐标间的畸变,记其中一帧图像为参考帧IrI_{r}Ir?,对应的像素坐标记为x=[xr,yr]t\mathbf{x}=[x_{r},y_{r}]^{t}x=[xr?,yr?]t,另一帧图像为畸变帧IwI_{w}Iw?,对应的像素坐标记为y=[xw,yw]t\mathbf{y}=[x_{w},y_{w}]^{t}y=[xw?,yw?]t,对齐的目的是找到x\mathbf{x}xy\mathbf{y}y之间的对应关系?\phi?,即y=?(x;p)\mathbf{y}=\phi(\mathbf{x};p)y=?(x;p),其中p=[p1,......,pN]T\mathbf{p}=[p_{1},......,p_{N}]^{T}p=[p1?,......,pN?]TNNN维的参数向量,因此可以将对齐问题看作是一个参数估计问题:
Ir(x)=Iw(?(x;p))(1)I_{r}(\mathbf{x})=I_{w}(\phi(\mathbf{x};\mathbf{p}))\tag{1} Ir?(x)=Iw?(?(x;p))(1)
将参数p\mathbf{p}p的优化问题,定义为参考帧与畸变帧经过畸变矫正的结果之间的差值的最小化问题:
min?p,αE(p,α)=min?p,α∑x∈T∣Ir(x)?Ψ(Iw(?(x;p)),α)∣p(2)\min _{\mathbf{p}, \boldsymbol{\alpha}} E(\mathbf{p}, \boldsymbol{\alpha})=\min _{\mathbf{p}, \boldsymbol{\alpha}} \sum_{\mathbf{x} \in \mathcal{T}}\left|I_{r}(\mathbf{x})-\Psi\left(I_{w}(\boldsymbol{\phi}(\mathbf{x} ; \mathbf{p})), \boldsymbol{\alpha}\right)\right|^{p}\tag{2} p,αmin?E(p,α)=p,αmin?xT?Ir?(x)?Ψ(Iw?(?(x;p)),α)p(2)
其中Ψ(I,α)\Psi(I,\alpha)Ψ(I,α)为简单的亮度转换,目的是降低由图像亮度变化带来的图像间的不相关性。

Proposed Criterion and Main Results

Vectorization

记参考图像与目标图像间的目标对齐区域的中心坐标数为KKK个,对齐区域的亮度值分别构成参考向量iw(p)i_{w}(p)iw?(p)、畸变向量iri_rir?,分别为:
ir=[Ir(x1)Ir(x2)?Ir(xK)]tiw(p)=[Iw(y1(p))Iw(y2(p))?Iw(yK(p))]t(3)\begin{aligned} \mathbf{i}_{r} &=\left[I_{r}\left(\mathbf{x}_{1}\right) I_{r}\left(\mathbf{x}_{2}\right) \cdots I_{r}\left(\mathbf{x}_{K}\right)\right]^{t} \\ \mathbf{i}_{w}(\mathbf{p}) &=\left[I_{w}\left(\mathbf{y}_{1}(\mathbf{p})\right) I_{w}\left(\mathbf{y}_{2}(\mathbf{p})\right) \cdots I_{w}\left(\mathbf{y}_{K}(\mathbf{p})\right)\right]^{t} \end{aligned}\tag{3} ir?iw?(p)?=[Ir?(x1?)Ir?(x2?)?Ir?(xK?)]t=[Iw?(y1?(p))Iw?(y2?(p))?Iw?(yK?(p))]t?(3)
iˉr\bar{i}_{r}iˉr?iˉw(p)\bar{i}_{w}(p)iˉw?(p)分别为对应的零均值向量(column-zero–mean versions),用ECC作为参数ppp的性能评价指标:
EECC(p)=∥iˉr∥iˉr∥?iˉw(p)∥iˉw(p)∥∥2(4)E_{ECC}(p)=\left \|\frac{\bar{i}_{r}}{\left \| \bar{i}_{r} \right \| } - \frac{\bar{i}_{w}(p)}{\left \| \bar{i}_{w}(p) \right \| } \right \|^{2}\tag{4} EECC?(p)=?iˉr?iˉr???iˉw?(p)iˉw?(p)??2(4)
可以看出增益及亮度整体抬升不影响评价指标

Performance Measure Optimization

在本文作者的另外一篇论文《An Enhanced Correlation-Based Method for Stereo Correspondence with Sub-Pixel Accuracy》中证明了对公式(4)的最小化等同于对下式增强相关系数(Enhanced Correction Coefficient)的最大化:
ρ(p)=iˉrTiˉw(p)∥iˉr∥∥iˉw(p)∥=i^rTiˉw(p)∥iˉw(p)∥(5)\rho(p)=\frac{\bar{i}_{r}^{T}\bar{i}_{w}(p)}{\left \| \bar{i}_{r} \right \| \left \| \bar{i}_{w}(p) \right \|} =\hat{i}_{r}^{T}\frac{\bar{i}_{w}(p)}{\left \| \bar{i}_{w}(p) \right \| }\tag{5} ρ(p)=iˉr?iˉw?(p)iˉrT?iˉw?(p)?=i^rT?iˉw?(p)iˉw?(p)?(5)
其中i^r=iˉr∥iˉr∥\hat{i}_{r}=\frac{\bar{i}_{r}}{\left \| \bar{i}_{r} \right \| }i^r?=iˉr?iˉr??,由于不对参考帧做畸变矫正,此向量恒定;由于∥iˉw(p)∥\left \| \bar{i}_{w}(p) \right \|iˉw?(p)的存在,即使iˉw(p)\bar{i}_{w}(p)iˉw?(p)相对于参数ppp线性,目标函数ρ(p)\rho(p)ρ(p)相当于参数ppp依旧非线性,将参数向量ppp做如下表示:
p=p~+△pp=\tilde{p}+\bigtriangleup p p=p~?+p
p~:\tilde{p}:p~?nominal parameter vector;△p:\bigtriangleup p:pperturbations vector
这里的三个参数向量即是表示对参数向量ppp的近似过程,也表示后续参数向量的迭代求解方式
对图像在x-y坐标系下进行一个简单的一阶泰勒展开,可以将畸变帧做如下近似:
Iw(y)≈Iw(y~)+[?yIw(y~)]??(x;p~)?pΔp(6)I_{w}(\mathbf{y}) \approx I_{w}(\tilde{\mathbf{y}})+\left[\nabla_{\mathbf{y}} I_{w}(\tilde{\mathbf{y}})\right] \frac{\partial \phi(\mathbf{x} ; \tilde{\mathbf{p}})}{\partial \mathbf{p}} \Delta \mathbf{p}\tag{6} Iw?(y)Iw?(y~?)+[?y?Iw?(y~?)]?p??(x;p~?)?Δp(6)
其中[▽YIw(Y~)][\bigtriangledown_{Y}I_{w}(\tilde{Y} ) ][Y?Iw?(Y~)]为一个2×K2×K2×K的梯度矩阵;??(X;p~)?p\frac{\partial \phi(X;\tilde{p} )}{\partial p }?p??(X;p~?)?为一个2×N2×N2×N的Jacobian矩阵。同样,将以上线性近似应用于全部目标区域,可得:
iw(p)≈iw(p~)+G(p~)△p(7)i_{w}(p)\approx i_{w}(\tilde{p} )+G(\tilde{p})\bigtriangleup p\tag{7} iw?(p)iw?(p~?)+G(p~?)p(7)
其中G(p~)G(\tilde{p})G(p~?)K×NK×NK×N的Jacobian矩阵(Jacobian matrix of the warped intensity vector with respect to the parameters)
假设畸变模型为:
?(X;p)=[?1(X;p)?2(X;p)T](8)\phi(X;p)=\begin{bmatrix} \phi_{1}(X;p) &\phi_{2}(X;p)^{T}\tag{8} \end{bmatrix} ?(X;p)=[?1?(X;p)??2?(X;p)T?](8)
可用以下公式确定K×NK×NK×N的Jacobian矩阵:
G(p~)k,n=∑i=12(?Iw(Y)?Yi∣Y=Yk(p~)×??i(Xk;p)?pn∣p=p~)(9)G(\tilde{p} )_{k,n}=\sum_{i=1}^{2}(\frac{\partial I_w(Y)}{\partial Y_{i}}|_{Y=Y_{k}(\tilde{p})}× \frac{\partial \phi_{i}(X_{k};p)}{\partial p_{n}}|_{p=\tilde{p}})\tag{9} G(p~?)k,n?=i=12?(?Yi??Iw?(Y)?Y=Yk?(p~?)?×?pn???i?(Xk?;p)?p=p~??)(9)
其中YYY为像素坐标,包含Yi、Y2Y_{i}、Y_{2}Yi?Y2?,将式(7)带入式(5),得到新的增强相关系数的表达式:
ρ(p)≈ρ(△p∣p~)=i^rTiˉw(p~)+Gˉ(p~)△p∥iˉw(p~)+Gˉ(p~)△p∥(10)\rho(p)\approx \rho(\bigtriangleup p|\tilde{p})=\hat{i}_{r}^{T}\frac{\bar{i}_{w}(\tilde{p})+\bar{G}(\tilde{p})\bigtriangleup p}{\left \| \bar{i}_{w}(\tilde{p})+\bar{G}(\tilde{p})\bigtriangleup p \right \| }\tag{10} ρ(p)ρ(pp~?)=i^rT??iˉw?(p~?)+Gˉ(p~?)p?iˉw?(p~?)+Gˉ(p~?)p?(10)
其中Gˉ(p~)\bar{G}(\tilde{p})Gˉ(p~?)iˉw(p~)\bar{i}_{w}(\tilde{p})iˉw?(p~?)分别对应G(p~)G(\tilde{p})G(p~?)iw(p~)i_{w}(\tilde{p})iw?(p~?)的零均值向量。为了表达的简洁,之后的推导将省略参数向量p~\tilde{p}p~?,将式(10)直接做如下表达:
ρ(Δp∣p~)=i^rTi?w+i^rTGˉΔp∥i?w∥2+2i?wTGˉΔp+ΔpTGˉTGˉΔp(11)\rho(\Delta p \mid \tilde{p})=\frac{\hat{ {i}}_{r}^{T} \overline{ {i}}_{w}+\hat{ {i}}_{r}^{T} \bar{G} \Delta {p}}{\sqrt{\left\|\overline{ {i}}_{w}\right\|^{2}+2 \overline{ {i}}_{w}^{T} \bar{G} \Delta {p}+\Delta {p}^{T} \bar{G}^{T} \bar{G} \Delta {p}}}\tag{11} ρ(Δpp~?)=?iw??2+2iwT?GˉΔp+ΔpTGˉTGˉΔp ?i^rT?iw?+i^rT?GˉΔp?(11)

Closed-Form Expression:

考虑如下标量函数:
f(x)=u+utxv+2vtx+xtQx(12)f(\mathbf{x})=\frac{u+\mathbf{u}^{t} \mathbf{x}}{\sqrt{v+2 \mathbf{v}^{t} \mathbf{x}+\mathbf{x}^{t} Q \mathbf{x}}}\tag{12} f(x)=v+2vtx+xtQx ?u+utx?(12)
其中u,vu,vu,v为标量;u,v\mathbf{u,v}u,v是长度为NNN的向量;QQQ是正定阵,如果满足v>vtQ?1vv>\mathbf{v}^{t} Q^{-1} \mathbf{v}v>vtQ?1v,则可以分情况确定函数f(x)f(x)f(x)是极大值。
1.当u>utQ?1vu>\mathbf{u}^{t} Q^{-1} \mathbf{v}u>utQ?1v时,f(x)f(x)f(x)的最大值如下:
max?xf(x)=(u?utQ?1v)2v?vtQ?1v+utQ?1u;x=Q?1{v?vtQ?1vu?utQ?1vu?v}(14、15)\max _{\mathbf{x}} f(\mathbf{x})=\sqrt{\frac{\left(u-\mathbf{u}^{t} Q^{-1} \mathbf{v}\right)^{2}}{v-\mathbf{v}^{t} Q^{-1} \mathbf{v}}+\mathbf{u}^{t} Q^{-1} \mathbf{u}};\mathbf{x}=Q^{-1}\left\{\frac{v-\mathbf{v}^{t} Q^{-1} \mathbf{v}}{u-\mathbf{u}^{t} Q^{-1} \mathbf{v}} \mathbf{u}-\mathbf{v}\right\}\tag{14、15} xmax?f(x)=v?vtQ?1v(u?utQ?1v)2?+utQ?1u ?;x=Q?1{ u?utQ?1vv?vtQ?1v?u?v}(1415)
2.当u≤utQ?1vu \leq \mathbf{u}^{t} Q^{-1} \mathbf{v}uutQ?1v时,f(x)f(x)f(x)的上确界如下:
sup?xf(x)=utQ?1u;x=Q?1{λu?v};λ>0(16、17)\sup _{\mathbf{x}} f(\mathbf{x})=\sqrt{\mathbf{u}^{t} Q^{-1} \mathbf{u}};\mathbf{x}=Q^{-1}\{\lambda \mathbf{u}-\mathbf{v}\};\lambda>0 \tag{16、17} xsup?f(x)=utQ?1u ?;x=Q?1{ λu?v};λ>0(1617)

Derive Forward Additive ECC

首先给出正交投影矩阵PG=Gˉ(GˉtGˉ)?1GˉtP_{G}=\bar{G}\left(\bar{G}^{t} \bar{G}\right)^{-1} \bar{G}^{t}PG?=Gˉ(GˉtGˉ)?1Gˉt,因此,以下不等式成立:
∥i?w∥2=∥PGi?w∥2+∥[I?PG]i?w∥2≥∥PGi?w∥2=i?wtPGi?w(18)\left\|\overline{\mathbf{i}}_{w}\right\|^{2}=\left\|P_{G} \overline{\mathbf{i}}_{w}\right\|^{2}+\left\|\left[I-P_{G}\right] \overline{\mathbf{i}}_{w}\right\|^{2} \geq\left\|P_{G} \overline{\mathbf{i}}_{w}\right\|^{2}=\overline{\mathbf{i}}_{w}^{t} P_{G} \overline{\mathbf{i}}_{w}\tag{18} ?iw??2=?PG?iw??2+?[I?PG?]iw??2?PG?iw??2=iwt?PG?iw?(18)
其中III为单位阵,当且仅当[I?PG]i?w=0\left[I-P_{G}\right] \overline{\mathbf{i}}_{w}=0[I?PG?]iw?=0时等式成立,而[I?PG]i?w≠0\left[I-P_{G}\right] \overline{\mathbf{i}}_{w}≠0[I?PG?]iw???=0,所以不等式(18)严格成立。又有式(18)形如式(13),式(11)形如式(12),即将式(15)带入式(11)可解得△p\bigtriangleup pp
Δp=(GˉtGˉ)?1Gˉt{∥i?w∥2?i?wtPGi?wi^rti?w?i^rtPGi?w?i?w}(19)\Delta \mathbf{p}=\left(\bar{G}^{t} \bar{G}\right)^{-1} \bar{G}^{t}\left\{\frac{\left\|\overline{\mathbf{i}}_{w}\right\|^{2}-\overline{\mathbf{i}}_{w}^{t} P_{G} \overline{\mathbf{i}}_{w}}{\hat{\mathbf{i}}_{r}^{t} \overline{\mathbf{i}}_{w}-\hat{\mathbf{i}}_{r}^{t} P_{G} \overline{\mathbf{i}}_{w}}-\overline{\mathbf{i}}_{w}\right\}\tag{19} Δp=(GˉtGˉ)?1Gˉt{ i^rt?iw??i^rt?PG?iw??iw??2?iwt?PG?iw???iw?}(19)
i^rti?w>i^rtPGi?w\hat{\mathbf{i}}_{r}^{t} \overline{\mathbf{i}}_{w}>\hat{\mathbf{i}}_{r}^{t} P_{G} \overline{\mathbf{i}}_{w}i^rt?iw?>i^rt?PG?iw?时,根据式(17),λ>0\lambda>0λ0,既有:
Δp=(GˉtGˉ)?1Gˉt{λi^r?i?w}(20)\Delta \mathbf{p}=\left(\bar{G}^{t} \bar{G}\right)^{-1} \bar{G}^{t}\left\{\lambda \hat{\mathbf{i}}_{r}-\overline{\mathbf{i}}_{w}\right\}\tag{20} Δp=(GˉtGˉ)?1Gˉt{ λi^r??iw?}(20)
i^rti?w≤i^rtPGi?w\hat{\mathbf{i}}_{r}^{t} \overline{\mathbf{i}}_{w} \leq \hat{\mathbf{i}}_{r}^{t} P_{G} \overline{\mathbf{i}}_{w}i^rt?iw?i^rt?PG?iw?时,为保证ρ(Δp∣p~)>ρ(0∣p~)\rho(\Delta \mathbf{p} \mid \tilde{\mathbf{p}})>\rho(0 \mid \tilde{\mathbf{p}})ρ(Δpp~?)>ρ(0p~?)根据文中Lemma 1,确定λ\lambdaλ的取值:
λ1=iwtPGi?wi^rtPGi^r,λ2=i^rtPGi?w?i^rti?wi^rtPGi^r,λ≥max?{λ1,λ2}(21)\lambda_{1}=\sqrt{\frac{\mathbf{i}_{w}^{t} P_{G} \overline{\mathbf{i}}_{w}}{\hat{\mathbf{i}}_{r}^{t} P_{G} \hat{\mathbf{i}}_{r}}}, \quad \lambda_{2}=\frac{\hat{\mathbf{i}}_{r}^{t} P_{G} \overline{\mathbf{i}}_{w}-\hat{\mathbf{i}}_{r}^{t} \overline{\mathbf{i}}_{w}}{\hat{\mathbf{i}}_{r}^{t} P_{G} \hat{\mathbf{i}}_{r}},\quad \lambda \geq \max \left\{\lambda_{1}, \lambda_{2}\right\}\tag{21} λ1?=i^rt?PG?i^r?iwt?PG?iw?? ?,λ2?=i^rt?PG?i^r?i^rt?PG?iw??i^rt?iw??,λmax{ λ1?,λ2?}(21)
将式(20)带入是(11),得到关于λ\lambdaλ的表达式:
ρ(Δp∣p~)=f(λ)=(i^rti?w?i^rtPGi?w)+λi^rtPGi^r(∥i?w∥2?i?wtPGi?w)+λ2i^rtPGi^r(22)\rho(\Delta p \mid \tilde{p})=f(\lambda)=\frac{\left(\hat{\mathbf{i}}_{r}^{t} \overline{\mathbf{i}}_{w}-\hat{\mathbf{i}}_{r}^{t} P_{G} \overline{\mathbf{i}}_{w}\right)+\lambda \hat{\mathbf{i}}_{r}^{t} P_{G} \hat{\mathbf{i}}_{r}}{\sqrt{\left(\left\|\overline{\mathbf{i}}_{w}\right\|^{2}-\overline{\mathbf{i}}_{w}^{t} P_{G} \overline{\mathbf{i}}_{w}\right)+\lambda^{2} \hat{\mathbf{i}}_{r}^{t} P_{G} \hat{\mathbf{i}}_{r}}}\tag{22} ρ(Δpp~?)=f(λ)=(?iw??2?iwt?PG?iw?)+λ2i^rt?PG?i^r? ?(i^rt?iw??i^rt?PG?iw?)+λi^rt?PG?i^r??(22)
简单计算式(22)关于λ\lambdaλ的导数,可知f(λ)f(\lambda)f(λ)单调增
1.当λ≥λ2\lambda\ge \lambda_{2}λλ2?时,$f(\lambda)\geq$0

2.当λ=λ1\lambda = \lambda_{1}λ=λ1?时,f(λ1)=i^rti?w?i^rtPGi?w+(i?wtPGi?w)(i^rtPGi^r)∥i?w∥≥ρ(0∣p~)f\left(\lambda_{1}\right)=\frac{\left.\hat{\mathbf{i}}_{r}^{t} \overline{\mathbf{i}}_{w}-\hat{\mathbf{i}}_{r}^{t} P_{G} \overline{\mathbf{i}}_{w}+\sqrt{\left(\overline{\mathbf{i}}_{w}^{t} P_{G} \overline{\mathbf{i}}_{w}\right)\left(\hat{\mathbf{i}}_{r}^{t} P_{G} \hat{\mathbf{i}}_{r}\right.}\right)}{\left\|\overline{\mathbf{i}}_{w}\right\|} \geq \rho(0 \mid \tilde{\mathbf{p}})f(λ1?)=iw?i^rt?iw??i^rt?PG?iw?+(iwt?PG?iw?)(i^rt?PG?i^r? ?)?ρ(0p~?)

即当λ≥max?{λ1,λ2}\lambda \geq \max \left\{\lambda_{1}, \lambda_{2}\right\}λmax{ λ1?,λ2?}f(λ)>0f(\lambda)>0f(λ)0Δp\Delta pΔp总会带来相关系数的增大,即是ρ(p~+Δp)>ρ(p~)\rho(\tilde{p}+\Delta{p})>\rho(\tilde{p})ρ(p~?+Δp)ρ(p~?),可以通过迭代求解ΔP\Delta{P}ΔP实现对参数ppp的优化

Forward Additive ECC Iterative Algorithm

S0.用参考帧IrI_{r}Ir?计算i^r\hat{i}_{r}i^r?;初始化参数向量p0p_{0}p0?;给定迭代次数TTT;给定$\varepsilon ;;j=1$

S1.用?(X;pj?1)\phi(X;p_{j-1})?(X;pj?1?)对畸变帧IwI_{w}Iw?做畸变矫正,并用矫正后的结果计算i^w(pj?1)\hat{i}_{w}(p_{j-1})i^w?(pj?1?)

S2.用公式(9)计算Jacobin矩阵

S3.根据式(19、20、21)计算Δpj\Delta{p_{j}}Δpj?

S4.更新参数向量:pj=pj?1+Δpj,j=j+1p_{j}=p_{j-1}+\Delta p_{j},j=j+1pj?=pj?1?+Δpj?j=j+1

S5.当∥Δpj∥≥ε\left \| \Delta p_{j} \right \|\ge \varepsilonΔpj?ε 时,停止迭代

Inverse Compositional ECC Iterative Algorithm

FA_ECC需要计算到GtGG^{t}GGtG,算法复杂度为O(KN2)O(KN^{2})O(KN2),除此之外的算法复杂度为O(KN)O(KN)O(KN)。可以通过变换Ir,IwI_{r},I_{}wIr?I?w的位置来将GtGG^{t}GGtG的计算次数降为1,用参考帧IrI_{r}Ir?计算Jacobin矩阵,此矩阵恒定,不需要再次计算

  相关解决方案