Files
2018-12-27 23:17:31 +00:00

79 lines
3.0 KiB
Plaintext

\newcommand{\scale}{1.2}
\newcommand{\xfshift}{4cm}
\begin{tikzpicture}
\begin{scope}[scale=\scale]
\tikzstyle{refmv_line}=[thick,draw=black]
\tikzstyle{refmv}=[refmv_line,-latex,densely dashed]
\tikzstyle{refmv_0}=[refmv,]
\tikzstyle{refmv_1}=[refmv_0]
\newcommand{\DrawFrame}[2]
{
\fill[fill=#1,fill opacity=.6] (0,0) rectangle (#2+1,#2+1); % Opacity
\draw[thick] (0,0) rectangle (#2+1,#2+1);
\foreach \x in {1,...,#2}
\draw (\x,0) -- ++(0,#2+1);
\foreach \y in {1,...,#2}
\draw (0,\y) -- ++(#2+1,0);
}
% Frame t
\begin{scope}[yshift=2*\TikZyfshift, xshift=2*\xfshift, yslant=\TikZyslant,xscale=\TikZxscale]
\coordinate (T0B1) at (0.5-0.25,2.5+0.25);
\coordinate (T0B2) at (1.5,2.5);
\coordinate (T0B3) at (2.5,2.5);
\coordinate (T0B4) at (0.5,1.5);
\coordinate (T0B5) at (1.5,1.5);
\coordinate (T0B6) at (2.5,1.5);
\coordinate (T0B7) at (0.5,0.5);
\coordinate (T0B8) at (1.5,0.5);
\coordinate (T0B9) at (2.5,0.5);
\DrawFrame{white}{2}
\foreach \x in {0,2}
\foreach \y in {0,2}
\draw[fill=gray!40,fill opacity=0.6] (\x,\y) +(0,0) rectangle ++(1,1);
\draw[fill=gray!40,fill opacity=0.6] (1,1) +(0,0) rectangle ++(1,1);
\begin{scope}[yshift=2cm, xshift=0,scale=0.5]
\foreach \x in {0,1}
\foreach \y in {0,1}
\draw (\x,\y) +(0,0) rectangle ++(1,1);
\begin{scope}[ yshift=1cm, xshift=1cm,scale=0.5]
\foreach \x in {0,1}
\foreach \y in {0,1}
\draw (\x,\y) +(0,0) rectangle ++(1,1);
\end{scope}
\end{scope}
\node[font=\footnotesize, text width=3cm, text centered] () at (1.5,-0.6) {Current frame ($C$)};
\node[scale=0.6, text width=2cm, text centered] (CTULabel) at (2.5,0.5) {CTU};
\end{scope}
% Frame t-1
\begin{scope}[ yshift=1*\TikZyfshift, xshift=1*\xfshift, yslant=\TikZyslant,xscale=\TikZxscale]
\coordinate (TM1B1) at (0.5,2.5);
\coordinate (TM1B3) at (2.5-0.3,2.5);
\coordinate (TM1B5) at (1.5,1.5);
% Draw Motion vectors
\draw[refmv] (T0B1) to (TM1B1);
\draw[refmv_line,shorten >=28] (T0B1) to (TM1B1);
\draw[refmv] (T0B3) to (TM1B3);
\draw[refmv_line,shorten >=15] (T0B3) to (TM1B3);
\draw[refmv] (T0B5) to (TM1B5);
\draw[refmv_line,shorten >=25] (T0B5) to (TM1B5);
\DrawFrame{gray!40}{2}
\node[font=\footnotesize, text width=3cm, text centered] () at (1.5,-0.6) {Ref. frame 1 ($r_1$)};
\end{scope}
% Frame t-2
\begin{scope}[ yshift=0*\TikZyfshift, xshift=0*\xfshift, yslant=\TikZyslant,xscale=\TikZxscale]
\coordinate (TM2B4) at (0.5-0.2,1.5+0.2);
\coordinate (TM2B6) at (2.5-0.1,1.5-0.1);
\coordinate (TM2B8) at (1.5-0.3,0.5+0.3);
\coordinate (TM2) at (1.5,1.5);
\draw[refmv] (T0B4) to (TM2B4);
\draw[refmv_line,shorten >=40,shorten <=79] (T0B4) to (TM2B4);
\draw[refmv_line,shorten >=117] (T0B4) to (TM2B4);
\draw[refmv] (T0B8) to (TM2B8);
\draw[refmv_line,shorten >=27,shorten <=80] (T0B8) to (TM2B8);
\draw[refmv_line,shorten >=105] (T0B8) to (TM2B8);
\DrawFrame{white}{2}
\node[font=\footnotesize, text width=3cm, text centered] () at (1.5,-0.6) {Ref. frame 2 ($r_2$)};
\end{scope}
\end{scope}
\end{tikzpicture}