From 8c4d7c4a69b862c7009db23267c99dce38ff013c Mon Sep 17 00:00:00 2001 From: xyquadrat Date: Fri, 19 Jan 2024 12:17:13 +0100 Subject: [PATCH] Fix all LaTeX warnings, small content fixes --- viscomp/viscomp.tex | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/viscomp/viscomp.tex b/viscomp/viscomp.tex index 9044cc8..1ff1a1f 100644 --- a/viscomp/viscomp.tex +++ b/viscomp/viscomp.tex @@ -1,6 +1,7 @@ % Basic stuff \documentclass[a4paper,10pt]{article} \usepackage[nswissgerman]{babel} +\usepackage{lmodern} % 3 column landscape layout with fewer margins \usepackage[landscape, left=0.75cm, top=0.75cm, right=0.75cm, bottom=1.25cm, footskip=10pt]{geometry} @@ -44,9 +45,9 @@ % Mathematical typesetting & symbols \usepackage{amsthm, mathtools, amssymb} -\usepackage{marvosym, wasysym} \usepackage{xfrac} \usepackage{siunitx} +\usepackage{bm} \allowdisplaybreaks % Tables @@ -78,8 +79,8 @@ \author{Julian Steinmann} \date{\vspace{-10pt}Winter 2023} -\newcommand*\good{\item[\textcolor{goodgreen}{\( \boldsymbol{+} \)}]} -\newcommand*\bad{\item[\textcolor{badred}{\( \boldsymbol{-} \)}]} +\newcommand*\good{\item[\textcolor{goodgreen}{\(\bm{+}\)}]} +\newcommand*\bad{\item[\textcolor{badred}{\(\bm{-}\)}]} \begin{document} @@ -129,7 +130,7 @@ \subsubsection{Complete partition} Finite set of non-overlapping regions \( R_1, \dots, R_n \) s.t. \( I = \bigcup_{i=1}^N R_i \) (covers the whole image). \subsubsection{Thresholding} -label pixel in or out by comparing with a threshold T +label pixel in or out by comparing with a threshold \( T \in \mathbb{R} \) (\( \lVert (r,g,b) - (c_r,c_g,c_b) \rVert_2 \le T \) with \( c = (c_r,c_g,c_b) \) being a \textit{root color} for color images) \subsubsection{Chromakeying} use special background color if segmentation is desired @@ -150,10 +151,11 @@ \subsubsection{Background subtraction} Simple: \( I_\alpha = \left| I - I_{bg} \right| < T \), better: \( I_\alpha = \sqrt{(I-I_{bg})^\top \Sigma^{-1} (I-I_{bg})} \) \subsubsection{Morphological operators} -Logical transformations based on comparisons: \textit{erode} (delete FG pixels with 8-conn. BG pixels), \textit{dilate} (add FG pixel to every 8-connected FG pixel), combination useful for smoothing / removing noise +Logical transformations: \textit{erode} (delete FG pixels with 8-conn. BG pixels), \textit{dilate} (add FG pixel to every 8-connected FG pixel), combination useful for smoothing / removing noise \subsection{Image Filtering} \begin{itemize} + \item \textbf{linear} - if \( L(\alpha I_{1} + \beta I_{2}) = \alpha L(I_{1}) + \beta L(I_{2}) \) holds \item \textbf{separable} - if we can write a kernel as a product of two (usually simpler) filters. Gaussian is separable \item \textbf{shift invariant} - kernel does the same for all pixels \item \textbf{filter at edges} - clip to black, wrap around, copy edge, reflect across edge, vary filter near edge @@ -203,7 +205,7 @@ \subsubsection{Hough transform} Fits straight lines to edge pixels (\( y = mx + \item Detect peaks, e.g. by thresholding after non-maximum suppresion \end{enumerate} Infinite slopes are a problem, so reparametrize line with \( (\Theta , p): \; x \cdot \sin (\Theta )- y \cdot \cos (\Theta ) + p = 0 \). For detecting circles with known radius use \( (x-a)^2+(y-b)^2 = r^2 \) -\subsubsection{Harris corner detection} Scan picture with a given window size and compute the second moment matrix \( M = \left[\begin{smallmatrix}\sum I_x(x,y)^2 & \sum I_x(x,y)\cdot I_y(x,y) \\ \sum I_x(x,y)\cdot I_y(x,y) & \sum I_y(x,y)^2 \end{smallmatrix}\right] \). Then compute \( C(x,y) = \det(M) - k\cdot (\text{trace}(M))^2 = \lambda_1 \cdot \lambda_2 - k(\lambda_1 + \lambda_2)^2 \) and mark as corner if \( c(x,y) > T \). Do non-maximum suppression to avoid duplicate detections and for better localization, add gaussian weighting to all terms in \( M \): \( G(x-x_0, y-y_0, \sigma) \). Invariant to shift, rotation and brightness offset but not scaling +\subsubsection{Harris corner detection} Scan picture with a given window size and compute the second moment matrix \[ M = \left[\begin{smallmatrix}\sum I_x(x,y)^2 & \sum I_x(x,y)\cdot I_y(x,y) \\ \sum I_x(x,y)\cdot I_y(x,y) & \sum I_y(x,y)^2 \end{smallmatrix}\right] \] Then compute \( C(x,y) = \det(M) - k\cdot (\text{trace}(M))^2 = \lambda_1 \cdot \lambda_2 - k(\lambda_1 + \lambda_2)^2 \) and mark as corner if \( c(x,y) > T \). Do non-maximum suppression to avoid duplicate detections and for better localization, add gaussian weighting to all terms in \( M \): \( G(x-x_0, y-y_0, \sigma) \). Invariant to shift, rotation and brightness offset but not scaling \subsubsection{Scale Invariant Feature Transform (SIFT)} Useful to find corresponding feature points in two images. Approach: Look for strong responses of Difference of Gaussian (DoG) over scale space and position, consider local maxima in both spaces to find blobs. Compute histogram of gradient directions (ignoring gradient mag. because of lighting etc.) at selected scale and position and correct rotation by choosing principal direction. Now both pictures are at the same scale \& orientation, so we can compare gradient histograms to find matching points. \[ \text{DoG}(x,y) = \frac{1}{k} e^{\frac{x^2+y^2}{(k\sigma)^2}} - e^{-\frac{x^2+y^2}{\sigma ^2}}, \quad \text{e.g. } k=\sqrt{2} \] @@ -293,12 +295,12 @@ \subsection{Optical Flow} \subsubsection{Aperture problem} 2 unknowns for every pixel \( (u,v) \) but only one equation \( \implies \infty\) solutions, opt. flow constraint defines a line in \( (u,v) \) space, can compute normal flow. We therefore need an additional constraint for computation \subsubsection{Horn \& Schunck} Assumption: values \( u(x,y), v(x,y) \) are smooth and change slowly with \( x,y \implies \) Minimize \( E = E_s + \lambda E_c, \lambda > 0 \) where \begin{flalign*} - E_c &= \iint (I_x u + I_y v + I_t)^2 \mathop{dx} \mathop{dy} && \text{(brightness constancy)} \\ + E_c &= \iint (I_x u + I_y v + I_t)^2 \mathop{dx} \mathop{dy} && \text{(brightness const.)} \\ E_s &= \iint (u^2_x u^2_y) + (v^2_x + v^2_y) \mathop{dx} \mathop{dy} && \text{(smoothness)} \end{flalign*} -Has errors at boundaries / information spreads from corner-type patterns +Has errors at boundaries, information spreads from corner-type patterns \subsubsection{Applications} Frame extrapolation, frame interpolation, video compression (exploit temp. red.), structure from motion, object tracking, video stabilization (aim at OF \( \approx 0 \)) -\subsubsection{Lucas-Kanade} Assume all neighbouring pixels in a patch \( W \) observer the same motion \( \left[ u,v \right]^\top \) (+ small movement, brightness constancy). Minimize \[ E = \sum_{(x,y)\in W} (I_x(x,y)u + I_y(x,y)v + I_t(x,y))^2 \] Solve least squares (sums are over patch \( W \)): +\subsubsection{Lucas-Kanade} Assume all neighbouring pixels in a patch \( W \) observer the same motion \( \left[ u,v \right]^\top \) (+ small movement, brightness constancy). Compute \( I_x, I_y, I_t \) and minimize \[ E = \sum_{(x,y)\in W} (I_x(x,y)u + I_y(x,y)v + I_t(x,y))^2 \] Solve least squares (sums are over patch \( W \)): \[ \left[ \begin{smallmatrix} @@ -448,12 +450,13 @@ \subsubsection{3D Transformations} Examples: \\ Trans. & \( \left[\begin{smallmatrix} 1 & 0 & 0 & t_x \\ 0 & 1 & 0 & t_y \\ 0 & 0 & 1 & t_z \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) & Scaling & \( \left[\begin{smallmatrix} s_x & 0 & 0 & 0 \\ 0 & s_y & 0 & 0 \\ 0 & 0 & s_z & 0 \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) \\ Rot. (x) & \( \left[\begin{smallmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta & 0 \\ 0 & \sin \theta & \cos \theta & 0 \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) & - Rot. (y) & \( \left[\begin{smallmatrix} \cos \theta & 0 & \sin \theta & 0 \\ 0 & 0 & 1 & 0 \\ -\sin \theta & 0 & \cos \theta & 0 \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) \\ + Rot. (y) & \( \left[\begin{smallmatrix} \cos \theta & 0 & \sin \theta & 0 \\ 0 & 1 & 0 & 0 \\ -\sin \theta & 0 & \cos \theta & 0 \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) \\ Rot. (z) & \( \left[\begin{smallmatrix} \cos \theta & -\sin \theta & 0 & 0 \\ \sin \theta & \cos \theta & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) & Shear (2D) & \( \left[\begin{smallmatrix} 1 & a & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{smallmatrix}\right] \) \\ Shear (x) & \( \left[\begin{smallmatrix} 1 & 0 & \text{sh}_x & 0 \\ 0 & 1 & \text{sh}_y & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{smallmatrix}\right] \) & \\ \end{tabularx} \egroup +If we have e.g. \( \left[\begin{smallmatrix} -1 & 0 & 0 \\ 0 & -1 & 0 \\ 2 & 2 & 1 \end{smallmatrix}\right] \), we first scale/rotate, then translate (follows from matrix multiplication laws). \subsubsection{Commutativity} \( M_1 M_{2} = M_{2} M_{1} \) holds for @@ -517,11 +520,11 @@ \subsubsection{Radient/Luminous Intensity} \( I(\vec{w}) = \sfrac{d \Phi}{d \vec \subsubsection{Radiance/Luminance} \( L(x, \vec{w}) = \sfrac{d^2 \Phi (A)}{\cos \theta d A(x) d \vec{w}} \) \\ Flux per solid angle per perpendicular area = effective intensity per unit area \subsubsection{Lambert's Cosine Law} Irradiance at surface is proportional to cosine of angle between light direction and surface normal: \( E = \frac{\Phi}{A} \cos \theta \) -\begin{figure}[h] - \center + +\begin{figure}[ht] + \centering \includegraphics[width=0.4\linewidth]{lamberts-law.png} \end{figure} - \subsubsection{Lighting} Modeling physical interactions between materials and light sources \subsubsection{Shading} Process of determining the color of a pixel \subsubsection{Phong Reflection / Illumination Model} @@ -557,14 +560,13 @@ \subsubsection{Transparency} \( I_\lambda = I_{\lambda_1} \alpha_1 \Delta t + I_ Problem: Rendering order, we need sorted traversal of polygons \( \to \) back-to-front rendering \begin{figure}[h] + \centering \includegraphics[width=0.6\linewidth]{transparency.png} \end{figure} \subsection{Geometry \& Textures} -\subsubsection{Parametric Surface} \( (x(u,v), y(u,v), z(u,v)) \) -\subsubsection{Subdivision Surface} Define surface by primitives, use recursive algorithm for refining -\subsubsection{Implicit Surface} Zero set of a function -\subsubsection{Polygonal Mesh} Explicit set of vertices with position + connectedness information. Every vertex can have additional attributes (color, normal) +\subsubsection{Explicit representations} Point cloud, subdivision surface (define surface with primitives, use recursive algorithm for refining), polygon mesh. Can easily model complex shapes and sample points from it, but it can take lots of storage +\subsubsection{Implicit representations} Signed distance function, algebraic surface \( (x(u,v), y(u,v), z(u,v)) \), level set. Can easily test inside/outside, compact storage but sampling all points is expensive, complex shapes hard to model \subsubsection{Texture Mappings} Goal: Map Texture \( (u,v) \)-coords. to geometry \( (x,y,z) \)-coords. Example of sphere mapping: \\\( (u,v) \to (\sin (u) \sin (v), \cos (v), \cos (u) \sin (v)) \). We want low distortion, a bijective mapping that is efficiently computable. \subsubsection{Light Maps} Save computation power by precomputing static lighting and applying it to texture (can be dynamically adapted) \subsubsection{Environment Maps} Mirror environment with imaginary sphere / cube for easier computation of reflective objects