\documentclass[12pt,a4paper]{article}

\usepackage{amstext}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{enumerate}
\usepackage{alltt}
\usepackage[latin1]{inputenc}
\usepackage{cancel}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{wasysym}
\usepackage{rotating}

\title{}
\author{}
\date{}

\pagestyle{fancy}

\lhead{Assignment 4}
\chead{}
\rhead{}
\lfoot{COPCV}
\cfoot{Page \thepage}
\rfoot{SS 2009}

\begin{document}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\newcommand{\exercise}[1]{\subsection{#1}}
\renewcommand{\theenumi}{\textbf{\alph{enumi}}}

\newcommand{\AND}{\ensuremath{\wedge}}
\newcommand{\OR}{\ensuremath{\vee}}
\newcommand{\SetR}{\ensuremath{\mathbb{R}}}
\newcommand{\SetN}{\ensuremath{\mathbb{N}}}
\newcommand{\SetC}{\ensuremath{\mathbb{C}}}
\newcommand{\SetZ}{\ensuremath{\mathbb{Z}}}
\newcommand{\SetQ}{\ensuremath{\mathbb{Q}}}
\newcommand{\SetB}{\ensuremath{\mathbb{B}}}
\newcommand{\QED}{\ensuremath{\hspace*{\fill}\square}}
\newcommand{\FLASH}{\ensuremath{\hspace*{\fill}\lightning}}
\newcommand{\OnotO}{\ensuremath{\mathcal{O}}}
\newcommand{\bild}[2]{
	\begin{figure}[htpb]
		\centering
			\includegraphics[#1]{#2}\\[0.2cm]
	\end{figure}
	}

\newcommand{\m}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\+}{\phantom{-}}
\newcommand{\f}{\frac}

%\maketitle

%\thispagestyle{empty}

%\newpage
\setcounter{page}{1}
\setcounter{section}{4}

\exercise{Affine Horn and Schunck}
\begin{enumerate}
	\item We now from the lecture
		$$\textbf{w} = \left(\begin{array}{c}u \\ v \\ 1\end{array}\right) = \left(\begin{array}{c}ax + by + c \\ dx + ey + f \\ 1\end{array}\right) = \underbrace{\left(\begin{array}{ccccccc}x & y & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & x & y & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1\end{array}\right)}_{M} \underbrace{\left(\begin{array}{c}a \\ b \\ c \\ d \\ e \\ f \\ 1\end{array}\right)}_{\textbf{p}} = M \textbf{p}$$
		The optic flow constraint can be rewritten as
		$$(\nabla_3 f^\top \textbf{w})^2 = (\nabla_3 f^\top (M \textbf{p}))^2 = \textbf{p}^\top \underbrace{\underbrace{M^\top \nabla_3 f}_{r} \underbrace{\nabla_3 f^\top M}_{r^\top}}_{J} \textbf{p}$$%(M_{affine}^\top \nabla_3 f)^\top p_{affine} = r_{affine}^\top p_{affine}$$
		where
		$$r = \left(\begin{array}{r}x f_x \\ y f_x \\ f_x \\ x f_y \\ y f_y \\ f_y \\ f_t\end{array}\right)$$
		The energy functional now looks like this
		$$E(\textbf{p}) = \int_\Omega \textbf{p}^\top J \textbf{p} + \alpha (|\nabla a|^2 + |\nabla b|^2 + |\nabla c|^2 + |\nabla d|^2 + |\nabla e|^2 + |\nabla f|^2) \; \mathrm dx \mathrm dy.$$
		Another possibility is
		$$E(\textbf{p}) = \int_\Omega \textbf{p}^\top J \textbf{p} + \alpha (|\nabla a|^2 + |\nabla b|^2 + |\nabla d|^2 + |\nabla e|^2) + \beta (|\nabla c|^2 + |\nabla f|^2) \; \mathrm dx \mathrm dy.$$
	\item We stick to the first proposal for the energy functional. \\
		The Euler-Lagrange equations now look like this
		\begin{eqnarray*}
			0 & = & J_{11} a + J_{12} b + J_{13} c + J_{14} d + J_{15} e + J_{16} f + J_{17} - \alpha \Delta a \\
			0 & = & J_{12} a + J_{22} b + J_{23} c + J_{24} d + J_{25} e + J_{26} f + J_{27} - \alpha \Delta b \\
			& \vdots & \\
			0 & = & J_{61} a + J_{62} b + J_{63} c + J_{64} d + J_{65} e + J_{66} f + J_{67} - \alpha \Delta f
		\end{eqnarray*}
		So, there are 6 Euler-Lagrange equations in total.
\end{enumerate}

\exercise{Motion Tensors}
\begin{enumerate}
	\item Constancy of the determinant of the Hessian:
		$$\text{det}(\mathcal{H}_2 f(x,y,t)) - \text{det}(\mathcal{H}_2 f(x+u,y+v,t+1)) = 0$$
		Linearisation of
		\begin{eqnarray*}
			&& f_{xx}(x,y,t) \cdot f_{yy}(x,y,t) - f_{xy}^2(x,y,t) \\
			& - & \Big(f_{xx}(x+u,y+v,t+1) \cdot f_{yy}(x+u,y+v,t+1) \\
			&& \quad - f_{xy}^2(x+u,y+v,t+1)\Big) = 0
		\end{eqnarray*}
		gives
		$$\Big(\underbrace{f_{xx} f_{yy} - f_{xy}^2}_{=:p}\Big)_x u + \Big(\underbrace{f_{xx} f_{yy} - f_{xy}^2}_{=:p}\Big)_y v + \Big(\underbrace{f_{xx} f_{yy} - f_{xy}^2}_{=:p}\Big)_t = 0$$
%		The motion tensor now reads
%		\begin{eqnarray*}
%			J(\nabla_3 \text{det}(\mathcal{H}_2 f)) & = & \nabla_3 \text{det}(\mathcal{H}_2 f) \nabla_3 \text{det}(\mathcal{H}_2 f)^\top \\
%			& = & \left(\begin{array}{ccc}p_{xx} & p_{xy} & p_{xt} \\ p_{xy} & p_{yy} & p_{yt} \\ p_{xt} & p_{yt} & p_{tt}\end{array}\right)
%		\end{eqnarray*}
		Let's compute the different components:
		\begin{eqnarray*}
			p_x & = & f_{xxx} \cdot f_{yy} + f_{xx} \cdot f_{xyy} - 2 f_{xy} f_{xxy} \\
			p_y & = & f_{xxy} \cdot f_{yy} + f_{xx} \cdot f_{yyy} - 2 f_{xy} f_{xyy} \\
			p_t & = & f_{xxt} \cdot f_{yy} + f_{xx} \cdot f_{yyt} - 2 f_{xy} f_{xyt} \\[0.3cm]
			\Leftrightarrow \nabla p & = & \nabla_3 f_{xx} \cdot f_{yy} + \nabla_3 f_{yy} \cdot f_{xx} - 2 f_{xy} \nabla_3 f_{xy} \\[0.3cm]
			\Rightarrow J & = & \nabla p \nabla_3 p^\top
		\end{eqnarray*}
		The aperture problem is always present since there is only one equation and two variables.
	\item Extending the motion tensor to RGB colour images is easy. One only has to redefine $p$ in the following way: We now use $(f_1, f_2, f_3)^\top = (R, G, B)^\top$ as our function $f$, giving us one equation for every channel. We now have three equations
		$$\Big(\underbrace{f_{i_{xx}} f_{i_{yy}} - f_{i_{xy}}^2}_{=:p}\Big)_x u + \Big(\underbrace{f_{i_{xx}} f_{i_{yy}} - f_{i_{xy}}^2}_{=:p}\Big)_y v + \Big(\underbrace{f_{i_{xx}} f_{i_{yy}} - f_{i_{xy}}^2}_{=:p}\Big)_t = 0, \; i = 1,2,3.$$
		In some situations, the data term may be sufficient to compute the flow, but not always. This means that the aperture problem can still pop up.
\end{enumerate}


\end{document}
