Files
phd-thesis-beamer/img/animation/conv.tex
2020-12-01 10:31:06 +01:00

57 lines
1.9 KiB
TeX

\documentclass[10pt,tikz]{standalone}
\usepackage{tikz}
\usepackage{ifthen}
\usepackage{physics}
\usepackage{upgreek}
\newlength{\cell}
\setlength{\cell}{1cm}
\newlength{\separation}
\setlength{\separation}{3cm}
\begin{document}
\foreach \m in {0,...,9}
{
\foreach \n in {0,...,7}
{
\begin{tikzpicture}
% draw main grid
\draw[line width=1mm] (0,0) rectangle (10 * \cell, 12 * \cell);
\foreach \x in {0,...,9}
{
\foreach \y in {0,...,11}
{
\draw[fill=orange!20, opacity=0.5] (\x * \cell, \y * \cell) rectangle (\x * \cell + \cell, \y * \cell + \cell);
}
}
\node[anchor=base] at (5 * \cell, -\cell) {$a^{\qty{l}}$};
% draw filter
\draw[line width=1mm] (10 * \cell + \separation, 0) rectangle (18 * \cell + \separation, 10 * \cell);
\foreach \x in {0,...,7}
{
\foreach \y in {0,...,9}
{
\draw[fill=orange!20, opacity=0.5] (10 * \cell + \separation + \x * \cell, \y * \cell) rectangle (10 * \cell + \separation + \x * \cell + \cell, \y * \cell + \cell);
}
}
% draw convolution
\draw[line width=0.5mm, red, fill=red!30, opacity=0.5] (\n * \cell, 12 * \cell - \m * \cell) rectangle (\n * \cell + 3 * \cell, 12 * \cell - 3 * \cell - \m * \cell);
\draw[line width=0.5mm, red, fill=red!30, opacity=0.5] (\n * \cell + 10 * \cell + \separation, 9 * \cell - \m * \cell) rectangle (\n * \cell + 10 * \cell + \separation + \cell, 9 * \cell + \cell - \m * \cell);
\draw[thick, red] (\n * \cell + 1.5 * \cell, 12 * \cell - \m * \cell) -- (\n * \cell + 10 * \cell + \separation + 0.5 * \cell, 10 * \cell - 0.5 * \cell - \m * \cell) -- (\n * \cell + 1.5 * \cell, 9 * \cell - \m * \cell);
\node[anchor=base] at (10 * \cell + \separation + 4 * \cell, -\cell) {$\upphi^{-1}\qty(a^{\qty{l+1}})$};
\end{tikzpicture}
}
}
\end{document}