{%hackmd SybccZ6XD %}
# Adaptive As-Natural-As-Possible Image Stitching
###### tags: `paper`
## 3. Proposed Algorithm
step
- moving DLT method to estimate the local homography
- linearize it in the non-overlapping regions
- the computation of a global similarity transformation between the reference and the target images
### 3.1. Local Homography Model
https://www.cs.cmu.edu/~16385/s17/Slides/10.2_2D_Alignment__DLT.pdf
- target image and reference image: $I$ and $I'$
- matching points: $p = [x y]^T$ and $p' = [x' y']^T$
- homographic transformation: $p' = h(p)$
:::warning
補充 (cross product)

a × b = |a| |b| sin(θ) n
- |a| is the magnitude (length) of vector a
- |b| is the magnitude (length) of vector b
- θ is the angle between a and b
- n is the unit vector at right angles to both a and b
:::
**homography matrix H**
$\hat{p}' = H\hat{p}$
$\left [ \begin{matrix}
x' \\
y' \\
1 \\
\end{matrix} \right ]=
\left [ \begin{matrix}
h_1& h_2& h_3 \\
h_4& h_5& h_6 \\
h_7& h_8& h_9 \\
\end{matrix} \right ]
\left [ \begin{matrix}
x \\
y \\
1 \\
\end{matrix} \right ]$
$x'= (h_1x + h_2y + h_3)$
$y'= (h_4x + h_5y + h_6)$
$1= (h_7x + h_8y + h_9)$
**divide line 1 and 2 by 3**
$x'(h_7x + h_8y + h_9)= (h_1x + h_2y + h_3)$
$y'(h_7x + h_8y + h_9)= (h_4x + h_5y + h_6)$
**rearrange**
$h_7xx' + h_8yx' + h_9x' - h_1x - h_2y - h_3 = 0$
$h_7xy' + h_8yy' + h_9y' - h_4x - h_5y - h_6 = 0$
**convert to matrix form $A_ih = 0$**

**estimate h (local homography at the location $p_j$)**
$h_j = \mathop{argmin}\limits_{h_j}||W_jAh||^2$
**find W**
high value for pixels in the neighborhood of $p_j$ and equal values for those that are very far
$W = max(exp(-||p_i - p_j||^2/\sigma^2), \gamma);
)$
### 3.2. Homography Linearization
:::warning
補充 (Jocabian )
https://ccjou.wordpress.com/2012/11/26/jacobian-%E7%9F%A9%E9%99%A3%E8%88%87%E8%A1%8C%E5%88%97%E5%BC%8F/
- 如果向量函數 F 的數學形式相當複雜,線性化是一個常用的簡化方法。針對單變量函數 f(x),在 x=p 附近我們可用直線 y=ax+b 近似 f(x)
- 仿射變換 T 近似向量函數 F,由此衍生 F 的導數矩陣,稱為 Jacobian 矩陣
:::
the linearization of homography at any point q in the neighborhood of the anchor point p can be understood by considering the Taylor series of the homographic transformation h(q)
$h(q) = h(p) + J_h(p)(q - p) + o(||q - p||)$
For the boundary
a setf R anchor points $\{ p_i\} _{i=1}^R$
$h^L(q) = \sum \alpha_i(h(p_i) + J_h(p_i)(q-p_i))$