Fix polynomial expressions

This commit is contained in:
2018-08-01 16:21:22 +01:00
parent 610ec09504
commit 26a9432ad9
@@ -127,25 +127,26 @@ $|\nabla v(\mathbf{p})|$ is a weighting factor that penalises high variations of
In this method the motion field is estimated based on a polynomial expansion a neighbourhood of a pixel~\cite{PolyFlow2003}.
In this method only quadratic polynomials are considered, expressed as:
\begin{equation}\label{EQ5:PolyFlow}
f(\mathbf{p}) \sim \mathbf{p}^TA_1\mathbf{p}+\mathbf{b}_1^T\mathbf{p}+C_1
f(\mathbf{p}) \sim \mathbf{p}A_1\mathbf{p}^T+\mathbf{b}_1\mathbf{p}^T+C_1
\end{equation}
where $\mathbf{p} = (x,y)^T$, $\mathbf{A_1}$ is a symmetric matrix, $\mathbf{b_1}$ a vector and $C_1$ a scalar. The coefficients are
estimated from a weighted least squares fit to the signal values in the neighbourhood.
where $\mathbf{p} = [x\ y]$, $\mathbf{A_1}$ is a symmetric matrix, $\mathbf{b_1}$ is a row vector and $C_1$ is a scalar. The coefficients are estimated from a weighted least squares fit to the signal values in the neighbourhood.
Since the result of polynomial expansion is that each neighbourhood is approximated by a polynomial, we start by analysing what happens if a polynomial undergoes an ideal translation. Let's consider the signal $f_1(\mathbf{p})$ represented by Equation (\ref{EQ5:PolyFlow}) and a signal $f_2$ which corresponds to a displacement of $f_1$ given by $\mathbf{d}=(v_x,v_y)^T$. This can be expressed by the following:
Since the result of polynomial expansion is that each neighbourhood is approximated by a polynomial, we start by analysing what happens if a polynomial undergoes an ideal translation. Let's consider the signal $f_1(\mathbf{p})$ represented by Equation (\ref{EQ5:PolyFlow}) and a signal $f_2$ which corresponds to a displacement of $f_1$ given by $\mathbf{d}=[v_x \ v_y]$. This can be expressed by the following:
\begin{align}
f_2(\mathbf{p})
&= f_1(\mathbf{p}+\mathbf{d}) \nonumber \\
&= (\mathbf{p}+\mathbf{d})^TA_1(\mathbf{p}+\mathbf{d})+\mathbf{b}_1^T(\mathbf{p}+\mathbf{d})+C_1 \\
&= \mathbf{p}^TA_2\mathbf{p}+\mathbf{b}_2^T\mathbf{p}+C_2, \nonumber
&= f_1(\mathbf{p}-\mathbf{d}) \nonumber \\
&= (\mathbf{p}-\mathbf{d})A_1(\mathbf{p}-\mathbf{d})^T+\mathbf{b}_1(\mathbf{p}+\mathbf{d})^T+C_1 \\
&= \mathbf{p}\mathbf{A}_1\mathbf{p}^T - 2\mathbf{d}\mathbf{A}_1\mathbf{p}^T+ \mathbf{d}\mathbf{A}_1\mathbf{d}^T+ \mathbf{b}_1\mathbf{p}^T-\mathbf{b}_1\mathbf{d}^T + C_1 \nonumber \\
&= \mathbf{p}\mathbf{A}_1\mathbf{p}^T + (\mathbf{b}_1-2\mathbf{d}\mathbf{A}_1)\mathbf{p}^T + \mathbf{d}\mathbf{A}_1\mathbf{d}^T - \mathbf{b}_1\mathbf{d}^T + C_1\\
&= \mathbf{p}A_2\mathbf{p}^T+\mathbf{b}_2\mathbf{p}^T+C_2, \nonumber
\end{align}
which results in the following relations,
which by equating the coefficients of the quadratic polynomials results in the following relations:
\begin{align}
\mathbf{A}_2 &= \mathbf{A}_1 \nonumber \\
\mathbf{b}_2 &= \mathbf{b}_1 + 2 \mathbf{A}_1\mathbf{d}, \\
C_2 &= \mathbf{d}^T\mathbf{A}_1\mathbf{d}+\mathbf{b}_1\mathbf{d}+C_1. \nonumber
\mathbf{b}_2 &= \mathbf{b}_1 - 2 \mathbf{d} \mathbf{A}_1, \\
C_2 &= \mathbf{d}\mathbf{A}_1\mathbf{d}^T + \mathbf{b}_1\mathbf{d}^T + C_1. \nonumber
\end{align}
This allows to find the displacement $\mathbf{d}$ for any signal dimensions by solving the above equations. Detailed implementations of the polynomial expansion and solving can be found in~\cite{NormalizedDiffConvolution1993,farneback2002polynomial}.
This allows to find the displacement $\mathbf{d}$ for any signal dimensions by solving the above equations. Detailed implementations of the polynomial expansion and respecting solving can be found in~\cite{NormalizedDiffConvolution1993,farneback2002polynomial}.
\subsubsection{Large displacement optical flow with deep matching (\textit{DeepFlow})}