Page MenuHomec4science

1_2Dsp.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 10:24

1_2Dsp.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com202}
\usepackage{pst-3dplot}
\usepackage{pst-tree}
\begin{document}
\intertitle{two-dimensional signal processing}
\def\var{5 }
\begin{frame} \frametitle{Two-dimensional discrete-space signals}
\begin{columns}
\begin{column}{0.55\paperwidth}
\begin{itemize}
\item notation: $x[n_1, n_2]$, $n_1, n_2 \in \mathbb{Z}$
\item indexes $n_1, n_2$ locate a point on a grid
\item grid is usually regularly spaced
\end{itemize}
\end{column}
\begin{column}{0.45\paperwidth}
\begin{figure}
\begin{center}
\psset{unit=1.4mm}
\begin{pspicture}(-5,-5)(5,15)
\psset{Beta=15}
\psplotThreeD[hiddenLine=true,plotstyle=curve,drawStyle=yLines,% is the default anyway
yPlotpoints=29,xPlotpoints=29,linewidth=0.6pt](-14,14)(-14,14){%
x x mul y y mul add -2 \var \var mul mul div 2.71828 exch exp 10 mul}
\pstThreeDCoor[linecolor=darkgray,xMin=-15,xMax=16,nameX={$n_1$},yMin=-15,yMax=16,nameY={$n_2$},zMin=0,zMax=13,nameZ={$x[n_1,n_2]$}]
\end{pspicture}
\end{center}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame} \frametitle{2D signals: support representation}
\begin{columns}
\begin{column}{0.45\paperwidth}
\begin{itemize}
\item show coordinates of nonzero values
\item values may be written alongside position
\item example: the 2D discrete-space impulse:
\[
\delta[n_1, n_2] = \begin{cases}
1 & \mbox{if $n_1= n_2 = 0$} \\
0 & \mbox{otherwise}
\end{cases}
\]
\end{itemize}
\end{column}
\begin{column}{0.45\paperwidth}
\begin{figure}
\begin{center}
\begin{dspCP}[width=5cm,xticks=5,yticks=5,xout=true,xlabel={$n_1$},ylabel={$n_2$}]{-6,6}{-6,6}
\moocStyle
\dspPoints{0 0}\uput{1ex}[45]{0}(0,0){\tiny $1$}
\end{dspCP}
\end{center}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame} \frametitle{The 2D discrete-space rect}
\begin{columns}
\begin{column}{0.45\paperwidth}
\[
\rect\left(\frac{n_1}{2N_1}, \frac{n_2}{2N_2}\right) = \begin{cases}
1 & \parbox[t]{10em}{if $|n_1| < N_1$ \\ and $|n_2| < N_2$} \\ \\
0 & \mbox{otherwise}
\end{cases}
\]
\end{column}
\begin{column}{0.45\paperwidth}
\begin{figure}
\begin{center}
\begin{dspCP}[width=5cm,xticks=5,yticks=5,xout=true]{-6,6}{-6,6}
\moocStyle
\dspPoints{-3 2 -2 2 -1 2 0 2 1 2 2 2 3 2
-3 1 -2 1 -1 1 0 1 1 1 2 1 3 1
-3 0 -2 0 -1 0 0 0 1 0 2 0 3 0
-3 -1 -2 -1 -1 -1 0 -1 1 -1 2 -1 3 -1
-3 -2 -2 -2 -1 -2 0 -2 1 -2 2 -2 3 -2 }
\end{dspCP}
\end{center}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame} \frametitle{A new concept: separability}
\centering
A separable 2D signal can be decomposed as the product of two 1D signals:
\[
x[n_1, n_2] = x_1[n_1]x_2[n_2]
\]
\end{frame}
\begin{frame} \frametitle{Examples of separable signals}
\[
\delta[n_1, n_2] = \delta[n_1]\delta[n_2]
\]
\vspace{2em}
\[
\rect\left(\frac{n_1}{2N_1}, \frac{n_2}{2N_2}\right) = \rect\left( \frac{n_1}{2N_1} \right) \rect\left( \frac{n_2}{2N_2} \right).
\]
\end{frame}
\begin{frame} \frametitle{Nonseparable signal}
\begin{columns}
\begin{column}{0.45\paperwidth}
\[
x[n_1, n_2] = \begin{cases}
1 & \mbox{if $|n_1| + |n_2| < N$} \\
0 & \mbox{otherwise}
\end{cases}
\]
\end{column}
\begin{column}{0.45\paperwidth}
\begin{figure}
\begin{center}
\begin{dspCP}[width=5cm,xticks=5,yticks=5,xout=true]{-6,6}{-6,6}
\moocStyle
\dspPoints{0 2
-1 1 0 1 1 1
-2 0 -1 0 0 0 1 0 2 0
-1 -1 0 -1 1 -1
0 -2}
\end{dspCP}
\end{center}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame} \frametitle{Nonseparable signal}
\begin{columns}
\begin{column}{0.45\paperwidth}
\[
x[n_1, n_2] = \rect\left(\frac{n_1}{2N_1}, \frac{n_2}{2N_2}\right) - \rect\left(\frac{n_1}{2M_1}, \frac{n_2}{2M_2}\right)
\]
\end{column}
\begin{column}{0.45\paperwidth}
\begin{figure}
\begin{center}
\begin{dspCP}[width=5cm,xticks=5,yticks=5,xout=true]{-6,6}{-6,6}
\moocStyle
\dspPoints{-3 3 -2 3 -1 3 0 3 1 3 2 3 3 3
-3 2 -2 2 -1 2 0 2 1 2 2 2 3 2
-3 1 -2 1 2 1 3 1
-3 0 -2 0 2 0 3 0
-3 -1 -2 -1 2 -1 3 -1
-3 -2 -2 -2 -1 -2 0 -2 1 -2 2 -2 3 -2
-3 -3 -2 -3 -1 -3 0 -3 1 -3 2 -3 3 -3 }
\end{dspCP}
\end{center}
\end{figure}
\end{column}
\end{columns}
\end{frame}
\begin{frame} \frametitle{Two-dimensional filters}
\[
y[n_1, n_2] = \mathcal{H}\{x[n_1, n_2]\}
\]
\vspace{2em}
\begin{itemize}
\item linearity: $\mathcal{H}\{a x[n_1, n_2] + b w[n_1, n_2]\} = a\mathcal{H}\{x[n_1, n_2]\} + b \mathcal{H}\{w[n_1, n_2]\}$
\item space invariance: $\mathcal{H}\{x[n_1 - d_1, n_2 - d_2]\} = y[n_1-d_1, n_2-d_2]$
\item impulse response $h[n_1, n_2] = \mathcal{H}\{\delta[n_1, n_2]\}$
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Two-dimensional filters}
\centering
A linear, space-invariant 2D filter implements a 2D convolution:
\[
(x \ast h)[n_1, n_2] = \sum_{k_1 = -\infty}^{\infty}\sum_{k_2 = -\infty}^{\infty} x[k_1,k_2]h[n_1-k_1,n_2-k_2]
\]
\end{frame}
\begin{frame} \frametitle{2D convolution for separable signals}
\centering
If $h[n_1, n_2] = h_1[n_1]h_2[n_2]$:
\[
(x \ast h)[n_1, n_2] = \sum_{k_1 = -\infty}^{\infty}h_1[n_1-k_1] \sum_{k_2 = -\infty}^{\infty} x[k_1,k_2]h_2[n_2-k_2]
\]
\vspace{1em}
\begin{itemize}
\item each column of $x[n_1, n_2]$ is a 1D signal $x_{n_1}[n]$
\item convolve each column $x_{n_1}[n]$ with $h_2[n]$ to obtain the 2D intermediate signal $c[n_1, n_2]$
\item each row of $c[n_1, n_2]$ is a 1D signal $c_{n_2}[n]$
\item convolve each row $c_{n_2}[n]$ with $h_1[n]$ to obtain the final output
\end{itemize}
\end{frame}
\begin{frame} \frametitle{2D convolution for separable signals}
If $h[n_1, n_2]$ is an $M_1 \times M_2$ finite-support signal:
\begin{itemize}
\item non-separable convolution: $M_1 M_2$ operations per output sample
\item separable convolution: $M_1 + M_2$ operations per output sample!
\end{itemize}
\end{frame}
\begin{frame} \frametitle{The two-dimensional Discrete Fourier Transform}
Straightforward extension of th 1D-DFT to two dimensions:
\begin{itemize}
\item an $N_1\times N_2$ signal $x[n_1,n_2]$ yields $N_1 N_2$ DFT coefficients
\item DFT computes the similarity between $x[n_1,n_2]$ and the DFT basis vectors
\item the $N_1 N_2$ basis vectors are $N_1\times N_2$ sinusoidal signals
\end{itemize}
\end{frame}
\begin{frame} \frametitle{2D-DFT: analysis and synthesis}
Analysis formula:
\[
X[k_1, k_2] = \sum_{n_1 = 0}^{N_1-1}\sum_{n_2=0}^{N_2-1} x[n_1,n_2] e^{-j\frac{2\pi}{N_1} n_1 k_1} e^{-j\frac{2\pi}{N_2} n_2 k_2}
\]
\vspace{1em}
Synthesis formula:
\[
x[n_1,n_2] = \frac{1}{N_1 N_2}\sum_{k_1 = 0}^{N_1-1}\sum_{k_2=0}^{N_2-1} X[k_1, k_2] e^{j\frac{2\pi}{N_1} n_1 k_1} e^{j\frac{2\pi}{N_2} n_2 k_2}
\]
\end{frame}
\begin{frame} \frametitle{2D-DFT basis vectors}
\centering
There are $N_1 N_2$ orthogonal basis vectors for an $N_1\times N_2$ image:
\[
w_{k_1,k_2}[n_1,n_2] = e^{j\frac{2\pi}{N_1} n_1 k_1} e^{j\frac{2\pi}{N_2} n_2 k_2}
\]
\vspace{1em}
for $n_1, k_1 = 0, 1, \ldots, N_1-1$ and $n_2, k_2 = 0, 1, \ldots, N_2-1$
\end{frame}
\def\dftbv#1#2#3#4{
\psset{unit=0.4mm}
\begin{pspicture}(-70,-75)(70,10)
\psset{Alpha=40,Beta=30}
\psplotThreeD[hiddenLine=true,plotstyle=line,drawStyle=xyLines,yPlotpoints=100,xPlotpoints=100,linewidth=0.5pt](0,100)(0,100){%
x 3.60 mul #1 mul y 3.6 mul #2 mul add cos 5 mul}
\pstThreeDPut(30,-40,0){\small $k_1=#3, k_2=#4$}
\end{pspicture}}
\begin{frame} \frametitle{2D-DFT basis vectors (real part)}
\centering
\begin{tabular}{ccc}
\dftbv{1}{0}{1}{0} & \hspace{3em} & \dftbv{0}{1}{0}{1} \\
\dftbv{4}{0}{4}{0} & & \dftbv{0}{4}{0}{4}
\end{tabular}
\end{frame}
\begin{frame} \frametitle{2D-DFT basis vectors (real part)}
\centering
\begin{tabular}{ccc}
\dftbv{1}{2}{1}{2} & \hspace{3em} & \dftbv{1}{98}{1}{N_2-1} \\
\dftbv{90}{2}{N-10}{2} & & \dftbv{5}{93}{5}{N-7}
\end{tabular}
\end{frame}
\begin{frame} \frametitle{2D DFT}
\psset{linecolor=darkred}
2D-DFT basis vectors are separable, and so is the 2D-DFT:
\[
X[k_1, k_2] = %
\hlBox{t1}{green!30}{\displaystyle
\sum_{n_1 = 0}^{N_1-1}
\left[
\hlBox{t2}{blue!30}{\displaystyle
\sum_{n_2=0}^{N_2-1}
x[n_1,n_2] e^{-j\frac{2\pi}{N_2} n_2 k_2}}
\right]
e^{-j\frac{2\pi}{N_1} n_1 k_1}}
\]
\begin{itemize}
\item 1D-DFT along $n_2$ \rnode[rc]{T2}{(the columns)~~}
\item 1D-DFT along $n_1$ \rnode[rc]{T1}{(the rows)~~}
\end{itemize}
{\nccurve[angleB=-90]{->}{T2}{t2}}
{\nccurve[angleB=-45]{->}{T1}{t1}}
\end{frame}
\end{document}

Event Timeline