\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,% decorations.pathreplacing,decorations.pathmorphing,shapes,% matrix,shapes.symbols,plotmarks,decorations.markings,shadows,backgrounds} \newcommand{\scale}{1} \newcommand{\TikZyslant}{-0.2} \newcommand{\xslant}{0} \newcommand{\xframeshift}{5cm} \newcommand{\yframeshift}{0cm} \pgfdeclarelayer{background} \pgfdeclarelayer{foreground} \pgfdeclarelayer{L0} \pgfdeclarelayer{L1} \pgfdeclarelayer{L2} \pgfdeclarelayer{L3} \pgfsetlayers{background,L0,L1,L2,L3,main,foreground} \begin{tikzpicture}[scale=\scale,every node/.style={minimum size=1cm},on grid ] \tikzstyle{pel}=[rectangle,draw=black, thick] \tikzstyle{refblock}=[rectangle,draw=darkgray, thick] \tikzstyle{projectedblock}=[rectangle,draw=black, thick,dashed] \tikzstyle{refmv_linestyle}=[-,very thick] \tikzstyle{refmv}=[refmv_linestyle,decoration={markings,mark=at position 1 with {\arrow[ultra thick,scale=1]{latex}}}, postaction={decorate}] \tikzstyle{arrow}=[draw, ->,>=stealth',thick,,decoration={markings,mark=at position 1 with {\arrow[ultra thick,scale=1]{stealth}}}, postaction={decorate}] \tikzstyle{every node}=[font=\large] \tikzstyle{frame_contour}=[ultra thick,fill=white,draw=black,fill opacity=.7] \newcommand{\DrawFrame}{ %outside line \draw[thick,fill=white,draw=black,fill opacity=.7](0,0) rectangle (3,3); \foreach \x in {0,2} \foreach \y in {0,2} \draw[black,loosely dashed] (\x,\y) +(0,0) rectangle ++(1,1); \foreach \x in {1} \foreach \y in {1} \draw[black,loosely dashed] (\x,\y) +(0,0) rectangle ++(1,1); } \begin{scope}[ yshift=0, xshift=0] % Frame t+1 \begin{scope}[ yshift=2*\yframeshift, xshift=2*\xframeshift, style={yslant=\TikZyslant,xslant=\xslant}] \coordinate (Bottom_V1) at (2.5,0); \DrawFrame %Draw a frame \coordinate (RefBlock) at (1,2); \draw[refblock] (RefBlock) rectangle ++(1,-1); \draw[refmv,style={yslant=-\TikZyslant,xslant=-\xslant},fill=red,draw=red] (RefBlock) to ++(-2,0.2); \node[scale=0.8] at (-0.7,2.25) { $mv_{t+1}$ }; \end{scope} % Frame t-1 \begin{scope}[ yshift=0, xshift=0, style={yslant=\TikZyslant,xslant=\xslant}] \coordinate (TM2B3) at (1-0.8,2-0.8); \coordinate (TM2B4) at (3+0.3,2-0.4); % Draw Motion vectors %\draw[refmv] (T0B3) to (TM2B3); \DrawFrame; %Draw a frame \coordinate (RefBlock) at (1,2); \draw[refblock] (RefBlock) rectangle ++(1,-1); \draw[refmv,style={yslant=-\TikZyslant,xslant=-\xslant},fill=blue,draw=blue] (RefBlock) to ++(-2,-0.4); \node[scale=0.8] at (-0.7,1.8) { $mv_{t-1}$ }; \end{scope} % Frame t \begin{scope}[ yshift=1*\yframeshift, xshift=1*\xframeshift, style={yslant=\TikZyslant,xslant=\xslant}] %Define Points \coordinate (TM1B1) at (1-0.7,4-0.8); \coordinate (TM1B2) at (3-0.6,4-0.5); \DrawFrame; %Draw a frame \coordinate (RefBlock) at (1,2); \node[scale=0.6] at (1.5,1.5) { LB }; \draw[refblock] (RefBlock) rectangle ++(1,-1); \draw[refmv,style={yslant=-\TikZyslant,xslant=-\xslant},fill=red,draw=red] (RefBlock) to ++(-2,0.2); \node[scale=0.8] at (-0.7,2.25) { $mv_{t+1}$ }; \draw[refmv,style={yslant=-\TikZyslant,xslant=-\xslant},fill=blue,draw=blue] (RefBlock) to ++(-2,-0.4); \node[scale=0.8] at (-0.7,0.9) { $mv_{t-1}$ }; \end{scope} % Frame number \begin{scope}[xshift=1.5cm,yshift=3.2cm] \tikzstyle{frame_label}=[anchor=center,scale=0.9] \node[frame_label] at (0*\xframeshift,\yframeshift*3) { $f_{t-1}$ }; \node[frame_label] at (1*\xframeshift,\yframeshift*3) { $f_{t}$ }; \node[frame_label] at (2*\xframeshift,\yframeshift*3) { $f_{t+1}$ }; \end{scope} \end{scope} \end{tikzpicture}