a multiplication on both sides with $\mathbf{W}_r$ results in $\mathbf{W}_r \mathbf{E} \mathbf{E}^T \mathbf{W}_r^T$.

Prediction of Alignment Quality {#subsec:error_prediction}
-------------------------------

As there can be hundreds of keypoints of interest in an image, it is useful to measure the quality of the warp updates estimated by a LP. We propose an approach to estimate the expected squared error of a LP. From (\[eq:jd\_learning\]), the LP $\mathbf{A}$ attempts to minimize the following error function through least-squares: $$\label{eq:lp_cost}
    \mathrm{min}_{\mathbf{A}} ||\mathbf{A} \mathbf{E} - \mathbf{P} ||_2^2.$$ The expansion of (\[eq:lp\_cost\]) can be expressed as $$\label{eq:expanded_lp_cost}
    \mathrm{min}_{\mathbf{A}} (\mathbf{A} \mathbf{E} - \mathbf{P}) (\mathbf{A} \mathbf{E} - \mathbf{P})^T.$$ As we are only interested in the expected squared error of the 6 parameters in the affine warp, we are only concerned with the diagonal elements of the result in (\[eq:expanded\_lp\_cost\]). This implies that we can express the expected squared error as $$\label{eq:trace_lp_cost}
    \bar{\mathbf{e}}^2 = \mathrm{Tr} [ (\mathbf{A} \mathbf{E} - \mathbf{P}) (\mathbf{A} \mathbf{E} - \mathbf{P})^T ],$$ where $\mathrm{Tr}(.)$ is the trace operator. After expanding (\[eq:trace\_lp\_cost\]) and performing some simple manipulations, we can express the expected squared error as $$\label{eq:expected_sq_err}
    \bar{\mathbf{e}}^2 = \mathrm{Tr}(\mathbf{P} \mathbf{P}^T) - \mathrm{Tr}(\mathbf{A} (\mathbf{P} \mathbf{E}^T)).$$ From (\[eq:expected\_sq\_err\]), the first term, $\mathrm{Tr}(\mathbf{P} \mathbf{P}^T)$ does not depend on pixel intensities and can 