an affine warp matrix parametrized by the warp parameters $\mathbf{p} \in \mathbb{R}^6$, which maps a pixel location $\mathbf{x}$ to a subpixel location. We define $\mathbf{M}$ as $$\label{eq:affine}
    \mathbf{M} = 
    \left[
    \begin{array}{ccc}
    1 + p_0 & p_1 & p_2 \\
    p_3 & 1 + p_4 & p_5
    \end{array}
    \right].$$

Energy Minimization Methods {#sec:energy}
===========================

In this section, we provide a brief review of energy minimization methods for sub-pixel refinement.

The Lucas-Kanade Algorithm
--------------------------

The Lucas-Kanade (LK) algorithm [@Lucas1981] minimizes a cost function defined by the sum of squared differences (SSD) over pixel correspondences between a warped input image patch and the template patch. Given an initial estimate of the parameters, $\mathbf{p}$, the cost function is defined as $$\label{eq:lk_cost}
    \mathrm{min}_{\Delta \mathbf{p}} || \mathcal{I}(\mathbf{p} + \Delta \mathbf{p}) - \mathcal{T}(\mathbf{0}) ||^2_2,$$ where $\mathcal{I}(\mathbf{p})$ is the warped image patch, and $\Delta \mathbf{p}$ is the warp update being estimated. The cost function is linearized by performing a first-order Taylor expansion around $\Delta \mathbf{p} = \mathbf{0}$: $$\mathrm{min}_{\Delta \mathbf{p}} || \mathcal{I}(\mathbf{p}) + \frac{\partial \mathcal{I}(\mathbf{p})}{\partial \Delta \mathbf{p}} \Delta \mathbf{p} - \mathcal{T}(\mathbf{0}) ||^2_2 ,$$ where the term $\frac{\partial \mathcal{I}(\mathbf{p})}{\partial \Delta \mathbf{p}}$, known as the steepest descent image [@Baker2001], is the composition of the gradient image and the Jacobian with respect 